incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Schleck <drew.schl...@gmail.com>
Subject Re: problem running lazyboy example: save() is not working?
Date Tue, 20 Oct 2009 02:07:03 GMT
Hey,
  I think I've fixed these before, let me know how the attached patch works
for you. The first issue which caused the the second True is because it's
not undirtying itself correctly, and there's also a bug in
examples/record.py which makes it not run because the variable "key" doesn't
exist.

Drew

On Mon, Oct 19, 2009 at 04:48, Walter Gillett <walter_gillett@yahoo.com>wrote:

> I'm running the latest lazyboy against apache-cassandra-incubating-0.4.0,
> with python 2.6.2 on ubuntu 9.04. I have modified the cassandra file
> storage-conf.xml to add the Keyspace that lazyboy wants:
>
>     <Keyspace Name="UserData">
>       <ColumnFamily CompareWith="BytesType" Name="Users"/>
>     </Keyspace>
>
> and have cleaned out all the data under the /var/lib/cassandra directories
> to ensure that cassandra gets a clean start. On running the lazyboy example
> like so: "python record.py" I get the output shown below, with an error
> about "Bad key passed to load()". (I've modified the example slightly to
> make the print statements more informative but the executable code is
> unchanged.)
>
> On reading the code, looks like things go off the tracks earlier than that.
> The example code first prints u.is_modified(), which is True because u
> contains an unsaved User object. Then comes u.save() to save the User to
> cassandra. Then print u.is_modified()again to show that now the value is
> False. Except that the value I get is actually True! Thinking that explains
> the downstream error in trying to load the object, it didn't get saved
> properly so it can't be loaded.
>
> Any ideas what's going on? I tried the obvious trick of putting in sleep(5)
> in case there is a race condition but that didn't work. Is lazyboy
> compatible with this version of cassandra? The lazyboy example comes with
> Cassandra-0.4.0-py2.6.egg suggesting that the version is compatible, but
> clearly something is wrong. I have also included the cassandra console
> output below in case that's useful.
>
> Walter Gillett
>
> Running the example (with modified print statements):
>
> $ python record.py
> u.key:
> {'column_family': 'Users', 'keyspace': 'UserData', 'super_column': None,
> 'key': 'd86e9901ba6845ba84d3d93b7ff4a7b8'}
>
> User(data):
> User: {'username': 'ieure', 'email': 'ian@digg.com'}
>
> u.is_modified()
> True
>
> u.is_modified()
> True
>
> Traceback (most recent call last):
>   File "record.py", line 80, in <module>
>     u_ = User().load(key)
>   File "/usr/lib/python2.6/site-packages/lazyboy/record.py", line 128, in
> load
>     assert isinstance(key, Key), "Bad key passed to load()"
> AssertionError: Bad key passed to load()
>
> Cassandra console output:
>
> $ $CASSANDRA/bin/cassandra -f
> Listening for transport dt_socket at address: 8888
> DEBUG - Loading settings from /opt/cassandra/bin/../conf/storage-conf.xml
> DEBUG - Syncing log with a period of 1000
> DEBUG - opening keyspace Keyspace1
> DEBUG - adding Super1 as 0
> DEBUG - adding Standard2 as 1
> DEBUG - adding Standard1 as 2
> DEBUG - adding StandardByUUID1 as 3
> DEBUG - adding LocationInfo as 4
> DEBUG - adding HintsColumnFamily as 5
> DEBUG - adding Users as 6
> DEBUG - opening keyspace system
> DEBUG - opening keyspace UserData
> INFO - Saved Token not found. Using 90758413375805622705049558609953482402
> DEBUG - Starting to listen on 127.0.0.1:7001
> DEBUG - Binding thrift service to localhost:9160
> INFO - Cassandra starting up...
> DEBUG - batch_insert
> DEBUG - insertBlocking writing key f9df5e4875b54281ab57d36efed723b0 to 12@
> [127.0.0.1:7000]
> DEBUG - Applying RowMutation(table='UserData',
> key='f9df5e4875b54281ab57d36efed723b0', modifications=[ColumnFamily(Users
> [[101, 109, 97, 105, 108],[117, 115, 101, 114, 110, 97, 109, 101],])])
> DEBUG - RowMutation(table='UserData',
> key='f9df5e4875b54281ab57d36efed723b0', modifications=[ColumnFamily(Users
> [[101, 109, 97, 105, 108],[117, 115, 101, 114, 110, 97, 109, 101],])])
> applied.  Sending response to 12@127.0.0.1:7000
> DEBUG - Processing response on a callback from 12@127.0.0.1:7000
>

Mime
View raw message