You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Robert Wille <rw...@fold3.com> on 2013/11/26 09:13:06 UTC

WRITETIME() sometimes returns 0

I've got a Cassandra 2.0.2 server with a single node. I've written a test
harness that populates the database, looks at the write times for each
column, runs the test cases, and then checks to see what columns have been
updated. However, when I query WRITETIME() (prior to running the test
cases), over half the time it returns 0 (not null, but 0). It's pretty
consistent which columns return the real write time and which ones return 0.
I've even tried adding a 10 second delay between populating the database and
checking the write times, and it doesn't help. When its all done, if I call
writetime() on a column for cqlsh, I get a non-zero value.

Any thoughts? What has to happen before a write time is available?

Thanks in advance.

Robert



Re: WRITETIME() sometimes returns 0

Posted by Sylvain Lebresne <sy...@datastax.com>.
Nothing needs to happen for the writetime() to be valid. It's basically the
underlying timestamp so it's part of the insert itself.

Now, you don't give a whole lot of detail so it's hard to guess what could
be the problem. But since you mention that you get 0, not null, I'd suggest
to double check that part. For instance, if you use the java driver and use
Row.getLong(), it returns 0 if the column itself is null because it return
an int, not an Integer and you have to use Row.isNull() to know whether
it's really 0 or not.

--
Sylvain


On Tue, Nov 26, 2013 at 9:13 AM, Robert Wille <rw...@fold3.com> wrote:

> I've got a Cassandra 2.0.2 server with a single node. I've written a test
> harness that populates the database, looks at the write times for each
> column, runs the test cases, and then checks to see what columns have been
> updated. However, when I query WRITETIME() (prior to running the test
> cases), over half the time it returns 0 (not null, but 0). It's pretty
> consistent which columns return the real write time and which ones return
> 0. I've even tried adding a 10 second delay between populating the database
> and checking the write times, and it doesn't help. When its all done, if I
> call writetime() on a column for cqlsh, I get a non-zero value.
>
> Any thoughts? What has to happen before a write time is available?
>
> Thanks in advance.
>
> Robert
>