You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by dn...@taz.qinetiq.com on 2011/06/29 16:13:42 UTC

Cannot set column value to zero

I had a strange problem recently where I was unable to set the value of a column
to '0' (it always returned '1') but setting it to other values worked fine:

[default@Test] set Urls['rowkey']['status']='1';
Value inserted.
[default@Test] get Urls['rowkey'];
=> (column=status, value=1, timestamp=1309189541891000)
Returned 1 results.

[default@Test] set Urls['rowkey']['status']='0';
Value inserted.
[default@Test] get Urls['rowkey'];
=> (column=status, value=1, timestamp=1309189551407616)
Returned 1 results.

This was on a one-node test cluster (v0.7.6) with no other clients; setting
other values (e.g. '9') worked fine. However, attempting to set the value back
to '0' always resulted in a value of '1'.

I noticed this shortly after truncating the CF.

The column family was shown as follows below. One thing that looks odd is that
on other test clusters the Column Name is followed by a reference to
the index, e.g. "Column Name: status (737461747573)" - but here it isn't.

I was wondering if there was some interaction between truncating the CF and the
use of a KEYS index? (Presumably it would be safer to delete all data
directories in order to wipe the cluster during experimentation, rather than
truncating?)

Unfortunately I'm not sure how to recreate the situation as this was a test
machine on which I played around with various configurations - but maybe
someone has seen a similar problem elsewhere? In the end I had to wipe the data
and start again, and all seemed fine, although the index reference is still
absent as mentioned above.

[default@Test] describe keyspace;
Keyspace: Test:
...
    ColumnFamily: Foo
      default_validation_class: org.apache.cassandra.db.marshal.BytesType
      Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
      Row cache size / save period in seconds: 0.0/0
      Key cache size / save period in seconds: 0.0/14400
      Memtable thresholds: 0.5/128/60 (millions of ops/minutes/MB)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 1.0
      Built indexes: [Foo.737461747573]
      Column Metadata:
        Column Name: status
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
          Index Type: KEYS
...

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to anyone.
Please contact the sender if you believe you have received this email in
error. QinetiQ may monitor email traffic data and also the content of
email for the purposes of security. QinetiQ Limited (Registered in
England & Wales: Company Number: 3796233) Registered office: Cody Technology 
Park, Ively Road, Farnborough, Hampshire, GU14 0LX http://www.qinetiq.com.

Re: Cannot set column value to zero

Posted by aaron morton <aa...@thelastpickle.com>.
The extra () in the describe keyspace output is only there if the column comparator is the BytesType, the client tries to format the data as UTF8. 

Dont forget truncate is doing snapshots, so check the snapshots dir and delete things if you are using it a lot for testing. 

The 0 == 1 thing does not ring any bells. Let us know if it happens again. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com

On 30 Jun 2011, at 02:13, dnallsopp@taz.qinetiq.com wrote:

> I had a strange problem recently where I was unable to set the value of a column
> to '0' (it always returned '1') but setting it to other values worked fine:
> 
> [default@Test] set Urls['rowkey']['status']='1';
> Value inserted.
> [default@Test] get Urls['rowkey'];
> => (column=status, value=1, timestamp=1309189541891000)
> Returned 1 results.
> 
> [default@Test] set Urls['rowkey']['status']='0';
> Value inserted.
> [default@Test] get Urls['rowkey'];
> => (column=status, value=1, timestamp=1309189551407616)
> Returned 1 results.
> 
> This was on a one-node test cluster (v0.7.6) with no other clients; setting
> other values (e.g. '9') worked fine. However, attempting to set the value back
> to '0' always resulted in a value of '1'.
> 
> I noticed this shortly after truncating the CF.
> 
> The column family was shown as follows below. One thing that looks odd is that
> on other test clusters the Column Name is followed by a reference to
> the index, e.g. "Column Name: status (737461747573)" - but here it isn't.
> 
> I was wondering if there was some interaction between truncating the CF and the
> use of a KEYS index? (Presumably it would be safer to delete all data
> directories in order to wipe the cluster during experimentation, rather than
> truncating?)
> 
> Unfortunately I'm not sure how to recreate the situation as this was a test
> machine on which I played around with various configurations - but maybe
> someone has seen a similar problem elsewhere? In the end I had to wipe the data
> and start again, and all seemed fine, although the index reference is still
> absent as mentioned above.
> 
> [default@Test] describe keyspace;
> Keyspace: Test:
> ...
>    ColumnFamily: Foo
>      default_validation_class: org.apache.cassandra.db.marshal.BytesType
>      Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
>      Row cache size / save period in seconds: 0.0/0
>      Key cache size / save period in seconds: 0.0/14400
>      Memtable thresholds: 0.5/128/60 (millions of ops/minutes/MB)
>      GC grace seconds: 864000
>      Compaction min/max thresholds: 4/32
>      Read repair chance: 1.0
>      Built indexes: [Foo.737461747573]
>      Column Metadata:
>        Column Name: status
>          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>          Index Type: KEYS
> ...
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> This email and any attachments to it may be confidential and are
> intended solely for the use of the individual to whom it is addressed.
> If you are not the intended recipient of this email, you must neither
> take any action based upon its contents, nor copy or show it to anyone.
> Please contact the sender if you believe you have received this email in
> error. QinetiQ may monitor email traffic data and also the content of
> email for the purposes of security. QinetiQ Limited (Registered in
> England & Wales: Company Number: 3796233) Registered office: Cody Technology 
> Park, Ively Road, Farnborough, Hampshire, GU14 0LX http://www.qinetiq.com.