Re: CAS operation does not return value on failure

2016-05-09 Thread horschi
Update: It was actually the driver update (from 2.1.9 to 3.0.1) that solved
the issue. I reverted by C* Server back to 2.2 and my test is still ok.

On Mon, May 9, 2016 at 1:28 PM, horschi  wrote:

> I just retried with Cassandra 3.0.5 and it performs much better. Not a
> single of these illegal results.
>
> I guess my recommendation for anyone using CAS is: Upgrade to >= 3.x :-)
>
> On Wed, May 4, 2016 at 5:46 PM, horschi  wrote:
>
>> Hi,
>>
>> I am doing some testing on CAS operations and I am frequently having the
>> issue that my resultset says wasApplied()==false, but it does not contain
>> any value.
>>
>>
>> This behaviour of course leads to the following Exception when I try to
>> read it:
>>
>> Caused by: java.lang.IllegalArgumentException: value is not a column
>> defined in this metadata
>> at
>> com.datastax.driver.core.ColumnDefinitions.getAllIdx(ColumnDefinitions.java:273)
>> at
>> com.datastax.driver.core.ColumnDefinitions.getFirstIdx(ColumnDefinitions.java:279)
>> at
>> com.datastax.driver.core.ArrayBackedRow.getIndexOf(ArrayBackedRow.java:68)
>> at
>> com.datastax.driver.core.AbstractGettableData.getBytes(AbstractGettableData.java:131)
>>
>>
>>
>> My questions now are:
>>
>> Is it to be expected that a failing CAS operation sometimes does this?
>>
>> if yes: Shouldn't there a possibility on the driver side to handle this
>> in a better was, e.g. add a "hasColumn()" method or something to the
>> ResultSet?
>>
>> if no: Is that perhaps a symptom to a greater issue in cassandra?
>>
>>
>> kind regards,
>> Christian
>>
>> PS: I also appreciate general feedback on the entire C* CAS topic :-)
>>
>>
>>
>


Re: CAS operation does not return value on failure

2016-05-09 Thread horschi
I just retried with Cassandra 3.0.5 and it performs much better. Not a
single of these illegal results.

I guess my recommendation for anyone using CAS is: Upgrade to >= 3.x :-)

On Wed, May 4, 2016 at 5:46 PM, horschi  wrote:

> Hi,
>
> I am doing some testing on CAS operations and I am frequently having the
> issue that my resultset says wasApplied()==false, but it does not contain
> any value.
>
>
> This behaviour of course leads to the following Exception when I try to
> read it:
>
> Caused by: java.lang.IllegalArgumentException: value is not a column
> defined in this metadata
> at
> com.datastax.driver.core.ColumnDefinitions.getAllIdx(ColumnDefinitions.java:273)
> at
> com.datastax.driver.core.ColumnDefinitions.getFirstIdx(ColumnDefinitions.java:279)
> at
> com.datastax.driver.core.ArrayBackedRow.getIndexOf(ArrayBackedRow.java:68)
> at
> com.datastax.driver.core.AbstractGettableData.getBytes(AbstractGettableData.java:131)
>
>
>
> My questions now are:
>
> Is it to be expected that a failing CAS operation sometimes does this?
>
> if yes: Shouldn't there a possibility on the driver side to handle this in
> a better was, e.g. add a "hasColumn()" method or something to the ResultSet?
>
> if no: Is that perhaps a symptom to a greater issue in cassandra?
>
>
> kind regards,
> Christian
>
> PS: I also appreciate general feedback on the entire C* CAS topic :-)
>
>
>


Re: CAS operation does not return value on failure

2016-05-09 Thread horschi
Hi Jack,

sorry to keep you busy :-)

There definitely is a column named "value" in the table. And most of the
time this codepath works fine, even when my CAS update fails. But in very
rare cases I get a ResultSet that contains applied=false but does not
contain any value column.


I just ran my test again and found a empty ResultSet for the following
query:

delete from "Lock" where lockname=:lockname and id=:id if value=:value

--> ResultSet contains only [applied]=false, but no lockname, id or value.


Am I correct in my assumption that this should not be?

kind regards,
Christian



On Fri, May 6, 2016 at 1:20 AM, Jack Krupansky 
wrote:

> "value" in that message is the name of a column that is expect to be in
> your table schema - the message is simply complaining that you have no
> column named "value" in that table.
> The error concerns the table schema, not any actual data in either the
> statement or the table.
>
> "metadata" is simply referring to your table schema.
>
> Does your table schema have a "value" column?
> Does your preared statement refer to a "value" column, or are you
> supplying that name when executing the prepared statement?
>
> The "datastax.driver.core" in the exception trace class names indicates
> that the error is detected in the Java driver, not Cassandra.
>
>
>
> -- Jack Krupansky
>
> On Thu, May 5, 2016 at 6:45 PM, horschi  wrote:
>
>> Hi Jack,
>>
>> I thought that it is Cassandra that fills the value on CAS failures. So
>> the question if it is to be expected to have wasApplied()==false and not
>> have any value in the ResultSet should belong here.
>>
>> So my question for this mailing list would be:
>>
>> Is it correct behaviour that C* returns wasApplied()==false but not any
>> value? My expectation was that there always is a value in such a case.
>>
>> kind regards,
>> Christian
>>
>>
>> On Wed, May 4, 2016 at 6:00 PM, Jack Krupansky 
>> wrote:
>>
>>> Probably better to ask this on the Java driver user list.
>>>
>>>
>>> -- Jack Krupansky
>>>
>>> On Wed, May 4, 2016 at 11:46 AM, horschi  wrote:
>>>
 Hi,

 I am doing some testing on CAS operations and I am frequently having
 the issue that my resultset says wasApplied()==false, but it does not
 contain any value.


 This behaviour of course leads to the following Exception when I try to
 read it:

 Caused by: java.lang.IllegalArgumentException: value is not a column
 defined in this metadata
 at
 com.datastax.driver.core.ColumnDefinitions.getAllIdx(ColumnDefinitions.java:273)
 at
 com.datastax.driver.core.ColumnDefinitions.getFirstIdx(ColumnDefinitions.java:279)
 at
 com.datastax.driver.core.ArrayBackedRow.getIndexOf(ArrayBackedRow.java:68)
 at
 com.datastax.driver.core.AbstractGettableData.getBytes(AbstractGettableData.java:131)



 My questions now are:

 Is it to be expected that a failing CAS operation sometimes does this?

 if yes: Shouldn't there a possibility on the driver side to handle this
 in a better was, e.g. add a "hasColumn()" method or something to the
 ResultSet?

 if no: Is that perhaps a symptom to a greater issue in cassandra?


 kind regards,
 Christian

 PS: I also appreciate general feedback on the entire C* CAS topic :-)



>>>
>>
>


Re: CAS operation does not return value on failure

2016-05-05 Thread horschi
Hi Jack,

I thought that it is Cassandra that fills the value on CAS failures. So the
question if it is to be expected to have wasApplied()==false and not have
any value in the ResultSet should belong here.

So my question for this mailing list would be:

Is it correct behaviour that C* returns wasApplied()==false but not any
value? My expectation was that there always is a value in such a case.

kind regards,
Christian


On Wed, May 4, 2016 at 6:00 PM, Jack Krupansky 
wrote:

> Probably better to ask this on the Java driver user list.
>
>
> -- Jack Krupansky
>
> On Wed, May 4, 2016 at 11:46 AM, horschi  wrote:
>
>> Hi,
>>
>> I am doing some testing on CAS operations and I am frequently having the
>> issue that my resultset says wasApplied()==false, but it does not contain
>> any value.
>>
>>
>> This behaviour of course leads to the following Exception when I try to
>> read it:
>>
>> Caused by: java.lang.IllegalArgumentException: value is not a column
>> defined in this metadata
>> at
>> com.datastax.driver.core.ColumnDefinitions.getAllIdx(ColumnDefinitions.java:273)
>> at
>> com.datastax.driver.core.ColumnDefinitions.getFirstIdx(ColumnDefinitions.java:279)
>> at
>> com.datastax.driver.core.ArrayBackedRow.getIndexOf(ArrayBackedRow.java:68)
>> at
>> com.datastax.driver.core.AbstractGettableData.getBytes(AbstractGettableData.java:131)
>>
>>
>>
>> My questions now are:
>>
>> Is it to be expected that a failing CAS operation sometimes does this?
>>
>> if yes: Shouldn't there a possibility on the driver side to handle this
>> in a better was, e.g. add a "hasColumn()" method or something to the
>> ResultSet?
>>
>> if no: Is that perhaps a symptom to a greater issue in cassandra?
>>
>>
>> kind regards,
>> Christian
>>
>> PS: I also appreciate general feedback on the entire C* CAS topic :-)
>>
>>
>>
>


Re: CAS operation does not return value on failure

2016-05-04 Thread Jack Krupansky
Probably better to ask this on the Java driver user list.


-- Jack Krupansky

On Wed, May 4, 2016 at 11:46 AM, horschi  wrote:

> Hi,
>
> I am doing some testing on CAS operations and I am frequently having the
> issue that my resultset says wasApplied()==false, but it does not contain
> any value.
>
>
> This behaviour of course leads to the following Exception when I try to
> read it:
>
> Caused by: java.lang.IllegalArgumentException: value is not a column
> defined in this metadata
> at
> com.datastax.driver.core.ColumnDefinitions.getAllIdx(ColumnDefinitions.java:273)
> at
> com.datastax.driver.core.ColumnDefinitions.getFirstIdx(ColumnDefinitions.java:279)
> at
> com.datastax.driver.core.ArrayBackedRow.getIndexOf(ArrayBackedRow.java:68)
> at
> com.datastax.driver.core.AbstractGettableData.getBytes(AbstractGettableData.java:131)
>
>
>
> My questions now are:
>
> Is it to be expected that a failing CAS operation sometimes does this?
>
> if yes: Shouldn't there a possibility on the driver side to handle this in
> a better was, e.g. add a "hasColumn()" method or something to the ResultSet?
>
> if no: Is that perhaps a symptom to a greater issue in cassandra?
>
>
> kind regards,
> Christian
>
> PS: I also appreciate general feedback on the entire C* CAS topic :-)
>
>
>