You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@accumulo.apache.org by "shweta.agrawal" <sh...@orkash.com> on 2015/10/30 12:36:17 UTC

Transaction type query in accumulo

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"

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.

Please provide your inputs

Thanks
Shweta

Re: Transaction type query in accumulo

Posted by Josh Elser <jo...@gmail.com>.
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

Re: Transaction type query in accumulo

Posted by "shweta.agrawal" <sh...@orkash.com>.
Thanks Josh and Keith.
This is exactly what I am looking. I have set some value for row through 
conditional mutation if that exists I am updating the entries of a row. 
So I think in that case conditional mutational will work. It will not be 
interrupted by other threads.

Thanks
Shweta

On Monday 02 November 2015 09:30 PM, Keith Turner wrote:
>
>
> On Fri, Oct 30, 2015 at 7:36 AM, shweta.agrawal 
> <shweta.agrawal@orkash.com <ma...@orkash.com>> 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"
>
>     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?
>
>
> This could be done with a conditional write and a sequence number 
> column per row.
>
> Could do something like the following
>
>   * Read row using isolated scanner or whole row iterator.
>   * Assume row has a column like sync:seq.
>   * Make changes to row in client.
>   * Write conditional mutation with condition that sync:seq is what 
> was read earlier.  Also increment the sequence number
>
> With this pattern only one client can succesfully read-modify-write a 
> row concurrently.  In the case where the column synch:seq does not 
> exist, the conditional mutation should assert it does not exist and 
> set it to an initial value.
>
>
> Is this what you are looking for?  Or are you trying to do something else?
>
>
>     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.
>
>     Please provide your inputs
>
>     Thanks
>     Shweta
>
>


Re: Transaction type query in accumulo

Posted by Keith Turner <ke...@deenlo.com>.
On Fri, Oct 30, 2015 at 7:36 AM, shweta.agrawal <sh...@orkash.com>
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"
>
> 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?
>

This could be done with a conditional write and a sequence number column
per row.

Could do something like the following

  * Read row using isolated scanner or whole row iterator.
  * Assume row has a column like sync:seq.
  * Make changes to row in client.
  * Write conditional mutation with condition that sync:seq is what was
read earlier.  Also increment the sequence number

With this pattern only one client can succesfully read-modify-write a row
concurrently.  In the case where the column synch:seq does not exist, the
conditional mutation should assert it does not exist and set it to an
initial value.


Is this what you are looking for?  Or are you trying to do something else?


>
> 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.
>
> Please provide your inputs
>
> Thanks
> Shweta
>