You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Em <ma...@yahoo.de> on 2013/04/27 17:09:52 UTC

Multi-CheckAnd...

Hello list,

I was wondering how to create a multi-row-mutation with
precondition-constraints.

Something like this:

public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
column, List<Put> puts);

This looks a little bit ugly but illustrates the idea.

Are there any alternatives that would fit the use-case?

Kind regards,
Em

Re: Multi-CheckAnd...

Posted by Ted Yu <yu...@gmail.com>.
I think we can utilize
HBASE-6712<https://issues.apache.org/jira/browse/HBASE-6712> for
this work.

Cheers

On Sun, Apr 28, 2013 at 11:34 AM, lars hofhansl <la...@apache.org> wrote:

> It's not far fetched to add a checkAndMutate method/rpc to HBase. Put,
> Delete, Increment (in trunk), and Append extend Mutation, so it would not
> be too hard to add.
> Could you file a jira and explain what you need specifically. I'm sure
> somebody will step up and make a patch (unless you want to work on a patch
> :) ).
>
> -- Lars
>
>
>
> ________________________________
>  From: Em <ma...@yahoo.de>
> To: "user@hbase.apache.org" <us...@hbase.apache.org>
> Sent: Saturday, April 27, 2013 8:09 AM
> Subject: Multi-CheckAnd...
>
>
> Hello list,
>
> I was wondering how to create a multi-row-mutation with
> precondition-constraints.
>
> Something like this:
>
> public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
> column, List<Put> puts);
>
> This looks a little bit ugly but illustrates the idea.
>
> Are there any alternatives that would fit the use-case?
>
> Kind regards,
> Em
>

Re: Multi-CheckAnd...

Posted by Em <ma...@yahoo.de>.
Creating such a method in HTableInterface/HTable, are there any needs to
touch server-side code or would a modification of those classes be enough?

If so, I would love to help out there.

As soon as it is clear where to make the approprirate changes, I'll file
an issue.

Thanks, Lars!

Kind regards,
Em

Am 28.04.2013 05:34, schrieb lars hofhansl:
> It's not far fetched to add a checkAndMutate method/rpc to HBase. Put, Delete, Increment (in trunk), and Append extend Mutation, so it would not be too hard to add.
> Could you file a jira and explain what you need specifically. I'm sure somebody will step up and make a patch (unless you want to work on a patch :) ).
> 
> -- Lars
> 
> 
> 
> ________________________________
>  From: Em <ma...@yahoo.de>
> To: "user@hbase.apache.org" <us...@hbase.apache.org> 
> Sent: Saturday, April 27, 2013 8:09 AM
> Subject: Multi-CheckAnd...
>  
> 
> Hello list,
> 
> I was wondering how to create a multi-row-mutation with
> precondition-constraints.
> 
> Something like this:
> 
> public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
> column, List<Put> puts);
> 
> This looks a little bit ugly but illustrates the idea.
> 
> Are there any alternatives that would fit the use-case?
> 
> Kind regards,
> Em
> 

Re: Multi-CheckAnd...

Posted by lars hofhansl <la...@apache.org>.
It's not far fetched to add a checkAndMutate method/rpc to HBase. Put, Delete, Increment (in trunk), and Append extend Mutation, so it would not be too hard to add.
Could you file a jira and explain what you need specifically. I'm sure somebody will step up and make a patch (unless you want to work on a patch :) ).

-- Lars



________________________________
 From: Em <ma...@yahoo.de>
To: "user@hbase.apache.org" <us...@hbase.apache.org> 
Sent: Saturday, April 27, 2013 8:09 AM
Subject: Multi-CheckAnd...
 

Hello list,

I was wondering how to create a multi-row-mutation with
precondition-constraints.

Something like this:

public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
column, List<Put> puts);

This looks a little bit ugly but illustrates the idea.

Are there any alternatives that would fit the use-case?

Kind regards,
Em

Re: Multi-CheckAnd...

Posted by Em <ma...@yahoo.de>.
Hi,

my API was not correct.

It has to look like this (forgot the "value"-param):

public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
 column, byte[] value, List<Put> puts);

> In the API you described, what is the meaning for first parameter, row ?
> Are the puts allowed to write into rows with row keys other than that
> specified by row ?

To be consistent with the other checkAndXXX-methods:
You are free to choose the rowKey in any way you like - even choosing
one from another region is considered valid. However those methods were
made for rows that are located in the same region as the related Put and
are only atomic compare-and-set-operations, if the specified rowKey for
the comparison is the same as the row of the related Put.

Kind regards,
Em


Am 28.04.2013 00:48, schrieb Ted Yu:
> In the API you described, what is the meaning for first parameter, row ?
> Are the puts allowed to write into rows with row keys other than that
> specified by row ?
> 
> I am asking because potentially the rowkey range implied by puts may span
> beyond one region.
> If that is the case, HBase doesn't support atomicity (across regions).
> 
> Cheers
> 
> On Sat, Apr 27, 2013 at 11:09 PM, Em <ma...@yahoo.de> wrote:
> 
>> Hello list,
>>
>> I was wondering how to create a multi-row-mutation with
>> precondition-constraints.
>>
>> Something like this:
>>
>> public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
>> column, List<Put> puts);
>>
>> This looks a little bit ugly but illustrates the idea.
>>
>> Are there any alternatives that would fit the use-case?
>>
>> Kind regards,
>> Em
>>
> 

Re: Multi-CheckAnd...

Posted by Ted Yu <yu...@gmail.com>.
In the API you described, what is the meaning for first parameter, row ?
Are the puts allowed to write into rows with row keys other than that
specified by row ?

I am asking because potentially the rowkey range implied by puts may span
beyond one region.
If that is the case, HBase doesn't support atomicity (across regions).

Cheers

On Sat, Apr 27, 2013 at 11:09 PM, Em <ma...@yahoo.de> wrote:

> Hello list,
>
> I was wondering how to create a multi-row-mutation with
> precondition-constraints.
>
> Something like this:
>
> public boolean[] multiCheckAndPut(byte[]row, byte[] family, byte[]
> column, List<Put> puts);
>
> This looks a little bit ugly but illustrates the idea.
>
> Are there any alternatives that would fit the use-case?
>
> Kind regards,
> Em
>