Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32763D3F5 for ; Fri, 6 Jul 2012 18:48:51 +0000 (UTC) Received: (qmail 9759 invoked by uid 500); 6 Jul 2012 18:48:48 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 9742 invoked by uid 500); 6 Jul 2012 18:48:48 -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 9734 invoked by uid 99); 6 Jul 2012 18:48:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 18:48:48 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a49.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 18:48:41 +0000 Received: from homiemail-a49.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a49.g.dreamhost.com (Postfix) with ESMTP id 287925E005C for ; Fri, 6 Jul 2012 11:48:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=thelastpickle.com; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; q=dns; s=thelastpickle.com; b=gdhcNMrhLQ 3jTw5hPcY8AZUS8NAf6YzpmUWzP8z49HTvQOTZlzTXg/ZClOwOtHkSZJ/lHk92eJ js2MWtUxJevhPFJ0U+aW/dEKpF92lhNI92w3CxRNDrNpiDjv1ReK3AR4b8q1+PVW b8EpK5yBHPJHreiQlZg5gPg+LZOZhLygo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; s=thelastpickle.com; bh=fC4CPYuKpFha7Kn2 00FTDxABlRE=; b=tk5/GQNCbEVUWG1JUc8+miC0dbik4qIQMV3B/dnf7uXKiDB0 Q//YQmkp/jKndqs8CZ4DmFh5u4GEjm83ZGVuWY9GD1Ui0GsNNnD6LNtmDpyxgFJR nmDs4H5UHv7DqUq2Dv/9FggW8dBHXMRexTsIO6HZGvDh5V4LEvYv3uPmI6E= Received: from [172.16.1.4] (unknown [203.86.207.101]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a49.g.dreamhost.com (Postfix) with ESMTPSA id 2D63E5E0057 for ; Fri, 6 Jul 2012 11:48:17 -0700 (PDT) From: aaron morton Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/alternative; boundary="Apple-Mail=_6DCA7330-CDC8-4188-B356-0625C6C8E260" Subject: Re: Composite key in thrift java api - still need help!! Date: Sat, 7 Jul 2012 06:48:15 +1200 In-Reply-To: To: user@cassandra.apache.org References: <41A0E175-CC7F-49CE-8D1C-5B6624777D19@thelastpickle.com> Message-Id: <68406753-8A12-4F7F-875D-1CB767F1C8CA@thelastpickle.com> X-Mailer: Apple Mail (2.1278) --Apple-Mail=_6DCA7330-CDC8-4188-B356-0625C6C8E260 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 AFAIK in all cases we consider values to be just bytes. They are passed = to the ADT to turn into type aware instances.=20 Can you try doing what you want to do with Hector or Astyanax? Then take = a look at how they work if you still want to roll your own.=20 Cheers ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com On 7/07/2012, at 3:48 AM, Leonid Ilyevsky wrote: > I tried it, does not work for my batch_mutate (I tried both = CompositeType.Builder and also my own implementation following the code = examples). > So it seems that the format with short length before the field and = zero byte after does not work for the key. > I found by experiment and debugger that in case of a simple key, the = key buffer in the mutation_map passed to the batch_mutate contains = simple key bits, without length or terminating zero. > The same thing (simple concatenation) does not work for composite key = case. Short length with terminating zero does not work either. > So the question is: what is the required format of the key buffer? > =20 > From: Leonid Ilyevsky [mailto:lilyevsky@mooncapital.com]=20 > Sent: Friday, July 06, 2012 10:05 AM > To: 'user@cassandra.apache.org' > Subject: RE: Composite key in thrift java api > =20 > Thanks Aaron, > =20 > I guess, you suggest I just borrow the logic from that = CompositeType.java, the =93decompose=94 method, to comply with the = protocol. > I thought I can just call it, but I don=92t see the = =93decompose(Object... objects)=94 in the current 1.1.2 version, so = probably your snippet is from the older version. > =20 > On the other hand, in the new version I see CompositeType.Builder = inner class, looks like I should use that. > Could you please confirm? > =20 > Thanks, > =20 > Leonid > =20 > =20 > From: aaron morton [mailto:aaron@thelastpickle.com]=20 > Sent: Thursday, July 05, 2012 7:10 PM > To: user@cassandra.apache.org > Subject: Re: Composite key in thrift java api > =20 > I would really prefer to do it in Cassandra itself, > See = https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassand= ra/db/marshal/CompositeType.java > =20 > Cheers > =20 > =20 > ----------------- > Aaron Morton > Freelance Developer > @aaronmorton > http://www.thelastpickle.com > =20 > On 6/07/2012, at 10:40 AM, Leonid Ilyevsky wrote: > =20 >=20 > I need to create a ByteBuffer instance containing the proper composite = key, based on the values of the components of the key. I am going to use = it for update operation. > I tried to simply concatenate the buffers corresponding to the = components, but I am not sure this is correct, because I am getting = exception that comes from the server : > =20 > InvalidRequestException(why:Not enough bytes to read value of = component 0) > =20 > In the server log I see this: > =20 > org.apache.thrift.transport.TTransportException: Cannot read. Remote = side has closed. Tried to read 4 bytes, but only got 0 bytes. (This is = often indicative of an internal error on the server side. Please check = your server logs.) > =20 > (I believe here when it says =93server side=94 it actually means = client, because it is the server=92s log). > =20 > Seems like the buffer that my client sends is too short. I suspect = there is a way in thrift to do it properly, but I don=92t know how. > Looks like Hector has a Composite class that maybe can help, but at = this point I would really prefer to do it in Cassandra itself, without = Hector. > =20 > Thanks! > =20 > Leonid > =20 > =20 > This email, along with any attachments, is confidential and may be = legally privileged or otherwise protected from disclosure. Any = unauthorized dissemination, copying or use of the contents of this email = is strictly prohibited and may be in violation of law. If you are not = the intended recipient, any disclosure, copying, forwarding or = distribution of this email is strictly prohibited and this email and any = attachments should be deleted immediately. This email and any = attachments do not constitute an offer to sell or a solicitation of an = offer to purchase any interest in any investment vehicle sponsored by = Moon Capital Management LP (=93Moon Capital=94). Moon Capital does not = provide legal, accounting or tax advice. Any statement regarding legal, = accounting or tax matters was not intended or written to be relied upon = by any person as advice. Moon Capital does not waive confidentiality or = privilege as a result of this email. > =20 > =20 > This email, along with any attachments, is confidential and may be = legally privileged or otherwise protected from disclosure. Any = unauthorized dissemination, copying or use of the contents of this email = is strictly prohibited and may be in violation of law. If you are not = the intended recipient, any disclosure, copying, forwarding or = distribution of this email is strictly prohibited and this email and any = attachments should be deleted immediately. This email and any = attachments do not constitute an offer to sell or a solicitation of an = offer to purchase any interest in any investment vehicle sponsored by = Moon Capital Management LP (=93Moon Capital=94). Moon Capital does not = provide legal, accounting or tax advice. Any statement regarding legal, = accounting or tax matters was not intended or written to be relied upon = by any person as advice. Moon Capital does not waive confidentiality or = privilege as a result of this email. >=20 > This email, along with any attachments, is confidential and may be = legally privileged or otherwise protected from disclosure. Any = unauthorized dissemination, copying or use of the contents of this email = is strictly prohibited and may be in violation of law. If you are not = the intended recipient, any disclosure, copying, forwarding or = distribution of this email is strictly prohibited and this email and any = attachments should be deleted immediately. This email and any = attachments do not constitute an offer to sell or a solicitation of an = offer to purchase any interest in any investment vehicle sponsored by = Moon Capital Management LP (=93Moon Capital=94). Moon Capital does not = provide legal, accounting or tax advice. Any statement regarding legal, = accounting or tax matters was not intended or written to be relied upon = by any person as advice. Moon Capital does not waive confidentiality or = privilege as a result of this email. --Apple-Mail=_6DCA7330-CDC8-4188-B356-0625C6C8E260 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 AFAIK in all cases we consider values to be just = bytes. They are passed to the ADT to turn into type aware = instances. 

Can you try doing what you want to = do with Hector or Astyanax? Then take a look at how they work if = you still want to roll your = own. 

Cheers

http://www.thelastpickle.com

On 7/07/2012, at 3:48 AM, Leonid Ilyevsky wrote:

I tried it, does not work for my = batch_mutate (I tried both CompositeType.Builder and also my own implementation = following the code examples).
So it seems that the format with = short length before the field and zero byte after does not work for the = key.
I found by = experiment and debugger that in case of a simple key, the key buffer in = the  mutation_map passed to the batch_mutate contains simple key = bits, without length or terminating zero.
The same thing (simple = concatenation) does not work for composite key case. Short length with = terminating zero does not work either.
So the question is: what is the = required format of the key buffer?
From: Leonid Ilyevsky = [mailto:lilyevsky@mooncapital.com] 
Sent: Friday, July 06, 2012 10:05 = AM
To: 'user@cassandra.apache.org'Subject: RE: = Composite key in thrift java api
 
I = guess, you suggest I just borrow the logic from that CompositeType.java, = the =93decompose=94 method, to comply with the = protocol.
I thought I =
can just call it, but I don=92t see the =93 
On =
the other hand, in the new version I see CompositeType.Builder inner class, looks like I should use =
that.
Could you =
please confirm?
From: aaron morton = [mailto:aaron@thelastpickle.com] 
Sent: Thursday, July 05, 2012 = 7:10 PM
To: user@cassandra.apache.orgSubject: Re: = Composite key in thrift java api
 
 I would really prefer to do = it in Cassandra = itself,
See  

This email, along = with any attachments, is confidential and may be legally privileged or = otherwise protected from disclosure. Any unauthorized dissemination, = copying or use of the contents of this email is strictly prohibited and = may be in violation of law. If you are not the intended recipient, any = disclosure, copying, forwarding or distribution of this email is = strictly prohibited and this email and any attachments should be deleted = immediately. This email and any attachments do not constitute an offer = to sell or a solicitation of an offer to purchase any interest in any = investment vehicle sponsored by Moon Capital Management LP (=93Moon = Capital=94). Moon Capital does not provide legal, accounting or tax = advice. Any statement regarding legal, accounting or tax matters was not = intended or written to be relied upon by any person as advice. Moon = Capital does not waive confidentiality or privilege as a result of this = email.

This email, along with = any attachments, is confidential and may be legally privileged or = otherwise protected from disclosure. Any unauthorized dissemination, = copying or use of the contents of this email is strictly prohibited and = may be in violation of law. If you are not the intended recipient, any = disclosure, copying, forwarding or distribution of this email is = strictly prohibited and this email and any attachments should be deleted = immediately. This email and any attachments do not constitute an offer = to sell or a solicitation of an offer to purchase any interest in any = investment vehicle sponsored by Moon Capital Management LP (=93Moon = Capital=94). Moon Capital does not provide legal, accounting or tax = advice. Any statement regarding legal, accounting or tax matters was not = intended or written to be relied upon by any person as advice. Moon = Capital does not waive confidentiality or privilege as a result of this = email.


This email, along with any attachments, is = confidential and may be legally privileged or otherwise protected from = disclosure. Any unauthorized dissemination, copying or use of the = contents of this email is strictly prohibited and may be in violation of = law. If you are not the intended recipient, any disclosure, copying, = forwarding or distribution of this email is strictly prohibited and this = email and any attachments should be deleted immediately. This email and = any attachments do not constitute an offer to sell or a solicitation of = an offer to purchase any interest in any investment vehicle sponsored by = Moon Capital Management LP (=93Moon Capital=94). Moon Capital does not = provide legal, accounting or tax advice. Any statement regarding legal, = accounting or tax matters was not intended or written to be relied upon = by any person as advice. Moon Capital does not waive confidentiality or = privilege as a result of this = email.
= --Apple-Mail=_6DCA7330-CDC8-4188-B356-0625C6C8E260--