You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Deepak Panda <de...@gmail.com> on 2017/09/13 17:59:42 UTC

BATCH OPERATION issue

Hi All,

Am in the process of learning batch operations. Here is what I tried.

Executed a CQL query against the student table(student_id is the primary key).


select student_id,position,WRITETIME(class_id),WRITETIME(position)
FROM student WHERE student_id='s123';

student_id position writetime(class_id) writetime(position)
s123          1         1505293712083000 1505293712083000


Then tried to update the "position" column using the following BATCH operation.

BEGIN BATCH USING TIMESTAMP 1505291962469002
 UPDATE
student
SET
POSITION = 3
WHERE
student_id = 's123';
APPLY BATCH;

In this case the update does not take effect.

But when I remove "USING TIMESTAMP" clause it works as expected.

What could be the reason? I am using Casandra 3.11.

Regards,
AL

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org


Re: BATCH OPERATION issue

Posted by Eric Stevens <mi...@gmail.com>.
The original timestamp is bigger than the timestamp you're using in your
batch.  Cassandra uses timestamps for conflict resolution, so the batch
write will lose.

On Wed, Sep 13, 2017 at 11:59 AM Deepak Panda <de...@gmail.com>
wrote:

> Hi All,
>
> Am in the process of learning batch operations. Here is what I tried.
>
> Executed a CQL query against the student table(student_id is the primary
> key).
>
>
> select student_id,position,WRITETIME(class_id),WRITETIME(position)
> FROM student WHERE student_id='s123';
>
> student_id position writetime(class_id) writetime(position)
> s123          1         1505293712083000 1505293712083000
>
>
> Then tried to update the "position" column using the following BATCH
> operation.
>
> BEGIN BATCH USING TIMESTAMP 1505291962469002
>  UPDATE
> student
> SET
> POSITION = 3
> WHERE
> student_id = 's123';
> APPLY BATCH;
>
> In this case the update does not take effect.
>
> But when I remove "USING TIMESTAMP" clause it works as expected.
>
> What could be the reason? I am using Casandra 3.11.
>
> Regards,
> AL
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
> For additional commands, e-mail: user-help@cassandra.apache.org
>
>