cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Compton <>
Subject Re: conditional batches across two tables?
Date Mon, 17 Nov 2014 03:17:28 GMT
Hi Kevin

Have you looked at Cassandra's lightweight transactions? It sounds like they might work for


> On 17/11/2014, at 1:51 pm, Kevin Burton <> wrote:
> I’m trying to have some code acquire a lock by first at performing a table mutation,
and then if it wins, performing a second table insert.
> I don’t think this is possible with batches though.
> I don’t think I can say “update this table, and if you are able to set the value,
and the value doesn’t already exist, then insert into this other table”
> I can do this in Java code, but it’s not transactional.  Which is fine of course, I
can work around some code to make it safe.  
> My plan B is to perform a conditional update by doing an IF NOT EXISTS and if I win then
I can do the insert but only for a limited time while I hold the lock.  
> But I don’t know if even this is possible without a write then read because the datastax
driver doesn’t allow me to read the values that were written.  I’d have to do another
SELECT to read them back out.  
> -- 
> Founder/CEO
> Location: San Francisco, CA
> blog:
> … or check out my Google+ profile

View raw message