[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-22 Thread Benjamin Lerer (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14506640#comment-14506640
 ] 

Benjamin Lerer commented on CASSANDRA-9198:
---

[~jjirsa] No harm done :-)

+1
Thanks for the patch

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Jeff Jirsa
Priority: Minor
 Fix For: 2.1.5

 Attachments: 9198-v2-2.1.txt, 9198-v2-trunk.txt, 9198.txt


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-22 Thread Benjamin Lerer (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14506644#comment-14506644
 ] 

Benjamin Lerer commented on CASSANDRA-9198:
---

[~slebresne] could you commit?

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Jeff Jirsa
Priority: Minor
 Fix For: 2.1.5

 Attachments: 9198-v2-2.1.txt, 9198-v2-trunk.txt, 9198.txt


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-21 Thread Benjamin Lerer (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14504581#comment-14504581
 ] 

Benjamin Lerer commented on CASSANDRA-9198:
---

Could you also make sure that your patch apply to trunk? CASSANDRA-7304 had 
some impact in the same area.

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Jeff Jirsa
Priority: Minor
 Fix For: 2.1.5

 Attachments: 9198.txt


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-21 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14504616#comment-14504616
 ] 

Sylvain Lebresne commented on CASSANDRA-9198:
-

bq. Could you also make sure that your patch apply to trunk?

Just so we agree, we should push this to 2.1 (and for the record, if only a 
patch for 2.1 is provided, I'm fine dealing with merge conflict on trunk so you 
don't really have to bother providing patches for both 2.1 and trunk).

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Jeff Jirsa
Priority: Minor
 Fix For: 2.1.5

 Attachments: 9198.txt


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-21 Thread Benjamin Lerer (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14504573#comment-14504573
 ] 

Benjamin Lerer commented on CASSANDRA-9198:
---

My remarks on the patch:
* I still prefer the previous error messages. {{List index 0 out of bound, 
list has size 0}} will not makes a lot of sense if the user as never created 
any list. The fact that C* has no empty list can be confusing. In my opinion, 
we should be carefull about the error messages and not make people believe that 
you can have some empty list.
* It would be nice if you could add some similar unit tests for sets and maps.
* The standard in C* is to use ternarys operator when you have a a simple {{if 
return else return}} (even if I am not a fan of it). Nested ternary operators 
should be avoided.

Side remark: It makes full sense that you provide a patch for that issue as you 
already worked on CASSANDRA-9077. Just make sure, that if the ticket is 
assigned to somebody else, you checked with the person before that he is fine 
with you providing a patch (which I am ;-)). We never know the person might 
have started working on it or be really interested in fixing the ticket.


 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Jeff Jirsa
Priority: Minor
 Fix For: 2.1.5

 Attachments: 9198.txt


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-21 Thread Jeff Jirsa (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14505622#comment-14505622
 ] 

Jeff Jirsa commented on CASSANDRA-9198:
---

[~blerer] - sincere apologies, I originally meant to just link to the patch 
from 9077, then figured why not at least make tests pass for your 
convenience. Didn't mean to step on toes.

Attaching two diffs, one for trunk and a second for 2.1. 

I adjusted the set/delete logic to give the same messaging as in 9077, and 
cleaned up the ugly if/else return in favor of a ternary.  

{noformat}
cqlsh create keyspace IF NOT EXISTS test WITH replication = {'class': 
'SimpleStrategy', 'replication_factor': 1};
cqlsh USE test;
cqlsh:test create table foo (k int primary key, v listint);
cqlsh:test insert into foo(k,v) values (1, [1,2]);
cqlsh:test update foo set v = v - [1] where k = 1;
cqlsh:test update foo set v = v - [1] where k = 1;
cqlsh:test update foo set v = v - [2] where k = 1;
cqlsh:test update foo set v = v - [2] where k = 1;
cqlsh:test 
cqlsh:test update foo set v[0] = 2 where k=1;
InvalidRequest: code=2200 [Invalid query] message=Attempted to set an element 
on a list which is null
cqlsh:test delete v[0] from foo where k=1;
InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
element from a list which is null
{noformat}




 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Jeff Jirsa
Priority: Minor
 Fix For: 2.1.5

 Attachments: 9198-v2-2.1.txt, 9198-v2-trunk.txt, 9198.txt


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-20 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14503088#comment-14503088
 ] 

Sylvain Lebresne commented on CASSANDRA-9198:
-

bq. last time we discussed that subject, we agreed that as we complain on 
invalid index for lists, not complaining when trying to delete from an empty 
list was not really consistent. 

Yes, but I hadn't though of the idempotency issue at the time, and I do think 
we should make thing idempotent as much as possible, so +1 for not complaining 
in that case. And since this case was buggy until CASSANDRA_9077, I suggest we 
fix that before 2.1.5 is released.

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Benjamin Lerer
Priority: Minor
 Fix For: 3.0


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-19 Thread Brandon Williams (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14501858#comment-14501858
 ] 

Brandon Williams commented on CASSANDRA-9198:
-

I tend to agree in that we should support idempotent operations as much as 
possible, nobody is really going to care about knowing if the the list was null 
or not when deleting from it.

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Benjamin Lerer
Priority: Minor
 Fix For: 3.0


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-18 Thread Jeff Jirsa (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14501694#comment-14501694
 ] 

Jeff Jirsa commented on CASSANDRA-9198:
---

We brushed on this in CASSANDRA-9077 

The fact that the list can become null just by removing elements from it seems 
non-intuitive to me (not to say it's wrong, just that I don't think most 
developers would expect it) - it seems like it should become empty, not null. 

I would expect `DELETE FROM foo WHERE k=1` to result in a null list, but simply 
removing an element from a list should result in an empty list. 



 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Benjamin Lerer
Priority: Minor
 Fix For: 3.0


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-16 Thread Benjamin Lerer (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14497728#comment-14497728
 ] 

Benjamin Lerer commented on CASSANDRA-9198:
---

Cassandra does not differentiate between an empty list and a list which is 
null. In Java deleting from an empty list is fine not from a list which is null.

Making the delete operation a noop operation can be done but from my opinion it 
is a breaking change so if we do it we should do it in 3.0.  

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Benjamin Lerer
Priority: Minor
 Fix For: 3.0


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CASSANDRA-9198) Deleting from an empty list produces an error

2015-04-16 Thread Benjamin Lerer (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-9198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14498153#comment-14498153
 ] 

Benjamin Lerer commented on CASSANDRA-9198:
---

@Sylvain last time we discussed that subject, we agreed that as we complain on 
invalid index for lists, not complaining when trying to delete from an empty 
list was not really consistent. On the other hand, it is also true that we do 
not complain for the same operation on a {{map}} or a {{set}}. What is your 
opinion?

 Deleting from an empty list produces an error
 -

 Key: CASSANDRA-9198
 URL: https://issues.apache.org/jira/browse/CASSANDRA-9198
 Project: Cassandra
  Issue Type: Bug
  Components: API
Reporter: Olivier Michallat
Assignee: Benjamin Lerer
Priority: Minor
 Fix For: 3.0


 While deleting an element from a list that does not contain it is a no-op, 
 deleting it from an empty list causes an error.
 This edge case is a bit inconsistent, because it makes list deletion non 
 idempotent:
 {code}
 cqlsh:test create table foo (k int primary key, v listint);
 cqlsh:test insert into foo(k,v) values (1, [1,2]);
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [1] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 cqlsh:test update foo set v = v - [2] where k = 1;
 InvalidRequest: code=2200 [Invalid query] message=Attempted to delete an 
 element from a list which is null
 {code}
 With speculative retries coming to the drivers, idempotency becomes more 
 important because it determines which query we might retry or not. So it 
 would be better if deleting from an empty list succeeded.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)