Re: Mixing LWT and normal operations for a partition

2019-05-02 Thread Shaurya Gupta
Hi,


*1. The below sequence of commands also does not appear to give an expected
output.*

Since, there is a delete command in the batch and then an LWT update using
IF EXISTS, in the final result row with id = 5 must get deleted.


cassandra@cqlsh> select * from demo.tweets;




 *id* | *body* | *latitude* | *longitude* | *time*
  | *user*

+--+--+---+-+---

  *5* | *old body* |  *32.6448* |  *78.21672* | *2019-01-14
18:30:00.00+* | *user5*


(1 rows)

cassandra@cqlsh>

cassandra@cqlsh> begin batch update demo.tweets SET body='new body' where
id = 5 IF EXISTS; delete from demo.tweets where id = 5 IF EXISTS; apply
batch;


 *[applied]*

---

  *True*


cassandra@cqlsh> select * from demo.tweets;


 *id* | *body* | *latitude* | *longitude* | *time* | *user*

+--+--+---+--+--

  *5* | *new body* | *null* |  *null* | *null* | *null*


(1 rows)

cassandra@cqlsh>



*2. On the contrary below sequence of commands gives the expected output:*


cassandra@cqlsh> insert into  demo.tweets (id, user, body, time, latitude,
longitude) values (5, 'user5', 'old body', '2019-01-15', 32.644800,
78.216721);
  cassandra@cqlsh>

cassandra@cqlsh> select * from demo.tweets;


 *id* | *body* | *latitude* | *longitude* | *time*
  | *user*

+--+--+---+-+---

  *5* | *old body* |  *32.6448* |  *78.21672* | *2019-01-14
18:30:00.00+* | *user5*


(1 rows)

cassandra@cqlsh> delete from demo.tweets where id = 5 IF EXISTS;


 *[applied]*

---

  *True*


cassandra@cqlsh> select * from demo.tweets;


 *id* | *body* | *latitude* | *longitude* | *time* | *user*

+--+--+---+--+--


(0 rows)

cassandra@cqlsh> update demo.tweets SET body='new body' where id = 5 IF
EXISTS;


 *[applied]*

---

 *False*


cassandra@cqlsh> select * from demo.tweets;


 *id* | *body* | *latitude* | *longitude* | *time* | *user*

+--+--+---+--+--


(0 rows)


Thanks

Shaurya




On Fri, May 3, 2019 at 1:02 AM Shaurya Gupta  wrote:

> One suggestion - I think Cassandra community is already having a drive to
> update the documentation. This could be added to CQLSH documentation or
> some other relevant documentation.
>
> On Fri, May 3, 2019 at 12:56 AM Shaurya Gupta 
> wrote:
>
>> Thanks Jeff.
>>
>> On Fri, May 3, 2019 at 12:38 AM Jeff Jirsa  wrote:
>>
>>> No. Don’t mix LWT and normal writes.
>>>
>>> --
>>> Jeff Jirsa
>>>
>>>
>>> > On May 2, 2019, at 11:43 AM, Shaurya Gupta 
>>> wrote:
>>> >
>>> > Hi,
>>> >
>>> > We are seeing really odd behaviour while try to delete a row which is
>>> simultaneously being updated in a light weight transaction.
>>> > The delete command succeeds and the LWT update fails with timeout
>>> exception but still the next select statement shows that the row still
>>> exists. This occurs ones in many such scenarios.
>>> >
>>> > Is it fine to mix LWT and normal operations for the same partition? Is
>>> it expected to work?
>>> >
>>> > Thanks
>>> > Shaurya
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org
>>> For additional commands, e-mail: user-h...@cassandra.apache.org
>>>
>>>
>>
>> --
>> Shaurya Gupta
>>
>>
>>
>
> --
> Shaurya Gupta
>
>
>

-- 
Shaurya Gupta


Re: Mixing LWT and normal operations for a partition

2019-05-02 Thread Shaurya Gupta
One suggestion - I think Cassandra community is already having a drive to
update the documentation. This could be added to CQLSH documentation or
some other relevant documentation.

On Fri, May 3, 2019 at 12:56 AM Shaurya Gupta 
wrote:

> Thanks Jeff.
>
> On Fri, May 3, 2019 at 12:38 AM Jeff Jirsa  wrote:
>
>> No. Don’t mix LWT and normal writes.
>>
>> --
>> Jeff Jirsa
>>
>>
>> > On May 2, 2019, at 11:43 AM, Shaurya Gupta 
>> wrote:
>> >
>> > Hi,
>> >
>> > We are seeing really odd behaviour while try to delete a row which is
>> simultaneously being updated in a light weight transaction.
>> > The delete command succeeds and the LWT update fails with timeout
>> exception but still the next select statement shows that the row still
>> exists. This occurs ones in many such scenarios.
>> >
>> > Is it fine to mix LWT and normal operations for the same partition? Is
>> it expected to work?
>> >
>> > Thanks
>> > Shaurya
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org
>> For additional commands, e-mail: user-h...@cassandra.apache.org
>>
>>
>
> --
> Shaurya Gupta
>
>
>

-- 
Shaurya Gupta


Re: Mixing LWT and normal operations for a partition

2019-05-02 Thread Shaurya Gupta
Thanks Jeff.

On Fri, May 3, 2019 at 12:38 AM Jeff Jirsa  wrote:

> No. Don’t mix LWT and normal writes.
>
> --
> Jeff Jirsa
>
>
> > On May 2, 2019, at 11:43 AM, Shaurya Gupta 
> wrote:
> >
> > Hi,
> >
> > We are seeing really odd behaviour while try to delete a row which is
> simultaneously being updated in a light weight transaction.
> > The delete command succeeds and the LWT update fails with timeout
> exception but still the next select statement shows that the row still
> exists. This occurs ones in many such scenarios.
> >
> > Is it fine to mix LWT and normal operations for the same partition? Is
> it expected to work?
> >
> > Thanks
> > Shaurya
>
> -
> To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org
> For additional commands, e-mail: user-h...@cassandra.apache.org
>
>

-- 
Shaurya Gupta


Re: Mixing LWT and normal operations for a partition

2019-05-02 Thread Jeff Jirsa
No. Don’t mix LWT and normal writes. 

-- 
Jeff Jirsa


> On May 2, 2019, at 11:43 AM, Shaurya Gupta  wrote:
> 
> Hi,
> 
> We are seeing really odd behaviour while try to delete a row which is 
> simultaneously being updated in a light weight transaction.
> The delete command succeeds and the LWT update fails with timeout exception 
> but still the next select statement shows that the row still exists. This 
> occurs ones in many such scenarios.
> 
> Is it fine to mix LWT and normal operations for the same partition? Is it 
> expected to work?
> 
> Thanks
> Shaurya

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



Mixing LWT and normal operations for a partition

2019-05-02 Thread Shaurya Gupta
Hi,

We are seeing really odd behaviour while try to delete a row which is
simultaneously being updated in a light weight transaction.
The delete command succeeds and the LWT update fails with timeout exception
but still the next select statement shows that the row still exists. This
occurs ones in many such scenarios.

Is it fine to mix LWT and normal operations for the same partition? Is it
expected to work?

Thanks
Shaurya