accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Elser <josh.el...@gmail.com>
Subject Re: Transaction type query in accumulo
Date Fri, 30 Oct 2015 17:42:51 GMT
Hi Shweta,

shweta.agrawal wrote:
> Hi,
>
> Is transaction type facility available in Accumulo?
> I have read about transaction in accumulo which says " Accumulo
> guarantees these ACID properties for a single mutation (a set of changes
> for a single row) but does not provide support for atomic updates across
> multiple rows"

This might be easier to reason about if you consider the Java API.

When you make a Mutation, all updates in that mutation will be applied 
or rejected.

Mutation m = new Mutation("row".getBytes());
m.put("cf", "cq1", "value1");
m.put("cf", "cq2", "value2");
batchwriter.put(m);
batchwriter.close();

In this case, Accumulo will either have 2 K/V pairs in "row" ("cf:cq1" 
=> "value1", "cf:cq2" => "value2") or no K/V pairs in "row".


> In my case:
> If one thread is updating the fields of a document then this document
> should be locked so that other thread cannot modify that document.
>
> I am trying to achieve this by a query through conditional mutation. I
> am checking whether the particular entry exist or not then updating. But
> the problem is I am doing this through 150 threads. If one thread finds
> and updating particular entry then other thread should not get it.
>
> So is this the case in conditional write?
>
> We are achieving same thing through mongoDB by find and modify feature.
>
> If one thread get particular document to update from conditional write
> then other thread should get that particular document.

I'm not 100% sure how best to go about this. Maybe you could use a 
special column in the row to do the exclusion?

write cf:lock <my_client1>
_update columns_
delete cf:lock <my_client1>

Keith probably has a better suggestion :)

> Please provide your inputs
>
> Thanks
> Shweta

Mime
View raw message