Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 76284 invoked from network); 29 Nov 2010 12:19:23 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Nov 2010 12:19:23 -0000 Received: (qmail 23351 invoked by uid 500); 29 Nov 2010 12:19:21 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 23110 invoked by uid 500); 29 Nov 2010 12:19:21 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 23091 invoked by uid 99); 29 Nov 2010 12:19:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 12:19:20 +0000 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of sylvain@yakaz.com does not designate 209.85.212.44 as permitted sender) Received: from [209.85.212.44] (HELO mail-vw0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 12:19:13 +0000 Received: by vws7 with SMTP id 7so1076783vws.31 for ; Mon, 29 Nov 2010 04:18:52 -0800 (PST) Received: by 10.229.229.83 with SMTP id jh19mr4763974qcb.130.1291033131567; Mon, 29 Nov 2010 04:18:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.97.196 with HTTP; Mon, 29 Nov 2010 04:18:31 -0800 (PST) In-Reply-To: <48EBF39C-FF3F-43C0-BFAD-4E5325388413@gmail.com> References: <48EBF39C-FF3F-43C0-BFAD-4E5325388413@gmail.com> From: Sylvain Lebresne Date: Mon, 29 Nov 2010 13:18:31 +0100 Message-ID: Subject: Re: The key list of multiget_slice's parameter has been changed unexpectedly. To: user@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 You should start by trying 0.7 RC1. Some bugs with the use of ByteBuffers have been corrected since beta2. If you still have problem, then it's likely a bug, the byteBuffer should not be changed from under you. If it still doesn't work with RC1, it would be very helpful if you can provide a simple script that reproduce the behavior you describe. On Mon, Nov 29, 2010 at 12:07 PM, eggli wrote: > > Hi everyone, we are working on a Java product based on Cassandra since 0.= 5, and Cassandra made a very huge change in 0.7 beta 2, which changes all b= yte array into ByteBuffers, and we found this problem which confuses us a l= ot, here's the detail about what happened: > > The multiget_slice method in Cassandra.Iface indicated that it requires a= list of keys for multi get slice query, which we believed we have to give = every individual keys to get the data we need, and according to the Java do= c, we will get a Map result, which uses a =A0ByteBuffer as key and ColunmOr= SuperColumn as value, we made a guess that the ByteBuffer is the key we sen= d for query, in the case above, the result Map should looks like if we give= a key list : > > > Key of A -> Data of A > Key of B -> Data of B > Key of C -> Data of C > > In order to get Data of A from the result map, all we need to do is perfo= rm a resultMap.get(A), but we got problem here: The result map's key is som= ething else, it's not the key we gave before, in the case above, it's no lo= nger a list of while the value is exactly the data we need, but it'= s very troublesome we are unable to find the corresponding data from the ke= y. > > We made a guess that the key ByteBuffers has been changed in the query pr= ocess due to call by reference, and we found this in the server's source co= de which looks like that the key has been changed unexpectedly in org.apach= e.cassandra.thrift.CassandraServer's getSlice method: > > columnFamilies.get(StorageService.getPartitioner().decorateKey(command.ke= y)); > > Looks like the key has been "decorated" for some purpose, and it's has be= en changed in the process due to the nature of ByteBuffer, and the decorate= d key has been used as the key in the result map. > > columnFamiliesMap.put(command.key, thriftifiedColumns); > > Are we misinterpreted the Java Doc API or is this is a bug? >