cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Trying to insert a TimeUUID via Java/Thrift -- "UUIDs must be exactly 16 bytes"
Date Fri, 27 Aug 2010 12:35:38 GMT
I recommend starting with
http://www.rackspacecloud.com/blog/2010/05/12/cassandra-by-example/,
then reading the other Recommended articles at
http://wiki.apache.org/cassandra/ArticlesAndPresentations

On Fri, Aug 27, 2010 at 3:07 AM, Sean Bowman <pico303@gmail.com> wrote:
> Do I not want to get the key to be the UUID, so I can slice based on timestamp?  If
so, the only thing the insert statement takes is a String for a key.  Why would I place the
UUID into a column value?  Doesn't it belong as the key if I want to be able to slice and
sort on it?
>
> I guess I'm just completely confused about how Cassandra works.  All I'm trying to do
is record a history of what' going on in my app, and be able to pull it out in the order that
it happens, similar to the comments example in the WTF? article.  Am I going about this the
wrong way?
>
> On Aug 27, 2010, at 1:51 AM, Benjamin Black wrote:
>
>> You are using the wrong part of the example.  That code sample just
>> produces the string representation.  Scroll down in that FAQ entry to
>> the sample labeled:
>>
>> "When you want to actually place the UUID into the Column then you'll
>> want to convert it like this. This method is often used in conjuntion
>> with the getTimeUUID() mentioned above."
>>
>>
>> b
>>
>> On Fri, Aug 27, 2010 at 12:28 AM, Sean Bowman <pico303@gmail.com> wrote:
>>> I'm at my wits end with Cassandra; is 0.6.4 just broken?  I've created a very
simple keyspace:
>>>
>>> <Keyspace Name="MyApp">
>>>  <ColumnFamily Name="History" CompareWith="TimeUUIDType"/>
>>>
>>> Using the Thrift sample code for 0.6 on the wiki, and the FAQ about TimeUUID's
and Java, I tried to generate a GUID using this method:
>>>
>>>        String key = new com.eaio.uuid.UUID().toString()
>>>
>>> Since all the Thrift get and insert statements use Strings for the keys.  But
when I send one of these GUID's, I get:
>>>
>>>        Exception in thread "main" InvalidRequestException(why:UUIDs must
be exactly 16 bytes)
>>>                at org.apache.cassandra.thrift.Cassandra$insert_result.read(Cassandra.java:12295)
>>>                at org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:675)
>>>                at org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:648)
>>>
>>> I even tried something like:
>>>
>>>        client.insert(keyspace, new String(asByteArray(getTimeUUID()), path,
"Some value".getBytes("UTF-8"), timestamp, ConsistencyLevel.ONE);
>>>
>>> Can anyone point me in the direction of how I send a time-based UUID to Cassandra
0.6.4 through the Java Thrift client?  Or am I missing the point of all of this somehow?
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Mime
View raw message