incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roger schildmeijer <schildmei...@gmail.com>
Subject Re: UUIDs must be exactly 16 bytes ?
Date Wed, 05 May 2010 09:46:59 GMT
"'CompareWith' tells Cassandra how to sort the *columns* for slicing
operations". It looks like your column name isn't using the correct type
(TimeUUIDType).

// Roger Schildmeijer

On Wed, May 5, 2010 at 11:34 AM, Shuge Lee <shuge.lee@gmail.com> wrote:

> Hi all:
>
> in storage-conf.xml
> ...
>
> <Keyspace Name="t">
>   <ColumnFamily CompareWith="UTF8Type" Name="tt" />
>
> <ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
>   <ReplicationFactor>1</ReplicationFactor>
>
> <EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
>
>   <ColumnFamily Name="tt"
>                 CompareWith="TimeUUIDType" />
> </Keyspace>
> ...
>
> Python code
> #!/usr/bin/env python
>
> import uuid
> from pprint import pprint as pp
>
> import pycassa
> from cassandra.ttypes import ConsistencyLevel
>
> keyspace = 't'
> column_family = 'tt'
> write_consistency_level = ConsistencyLevel.ONE
>
> cli = pycassa.connect()
> cf = pycassa.ColumnFamily(cli, keyspace, column_family)
>
> key = uuid.uuid4().bytes_le
> columns = {'subject': 'a'}
> cf.insert(key, columns, write_consistency_level)
>
> Traceback
>
>     Traceback (most recent call last):
>   File "/backup/code/luna/t.py", line 19, in <module>
>     cf.insert(key, columns, write_consistency_level)
>   File "/usr/lib/python2.6/site-packages/pycassa/columnfamily.py", line
> 338, in insert
>     self._wcl(write_consistency_level))
>   File "/usr/lib/python2.6/site-packages/pycassa/connection.py", line 135,
> in client_call
>     return getattr(self._client, attr)(*args, **kwargs)
>   File "/usr/lib/python2.6/site-packages/cassandra/Cassandra.py", line 781,
> in batch_mutate
>     self.recv_batch_mutate()
>   File "/usr/lib/python2.6/site-packages/cassandra/Cassandra.py", line 804,
> in recv_batch_mutate
>     raise result.ire
> cassandra.ttypes.InvalidRequestException:
> InvalidRequestException(why='UUIDs must be exactly 16 bytes')
>
>
> What's going on ?
>
>
> --
> Shuge Lee | Lee Li | 李蠡
>

Mime
View raw message