Re: How to do a CAS UPDATE on single column CF?

2013-07-01 Thread Sylvain Lebresne
You're right, there is currently no way to do this since 1) insert can't
have a IF currently and 2) update can't update such table.

We'll fix that: https://issues.apache.org/jira/browse/CASSANDRA-5715

--
Sylvain


On Sat, Jun 29, 2013 at 9:51 PM, Blair Zajac bl...@orcaware.com wrote:

 On 6/24/13 8:23 PM, Blair Zajac wrote:

 How does one do an atomic update in a column family with a single column?

 I have a this CF

 CREATE TABLE schema_migrations (
 version TEXT PRIMARY KEY,
 ) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};


 Anyone?  Should I raise this on the developer mailing list or open a
 ticket?

 Blair



Re: How to do a CAS UPDATE on single column CF?

2013-07-01 Thread Blair Zajac

Thanks!

On 7/1/13 1:41 AM, Sylvain Lebresne wrote:

You're right, there is currently no way to do this since 1) insert can't have a
IF currently and 2) update can't update such table.

We'll fix that: https://issues.apache.org/jira/browse/CASSANDRA-5715

--
Sylvain


On Sat, Jun 29, 2013 at 9:51 PM, Blair Zajac bl...@orcaware.com
mailto:bl...@orcaware.com wrote:

On 6/24/13 8:23 PM, Blair Zajac wrote:

How does one do an atomic update in a column family with a single 
column?

I have a this CF

CREATE TABLE schema_migrations (
version TEXT PRIMARY KEY,
) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};


Anyone?  Should I raise this on the developer mailing list or open a ticket?

Blair


Re: How to do a CAS UPDATE on single column CF?

2013-07-01 Thread Hiller, Dean
What does CAS stand for? And is that the row locking feature like hbase's
setAndReadWinner that you give the previous val and next val and your next
val is returned if you won otherwise the current result is returned and
you know some other node won?

Thanks,
Dean

On 7/1/13 12:09 PM, Blair Zajac bl...@orcaware.com wrote:

Thanks!

On 7/1/13 1:41 AM, Sylvain Lebresne wrote:
 You're right, there is currently no way to do this since 1) insert
can't have a
 IF currently and 2) update can't update such table.

 We'll fix that: https://issues.apache.org/jira/browse/CASSANDRA-5715

 --
 Sylvain


 On Sat, Jun 29, 2013 at 9:51 PM, Blair Zajac bl...@orcaware.com
 mailto:bl...@orcaware.com wrote:

 On 6/24/13 8:23 PM, Blair Zajac wrote:

 How does one do an atomic update in a column family with a
single column?

 I have a this CF

 CREATE TABLE schema_migrations (
 version TEXT PRIMARY KEY,
 ) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};


 Anyone?  Should I raise this on the developer mailing list or open
a ticket?

 Blair



Re: How to do a CAS UPDATE on single column CF?

2013-07-01 Thread Francisco Andrades Grassi
http://en.wikipedia.org/wiki/Compare-and-swap

I believe C* uses Paxos for CAS but not completely sure?

--
Francisco Andrades Grassi
www.bigjocker.com
@bigjocker

On Jul 1, 2013, at 1:49 PM, Hiller, Dean dean.hil...@nrel.gov wrote:

 What does CAS stand for? And is that the row locking feature like hbase's
 setAndReadWinner that you give the previous val and next val and your next
 val is returned if you won otherwise the current result is returned and
 you know some other node won?
 
 Thanks,
 Dean
 
 On 7/1/13 12:09 PM, Blair Zajac bl...@orcaware.com wrote:
 
 Thanks!
 
 On 7/1/13 1:41 AM, Sylvain Lebresne wrote:
 You're right, there is currently no way to do this since 1) insert
 can't have a
 IF currently and 2) update can't update such table.
 
 We'll fix that: https://issues.apache.org/jira/browse/CASSANDRA-5715
 
 --
 Sylvain
 
 
 On Sat, Jun 29, 2013 at 9:51 PM, Blair Zajac bl...@orcaware.com
 mailto:bl...@orcaware.com wrote:
 
On 6/24/13 8:23 PM, Blair Zajac wrote:
 
How does one do an atomic update in a column family with a
 single column?
 
I have a this CF
 
CREATE TABLE schema_migrations (
version TEXT PRIMARY KEY,
) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};
 
 
Anyone?  Should I raise this on the developer mailing list or open
 a ticket?
 
Blair
 



Re: How to do a CAS UPDATE on single column CF?

2013-07-01 Thread Andrew Cobley
According to Jonathan Ellis talk at Cassandra 13 it does use Paxos:

http://www.youtube.com/watch?v=PcUpPR4nSr4list=PLqcm6qE9lgKJzVvwHprow9h7KMpb5hcUU

http://www.slideshare.net/jbellis/cassandra-summit-2013-keynote

Andy

On 1 Jul 2013, at 19:40, Francisco Andrades Grassi 
bigjoc...@gmail.commailto:bigjoc...@gmail.com wrote:

http://en.wikipedia.org/wiki/Compare-and-swap

I believe C* uses Paxos for CAS but not completely sure?

--
Francisco Andrades Grassi
www.bigjocker.comhttp://www.bigjocker.com/
@bigjocker

On Jul 1, 2013, at 1:49 PM, Hiller, Dean 
dean.hil...@nrel.govmailto:dean.hil...@nrel.gov wrote:

What does CAS stand for? And is that the row locking feature like hbase's
setAndReadWinner that you give the previous val and next val and your next
val is returned if you won otherwise the current result is returned and
you know some other node won?



The University of Dundee is a registered Scottish Charity, No: SC015096


Re: How to do a CAS UPDATE on single column CF?

2013-06-29 Thread Blair Zajac

On 6/24/13 8:23 PM, Blair Zajac wrote:

How does one do an atomic update in a column family with a single column?

I have a this CF

CREATE TABLE schema_migrations (
version TEXT PRIMARY KEY,
) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};


Anyone?  Should I raise this on the developer mailing list or open a ticket?

Blair


Re: How to do a CAS UPDATE on single column CF?

2013-06-25 Thread Blair Zajac

On 06/24/2013 08:35 PM, Arthur Zubarev wrote:

On 06/24/2013 11:23 PM, Blair Zajac wrote:

CAS UPDATE

Since when C* has IF NOT EXISTS in DML part of CQL?


It's new in 2.0.

https://issues.apache.org/jira/browse/CASSANDRA-5062
https://github.com/riptano/cassandra-dtest/blob/master/cql_tests.py#L3044

Blair



How to do a CAS UPDATE on single column CF?

2013-06-24 Thread Blair Zajac

How does one do an atomic update in a column family with a single column?

I have a this CF

  CREATE TABLE schema_migrations (
version TEXT PRIMARY KEY,
  ) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};

that records which database migrations have been applied.  I want to do 
a CAS UPDATE to add a dummy lock token to prevent multiple migrations 
from running, but these three attempts fail (using the Python cql client):



 cursor.execute(UPDATE schema_migrations SET version = 'locked' 
WHERE version = 'locked' IF NOT EXISTS)
cql.apivalues.ProgrammingError: Bad Request: PRIMARY KEY part version 
found in SET part



 cursor.execute(UPDATE schema_migrations SET WHERE version = 
'locked' IF NOT EXISTS)
cql.apivalues.ProgrammingError: Bad Request: line 1:29 no viable 
alternative at input 'WHERE'




 cursor.execute(INSERT INTO schema_migrations (version) VALUES 
('locked') IF NOT EXISTS)

cql.apivalues.ProgrammingError: Bad Request: line 1:58 missing EOF at 'IF'

Thanks,
Blair


Re: How to do a CAS UPDATE on single column CF?

2013-06-24 Thread Arthur Zubarev

On 06/24/2013 11:23 PM, Blair Zajac wrote:

CAS UPDATE

Since when C* has IF NOT EXISTS in DML part of CQL?

--

Regards,

Arthur