You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by 廖欽啟 <mi...@gmail.com> on 2014/08/16 13:45:44 UTC
insert two records with same primary key via batch
Hi,
I'm trying this cql against cassandra 2.0.9:
BEGIN BATCH
INSERT INTO cqlengine_test_lwt.test_if_not_exists_model (id, count,
text) VALUES (1, 8, '123');
INSERT INTO cqlengine_test_lwt.test_if_not_exists_model (id, count,
text) VALUES (1, 9, '111');
APPLY BATCH;
In this case, id is the primary key.
And when querying the record with id=1, the result I got is (id=1,
count=9, text='123'), while I expect
the result should be (id=1, count=9, text='111').
Did I miss anything or is this result expected?
B.R,
Mission.
Re: insert two records with same primary key via batch
Posted by 廖欽啟 <mi...@gmail.com>.
wow, that's really interesting. Thanks for saving my time.
On 16 August 2014 20:56, DuyHai Doan <do...@gmail.com> wrote:
> You're running into funny results due to the way CQL3 handles statements
> in batches. Read this:
> https://github.com/doanduyhai/Achilles/wiki/Batch-Mode#statements-ordering
>
> There is already a JIRA opened but according to the developers this is the
> expected behavior.
>
> In your example, largest value for column "count" is 9 and largest value
> for "text" is "123" (sorted by lexicographic order)
>
>
> On Sat, Aug 16, 2014 at 1:45 PM, 廖欽啟 <mi...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm trying this cql against cassandra 2.0.9:
>> BEGIN BATCH
>> INSERT INTO cqlengine_test_lwt.test_if_not_exists_model (id, count,
>> text) VALUES (1, 8, '123');
>> INSERT INTO cqlengine_test_lwt.test_if_not_exists_model (id, count,
>> text) VALUES (1, 9, '111');
>> APPLY BATCH;
>>
>> In this case, id is the primary key.
>> And when querying the record with id=1, the result I got is (id=1,
>> count=9, text='123'), while I expect
>> the result should be (id=1, count=9, text='111').
>>
>> Did I miss anything or is this result expected?
>>
>> B.R,
>> Mission.
>>
>
>
Re: insert two records with same primary key via batch
Posted by DuyHai Doan <do...@gmail.com>.
You're running into funny results due to the way CQL3 handles statements in
batches. Read this:
https://github.com/doanduyhai/Achilles/wiki/Batch-Mode#statements-ordering
There is already a JIRA opened but according to the developers this is the
expected behavior.
In your example, largest value for column "count" is 9 and largest value
for "text" is "123" (sorted by lexicographic order)
On Sat, Aug 16, 2014 at 1:45 PM, 廖欽啟 <mi...@gmail.com> wrote:
> Hi,
>
> I'm trying this cql against cassandra 2.0.9:
> BEGIN BATCH
> INSERT INTO cqlengine_test_lwt.test_if_not_exists_model (id, count,
> text) VALUES (1, 8, '123');
> INSERT INTO cqlengine_test_lwt.test_if_not_exists_model (id, count,
> text) VALUES (1, 9, '111');
> APPLY BATCH;
>
> In this case, id is the primary key.
> And when querying the record with id=1, the result I got is (id=1,
> count=9, text='123'), while I expect
> the result should be (id=1, count=9, text='111').
>
> Did I miss anything or is this result expected?
>
> B.R,
> Mission.
>