Return-Path: X-Original-To: apmail-cassandra-dev-archive@www.apache.org Delivered-To: apmail-cassandra-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA001788B for ; Wed, 26 Oct 2011 20:18:48 +0000 (UTC) Received: (qmail 82794 invoked by uid 500); 26 Oct 2011 20:18:47 -0000 Delivered-To: apmail-cassandra-dev-archive@cassandra.apache.org Received: (qmail 82757 invoked by uid 500); 26 Oct 2011 20:18:47 -0000 Mailing-List: contact dev-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list dev@cassandra.apache.org Received: (qmail 82749 invoked by uid 99); 26 Oct 2011 20:18:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2011 20:18:47 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of j.zach.richardson@gmail.com designates 74.125.82.44 as permitted sender) Received: from [74.125.82.44] (HELO mail-ww0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2011 20:18:41 +0000 Received: by wwe6 with SMTP id 6so2530759wwe.25 for ; Wed, 26 Oct 2011 13:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=6BfHxQwbAwN/Xl1CEvfHjEh/vzl8f24dD0Chaqr+xkA=; b=PohemM5HLPk6Ayl+SHT11UVsm6rQUNGIz6KZ1C8ei4nVc9mSlTVhzpgCJtCWuccoIm Yrc0mBL5yyd4Ifvt4U6xERVKSZyLvvBE5j/K95s/GunAeJ9XJ0XL9h14nBiiprn9OuY/ 5XpJSbzCLw+sNI3Z/1sQYiaj1QviWpab6SOgc= MIME-Version: 1.0 Received: by 10.216.139.170 with SMTP id c42mr10181346wej.0.1319660300806; Wed, 26 Oct 2011 13:18:20 -0700 (PDT) Received: by 10.216.255.16 with HTTP; Wed, 26 Oct 2011 13:18:20 -0700 (PDT) In-Reply-To: References: Date: Wed, 26 Oct 2011 15:18:20 -0500 Message-ID: Subject: Re: Trying to write tests for CASSANDRA-3127 (Internode Compression) From: Zach Richardson To: dev@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Nick, Thanks for the reply! I ended up creating a custom IVerbHandler to receive the messages from MessagingService, and when I created messages, I set their from field to an address !=3D localhost, so they did not get optimized. This appeared to work! Thanks again. Zach On Mon, Oct 24, 2011 at 10:25 AM, Nick Bailey wrote: > Not sure if you saw this, but org.apache.cassandra.net.sink has a > SinkManager class and an interface for implementing message sinks. Basica= lly > it lets you catch messages as they are being sent or received by > MessagingService. > > Could be useful, and is used in a couple other tests. > > On Sun, Oct 23, 2011 at 11:54 AM, Zach Richardson wro= te: > >> Thanks, >> >> Will give these a shot. >> >> On Sun, Oct 23, 2011 at 11:18 AM, Jonathan Ellis >> wrote: >> >> > I see a couple options. >> > >> > StorageProxy has this constant: >> > >> > =A0 =A0private static final boolean OPTIMIZE_LOCAL_REQUESTS =3D true; = // >> > set to false to test messagingservice path on single node >> > >> > So, you could make it an instance variable and create a SP object with >> > it set to false for tests. >> > >> > Or, you could do a test using ccm for multinode control, as in the >> > long_read.sh test on >> > https://issues.apache.org/jira/browse/CASSANDRA-3303. >> > >> > On Fri, Oct 21, 2011 at 4:28 PM, Zach Richardson >> > wrote: >> > > Hi All, >> > > >> > > I have been working on an implementation for internode compression >> > > (CASSANDRA-3127.) https://issues.apache.org/jira/browse/CASSANDRA-31= 27 >> > > >> > > I have written code that "works," but I'm looking for some advice on >> > > how to write unit tests for it. =A0At the moment it compresses where= : >> > > >> > > interrnode_message_compression_threshold > 0 means it compress >> > > messages larger than it >> > > compresses all messags if it is =3D=3D 0 >> > > and compresses none if less than 0 >> > > >> > > The code itself has been tested in an environment outside of cassand= ra >> > > (i.e. a few mock classes, and a heavily modified OutboundTcpConnecti= on >> > > and IncomingTcpConnection.) and inside of Cassandra all of the curre= nt >> > > unit tests are passing. >> > > >> > > Since I can't inject a mocked MessagingService into >> > > IncomingTcpConnection, I'm guessing I have to do the testing from th= e >> > > outside of MessagingService, but the MessagingService itself checks = to >> > > see if you are sending messages to yourself, and doesn't put them ov= er >> > > the connection. =A0Are there any tricks to letting me mock different >> > > endpoints from within a unit test? >> > > >> > > Can this only be tested in a distributed fashion at the OS level? >> > > >> > > Also the internode_message_compression_threshold is set through the >> > > cassandra.yaml file--is it possible to set these properties at >> > > runtime? =A0Can I just change the public entry for it in the static >> > > Config class directly, or will that break other things? >> > > >> > > Thanks for you help and time, >> > > >> > > Zach >> > > >> > >> > >> > >> > -- >> > Jonathan Ellis >> > Project Chair, Apache Cassandra >> > co-founder of DataStax, the source for professional Cassandra support >> > http://www.datastax.com >> > >> >> >> >> -- >> Zach Richardson >> Ravel, Co-founder >> Austin, TX >> zach@raveldata.com >> 512.825.6031 >> >