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 Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Reply via email to