You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Mike Spreitzer <ms...@us.ibm.com> on 2012/11/18 04:30:19 UTC

Why only check1-and-putMany and check1-and-deleteMany?

If I understand correctly, an HTable has two composite atomic operations, 
checkAndPut and checkAndDelete.  The check part checks just a single 
column's value.  Why not allow checking more than one column?

Why no checkAndAppend?

The checkAndPut operation can put to multiple columns, right?  And the 
checkAndDelete operation can delete multiple columns, right?  Why not let 
them be mixed?  Why not checkAndMutate?

Thanks!
Mike

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Suraj Varma <sv...@gmail.com>.
There was this https://issues.apache.org/jira/browse/HBASE-4999 ticket
for supporting atomic row level mutations based on generic constraints
with some discussion on possible solution.

Jonathan - is there another jira that you were working on for a
similar checkAndMutate functionality?
Thanks,
--Suraj


On Thu, Nov 29, 2012 at 12:32 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:
> The piece that I'm assuming from my previous comment is that the checks and
> mutations are *all on the same row* and that all this happens *atomically*.
>  This is in line with Mike Spreitzer's earlier post.
>
> I'm hacking on something that needs to check two conditions and if
> successful does some deletes and puts.
>
> Jon.
>
> On Thu, Nov 29, 2012 at 11:59 AM, Mike Spreitzer <ms...@us.ibm.com>wrote:
>
>> I would not suggest that a single composite operation should be able to
>> access multiple rows.  What I expect would be easy is an arbitrary set of
>> accesses to one row.
>>
>> The use case is optimistic concurrency control.  In scenarios where
>> conflicts are rare, you can get reasonably efficient serializable
>> transactions (where one transaction can do arbitrary pointwise accesses to
>> a single row) by using a general test-and-set operation.  There is some
>> non-trivial stuff the client has to do, but a general single-row
>> test-and-set is the only missing piece of HTable functionality.
>>
>> Mike
>>
>>
>>
>> From:   Michel Segel <mi...@hotmail.com>
>> To:     "user@hbase.apache.org" <us...@hbase.apache.org>
>> Cc:     "user@hbase.apache.org" <us...@hbase.apache.org>
>> Date:   11/29/2012 02:46 PM
>> Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?
>>
>>
>>
>> Silly question...
>> Why?
>>
>> I mean while it is technically feasible to do, can you come up with a use
>> case and then show how it is better than the alternatives?
>>
>>
>>
>> Sent from a remote device. Please excuse any typos...
>>
>> Mike Segel
>>
>> On Nov 29, 2012, at 12:44 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:
>>
>> > Actually, I think we'd want to have repeated Conditions in to have
>> multiple
>> > check predicates, and would want to add repeated Conditions to multi
>> > requests.
>> >
>> > This would let us have arbitrary number of checks and arbitrary number
>> of
>> > puts and deletes from an API point of view.
>> >
>> > Jon.
>> >
>> > On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:
>> >
>> >> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I
>> tried
>> >> the following formation to see if we can pass more than one qualifier:
>> >>
>> >> Index: hbase-server/src/main/protobuf/Client.proto
>> >> ===================================================================
>> >> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
>> >> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
>> >> @@ -97,7 +97,7 @@
>> >> message Condition {
>> >>   required bytes row = 1;
>> >>   required bytes family = 2;
>> >> -  required bytes qualifier = 3;
>> >> +  repeated bytes qualifier = 3;
>> >>   required CompareType compareType = 4;
>> >>   required Comparator comparator = 5;
>> >> }
>> >>
>> >> protoc is able to compile the above code.
>> >> This means we can potentially compare more than one qualifier in the
>> check
>> >> step.
>> >>
>> >> More discussion is needed to figure out the proper API which would be a
>> >> superset of what we have today:
>> >>  public boolean checkAndPut(final byte [] row,
>> >>      final byte [] family, final byte [] qualifier, final byte []
>> value,
>> >>      final Put put)
>> >>
>> >> Cheers
>> >>
>> >> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
>> >>> wrote:
>> >>
>> >>> I am not looking at the trunk.  I am just a user looking at the
>> interface
>> >>> documented on the web site and wondering why the atomic composite
>> >>> functionality is so limited.  It is not hard to imagine an expanded
>> >>> interface that allows checking an arbitrary set of columns and, if
>> each
>> >>> has a value specified for it, doing an arbitrary set of Mutations.
>> >>>
>> >>> Thanks,
>> >>> Mike
>> >>>
>> >>>
>> >>>
>> >>> From:   Ted Yu <yu...@gmail.com>
>> >>> To:     user@hbase.apache.org
>> >>> Date:   11/17/2012 11:44 PM
>> >>> Subject:        Re: Why only check1-and-putMany and
>> >> check1-and-deleteMany?
>> >>>
>> >>>
>> >>>
>> >>> Are you looking at trunk code ?
>> >>>
>> >>> In trunk, take a look at HRegion.checkAndMutate() where you can
>> specify
>> >>> ByteArrayComparable which does the comparison (matching).
>> >>> There is still the limit of single value:
>> >>>        } else if (result.size() == 1 && !valueIsNull) {
>> >>>          KeyValue kv = result.get(0);
>> >>>
>> >>> For the moment, only Put and Delete are supported:
>> >>>
>> >>>    if (!isPut && !(w instanceof Delete))
>> >>>      throw new DoNotRetryIOException("Action must be Put or Delete");
>> >>> If you have suggestion on how the check part can be more general,
>> please
>> >>> comment.
>> >>>
>> >>> Thanks
>> >>>
>> >>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
>> >>> wrote:
>> >>>
>> >>>> If I understand correctly, an HTable has two composite atomic
>> >>> operations,
>> >>>> checkAndPut and checkAndDelete.  The check part checks just a single
>> >>>> column's value.  Why not allow checking more than one column?
>> >>>>
>> >>>> Why no checkAndAppend?
>> >>>>
>> >>>> The checkAndPut operation can put to multiple columns, right?  And
>> the
>> >>>> checkAndDelete operation can delete multiple columns, right?  Why not
>> >>> let
>> >>>> them be mixed?  Why not checkAndMutate?
>> >>>>
>> >>>> Thanks!
>> >>>> Mike
>> >
>> >
>> >
>> > --
>> > // Jonathan Hsieh (shay)
>> > // Software Engineer, Cloudera
>> > // jon@cloudera.com
>>
>>
>>
>
>
> --
> // Jonathan Hsieh (shay)
> // Software Engineer, Cloudera
> // jon@cloudera.com

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Jonathan Hsieh <jo...@cloudera.com>.
The piece that I'm assuming from my previous comment is that the checks and
mutations are *all on the same row* and that all this happens *atomically*.
 This is in line with Mike Spreitzer's earlier post.

I'm hacking on something that needs to check two conditions and if
successful does some deletes and puts.

Jon.

On Thu, Nov 29, 2012 at 11:59 AM, Mike Spreitzer <ms...@us.ibm.com>wrote:

> I would not suggest that a single composite operation should be able to
> access multiple rows.  What I expect would be easy is an arbitrary set of
> accesses to one row.
>
> The use case is optimistic concurrency control.  In scenarios where
> conflicts are rare, you can get reasonably efficient serializable
> transactions (where one transaction can do arbitrary pointwise accesses to
> a single row) by using a general test-and-set operation.  There is some
> non-trivial stuff the client has to do, but a general single-row
> test-and-set is the only missing piece of HTable functionality.
>
> Mike
>
>
>
> From:   Michel Segel <mi...@hotmail.com>
> To:     "user@hbase.apache.org" <us...@hbase.apache.org>
> Cc:     "user@hbase.apache.org" <us...@hbase.apache.org>
> Date:   11/29/2012 02:46 PM
> Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?
>
>
>
> Silly question...
> Why?
>
> I mean while it is technically feasible to do, can you come up with a use
> case and then show how it is better than the alternatives?
>
>
>
> Sent from a remote device. Please excuse any typos...
>
> Mike Segel
>
> On Nov 29, 2012, at 12:44 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:
>
> > Actually, I think we'd want to have repeated Conditions in to have
> multiple
> > check predicates, and would want to add repeated Conditions to multi
> > requests.
> >
> > This would let us have arbitrary number of checks and arbitrary number
> of
> > puts and deletes from an API point of view.
> >
> > Jon.
> >
> > On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:
> >
> >> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I
> tried
> >> the following formation to see if we can pass more than one qualifier:
> >>
> >> Index: hbase-server/src/main/protobuf/Client.proto
> >> ===================================================================
> >> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
> >> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
> >> @@ -97,7 +97,7 @@
> >> message Condition {
> >>   required bytes row = 1;
> >>   required bytes family = 2;
> >> -  required bytes qualifier = 3;
> >> +  repeated bytes qualifier = 3;
> >>   required CompareType compareType = 4;
> >>   required Comparator comparator = 5;
> >> }
> >>
> >> protoc is able to compile the above code.
> >> This means we can potentially compare more than one qualifier in the
> check
> >> step.
> >>
> >> More discussion is needed to figure out the proper API which would be a
> >> superset of what we have today:
> >>  public boolean checkAndPut(final byte [] row,
> >>      final byte [] family, final byte [] qualifier, final byte []
> value,
> >>      final Put put)
> >>
> >> Cheers
> >>
> >> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
> >>> wrote:
> >>
> >>> I am not looking at the trunk.  I am just a user looking at the
> interface
> >>> documented on the web site and wondering why the atomic composite
> >>> functionality is so limited.  It is not hard to imagine an expanded
> >>> interface that allows checking an arbitrary set of columns and, if
> each
> >>> has a value specified for it, doing an arbitrary set of Mutations.
> >>>
> >>> Thanks,
> >>> Mike
> >>>
> >>>
> >>>
> >>> From:   Ted Yu <yu...@gmail.com>
> >>> To:     user@hbase.apache.org
> >>> Date:   11/17/2012 11:44 PM
> >>> Subject:        Re: Why only check1-and-putMany and
> >> check1-and-deleteMany?
> >>>
> >>>
> >>>
> >>> Are you looking at trunk code ?
> >>>
> >>> In trunk, take a look at HRegion.checkAndMutate() where you can
> specify
> >>> ByteArrayComparable which does the comparison (matching).
> >>> There is still the limit of single value:
> >>>        } else if (result.size() == 1 && !valueIsNull) {
> >>>          KeyValue kv = result.get(0);
> >>>
> >>> For the moment, only Put and Delete are supported:
> >>>
> >>>    if (!isPut && !(w instanceof Delete))
> >>>      throw new DoNotRetryIOException("Action must be Put or Delete");
> >>> If you have suggestion on how the check part can be more general,
> please
> >>> comment.
> >>>
> >>> Thanks
> >>>
> >>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
> >>> wrote:
> >>>
> >>>> If I understand correctly, an HTable has two composite atomic
> >>> operations,
> >>>> checkAndPut and checkAndDelete.  The check part checks just a single
> >>>> column's value.  Why not allow checking more than one column?
> >>>>
> >>>> Why no checkAndAppend?
> >>>>
> >>>> The checkAndPut operation can put to multiple columns, right?  And
> the
> >>>> checkAndDelete operation can delete multiple columns, right?  Why not
> >>> let
> >>>> them be mixed?  Why not checkAndMutate?
> >>>>
> >>>> Thanks!
> >>>> Mike
> >
> >
> >
> > --
> > // Jonathan Hsieh (shay)
> > // Software Engineer, Cloudera
> > // jon@cloudera.com
>
>
>


-- 
// Jonathan Hsieh (shay)
// Software Engineer, Cloudera
// jon@cloudera.com

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Mike Spreitzer <ms...@us.ibm.com>.
Yes.  What I have been asking about is an operation that atomically checks 
multiple columns for equality with given values and, if they all match, 
applies multiple Mutations --- all in one row.

Silly me.  What I should be asking to compare is not values but 
timestamps.  The test should be, for each of several columns, does the 
latest timestamp equal a given stamp?

Thanks,
Mike



From:   lars hofhansl <lh...@yahoo.com>
To:     "user@hbase.apache.org" <us...@hbase.apache.org>
Date:   11/29/2012 08:49 PM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



So just to understand for the usecase you have in mind you want both:
1. checking multiple columns of the row
2. apply multiple operations to the row

As Jon said, right?

I do not think that would too hard to add. For #2 we already have 
RowMutations (HBASE-3584, HBASE-5203).
We just have to add multiple predicates.


-- Lars
________________________________
From: Mike Spreitzer <ms...@us.ibm.com>
To: user@hbase.apache.org 
Sent: Thursday, November 29, 2012 11:59 AM
Subject: Re: Why only check1-and-putMany and check1-and-deleteMany?

I would not suggest that a single composite operation should be able to 
access multiple rows.  What I expect would be easy is an arbitrary set of 
accesses to one row.

The use case is optimistic concurrency control.  In scenarios where 
conflicts are rare, you can get reasonably efficient serializable 
transactions (where one transaction can do arbitrary pointwise accesses to 

a single row) by using a general test-and-set operation.  There is some 
non-trivial stuff the client has to do, but a general single-row 
test-and-set is the only missing piece of HTable functionality.

Mike



From:   Michel Segel <mi...@hotmail.com>
To:     "user@hbase.apache.org" <us...@hbase.apache.org>
Cc:     "user@hbase.apache.org" <us...@hbase.apache.org>
Date:   11/29/2012 02:46 PM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



Silly question...
Why?

I mean while it is technically feasible to do, can you come up with a use 
case and then show how it is better than the alternatives?



Sent from a remote device. Please excuse any typos...

Mike Segel

On Nov 29, 2012, at 12:44 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:

> Actually, I think we'd want to have repeated Conditions in to have 
multiple
> check predicates, and would want to add repeated Conditions to multi
> requests.
> 
> This would let us have arbitrary number of checks and arbitrary number 
of
> puts and deletes from an API point of view.
> 
> Jon.
> 
> On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:
> 
>> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I 
tried
>> the following formation to see if we can pass more than one qualifier:
>> 
>> Index: hbase-server/src/main/protobuf/Client.proto
>> ===================================================================
>> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
>> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
>> @@ -97,7 +97,7 @@
>> message Condition {
>>   required bytes row = 1;
>>   required bytes family = 2;
>> -  required bytes qualifier = 3;
>> +  repeated bytes qualifier = 3;
>>   required CompareType compareType = 4;
>>   required Comparator comparator = 5;
>> }
>> 
>> protoc is able to compile the above code.
>> This means we can potentially compare more than one qualifier in the 
check
>> step.
>> 
>> More discussion is needed to figure out the proper API which would be a
>> superset of what we have today:
>>  public boolean checkAndPut(final byte [] row,
>>      final byte [] family, final byte [] qualifier, final byte [] 
value,
>>      final Put put)
>> 
>> Cheers
>> 
>> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
>>> wrote:
>> 
>>> I am not looking at the trunk.  I am just a user looking at the 
interface
>>> documented on the web site and wondering why the atomic composite
>>> functionality is so limited.  It is not hard to imagine an expanded
>>> interface that allows checking an arbitrary set of columns and, if 
each
>>> has a value specified for it, doing an arbitrary set of Mutations.
>>> 
>>> Thanks,
>>> Mike
>>> 
>>> 
>>> 
>>> From:   Ted Yu <yu...@gmail.com>
>>> To:    user@hbase.apache.org
>>> Date:   11/17/2012 11:44 PM
>>> Subject:        Re: Why only check1-and-putMany and
>> check1-and-deleteMany?
>>> 
>>> 
>>> 
>>> Are you looking at trunk code ?
>>> 
>>> In trunk, take a look at HRegion.checkAndMutate() where you can 
specify
>>> ByteArrayComparable which does the comparison (matching).
>>> There is still the limit of single value:
>>>        } else if (result.size() == 1 && !valueIsNull) {
>>>          KeyValue kv = result.get(0);
>>> 
>>> For the moment, only Put and Delete are supported:
>>> 
>>>    if (!isPut && !(w instanceof Delete))
>>>      throw new DoNotRetryIOException("Action must be Put or Delete");
>>> If you have suggestion on how the check part can be more general, 
please
>>> comment.
>>> 
>>> Thanks
>>> 
>>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
>>> wrote:
>>> 
>>>> If I understand correctly, an HTable has two composite atomic
>>> operations,
>>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>>> column's value.  Why not allow checking more than one column?
>>>> 
>>>> Why no checkAndAppend?
>>>> 
>>>> The checkAndPut operation can put to multiple columns, right?  And 
the
>>>> checkAndDelete operation can delete multiple columns, right?  Why not
>>> let
>>>> them be mixed?  Why not checkAndMutate?
>>>> 
>>>> Thanks!
>>>> Mike
> 
> 
> 
> -- 
> // Jonathan Hsieh (shay)
> // Software Engineer, Cloudera
> // jon@cloudera.com



Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by lars hofhansl <lh...@yahoo.com>.
So just to understand for the usecase you have in mind you want both:
1. checking multiple columns of the row
2. apply multiple operations to the row

As Jon said, right?

I do not think that would too hard to add. For #2 we already have RowMutations (HBASE-3584, HBASE-5203).
We just have to add multiple predicates.


-- Lars
________________________________
From: Mike Spreitzer <ms...@us.ibm.com>
To: user@hbase.apache.org 
Sent: Thursday, November 29, 2012 11:59 AM
Subject: Re: Why only check1-and-putMany and check1-and-deleteMany?

I would not suggest that a single composite operation should be able to 
access multiple rows.  What I expect would be easy is an arbitrary set of 
accesses to one row.

The use case is optimistic concurrency control.  In scenarios where 
conflicts are rare, you can get reasonably efficient serializable 
transactions (where one transaction can do arbitrary pointwise accesses to 
a single row) by using a general test-and-set operation.  There is some 
non-trivial stuff the client has to do, but a general single-row 
test-and-set is the only missing piece of HTable functionality.

Mike



From:   Michel Segel <mi...@hotmail.com>
To:     "user@hbase.apache.org" <us...@hbase.apache.org>
Cc:     "user@hbase.apache.org" <us...@hbase.apache.org>
Date:   11/29/2012 02:46 PM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



Silly question...
Why?

I mean while it is technically feasible to do, can you come up with a use 
case and then show how it is better than the alternatives?



Sent from a remote device. Please excuse any typos...

Mike Segel

On Nov 29, 2012, at 12:44 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:

> Actually, I think we'd want to have repeated Conditions in to have 
multiple
> check predicates, and would want to add repeated Conditions to multi
> requests.
> 
> This would let us have arbitrary number of checks and arbitrary number 
of
> puts and deletes from an API point of view.
> 
> Jon.
> 
> On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:
> 
>> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I 
tried
>> the following formation to see if we can pass more than one qualifier:
>> 
>> Index: hbase-server/src/main/protobuf/Client.proto
>> ===================================================================
>> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
>> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
>> @@ -97,7 +97,7 @@
>> message Condition {
>>   required bytes row = 1;
>>   required bytes family = 2;
>> -  required bytes qualifier = 3;
>> +  repeated bytes qualifier = 3;
>>   required CompareType compareType = 4;
>>   required Comparator comparator = 5;
>> }
>> 
>> protoc is able to compile the above code.
>> This means we can potentially compare more than one qualifier in the 
check
>> step.
>> 
>> More discussion is needed to figure out the proper API which would be a
>> superset of what we have today:
>>  public boolean checkAndPut(final byte [] row,
>>      final byte [] family, final byte [] qualifier, final byte [] 
value,
>>      final Put put)
>> 
>> Cheers
>> 
>> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
>>> wrote:
>> 
>>> I am not looking at the trunk.  I am just a user looking at the 
interface
>>> documented on the web site and wondering why the atomic composite
>>> functionality is so limited.  It is not hard to imagine an expanded
>>> interface that allows checking an arbitrary set of columns and, if 
each
>>> has a value specified for it, doing an arbitrary set of Mutations.
>>> 
>>> Thanks,
>>> Mike
>>> 
>>> 
>>> 
>>> From:   Ted Yu <yu...@gmail.com>
>>> To:    user@hbase.apache.org
>>> Date:   11/17/2012 11:44 PM
>>> Subject:        Re: Why only check1-and-putMany and
>> check1-and-deleteMany?
>>> 
>>> 
>>> 
>>> Are you looking at trunk code ?
>>> 
>>> In trunk, take a look at HRegion.checkAndMutate() where you can 
specify
>>> ByteArrayComparable which does the comparison (matching).
>>> There is still the limit of single value:
>>>        } else if (result.size() == 1 && !valueIsNull) {
>>>          KeyValue kv = result.get(0);
>>> 
>>> For the moment, only Put and Delete are supported:
>>> 
>>>    if (!isPut && !(w instanceof Delete))
>>>      throw new DoNotRetryIOException("Action must be Put or Delete");
>>> If you have suggestion on how the check part can be more general, 
please
>>> comment.
>>> 
>>> Thanks
>>> 
>>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
>>> wrote:
>>> 
>>>> If I understand correctly, an HTable has two composite atomic
>>> operations,
>>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>>> column's value.  Why not allow checking more than one column?
>>>> 
>>>> Why no checkAndAppend?
>>>> 
>>>> The checkAndPut operation can put to multiple columns, right?  And 
the
>>>> checkAndDelete operation can delete multiple columns, right?  Why not
>>> let
>>>> them be mixed?  Why not checkAndMutate?
>>>> 
>>>> Thanks!
>>>> Mike
> 
> 
> 
> -- 
> // Jonathan Hsieh (shay)
> // Software Engineer, Cloudera
> // jon@cloudera.com

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Mike Spreitzer <ms...@us.ibm.com>.
I would not suggest that a single composite operation should be able to 
access multiple rows.  What I expect would be easy is an arbitrary set of 
accesses to one row.

The use case is optimistic concurrency control.  In scenarios where 
conflicts are rare, you can get reasonably efficient serializable 
transactions (where one transaction can do arbitrary pointwise accesses to 
a single row) by using a general test-and-set operation.  There is some 
non-trivial stuff the client has to do, but a general single-row 
test-and-set is the only missing piece of HTable functionality.

Mike



From:   Michel Segel <mi...@hotmail.com>
To:     "user@hbase.apache.org" <us...@hbase.apache.org>
Cc:     "user@hbase.apache.org" <us...@hbase.apache.org>
Date:   11/29/2012 02:46 PM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



Silly question...
Why?

I mean while it is technically feasible to do, can you come up with a use 
case and then show how it is better than the alternatives?



Sent from a remote device. Please excuse any typos...

Mike Segel

On Nov 29, 2012, at 12:44 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:

> Actually, I think we'd want to have repeated Conditions in to have 
multiple
> check predicates, and would want to add repeated Conditions to multi
> requests.
> 
> This would let us have arbitrary number of checks and arbitrary number 
of
> puts and deletes from an API point of view.
> 
> Jon.
> 
> On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:
> 
>> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I 
tried
>> the following formation to see if we can pass more than one qualifier:
>> 
>> Index: hbase-server/src/main/protobuf/Client.proto
>> ===================================================================
>> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
>> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
>> @@ -97,7 +97,7 @@
>> message Condition {
>>   required bytes row = 1;
>>   required bytes family = 2;
>> -  required bytes qualifier = 3;
>> +  repeated bytes qualifier = 3;
>>   required CompareType compareType = 4;
>>   required Comparator comparator = 5;
>> }
>> 
>> protoc is able to compile the above code.
>> This means we can potentially compare more than one qualifier in the 
check
>> step.
>> 
>> More discussion is needed to figure out the proper API which would be a
>> superset of what we have today:
>>  public boolean checkAndPut(final byte [] row,
>>      final byte [] family, final byte [] qualifier, final byte [] 
value,
>>      final Put put)
>> 
>> Cheers
>> 
>> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
>>> wrote:
>> 
>>> I am not looking at the trunk.  I am just a user looking at the 
interface
>>> documented on the web site and wondering why the atomic composite
>>> functionality is so limited.  It is not hard to imagine an expanded
>>> interface that allows checking an arbitrary set of columns and, if 
each
>>> has a value specified for it, doing an arbitrary set of Mutations.
>>> 
>>> Thanks,
>>> Mike
>>> 
>>> 
>>> 
>>> From:   Ted Yu <yu...@gmail.com>
>>> To:     user@hbase.apache.org
>>> Date:   11/17/2012 11:44 PM
>>> Subject:        Re: Why only check1-and-putMany and
>> check1-and-deleteMany?
>>> 
>>> 
>>> 
>>> Are you looking at trunk code ?
>>> 
>>> In trunk, take a look at HRegion.checkAndMutate() where you can 
specify
>>> ByteArrayComparable which does the comparison (matching).
>>> There is still the limit of single value:
>>>        } else if (result.size() == 1 && !valueIsNull) {
>>>          KeyValue kv = result.get(0);
>>> 
>>> For the moment, only Put and Delete are supported:
>>> 
>>>    if (!isPut && !(w instanceof Delete))
>>>      throw new DoNotRetryIOException("Action must be Put or Delete");
>>> If you have suggestion on how the check part can be more general, 
please
>>> comment.
>>> 
>>> Thanks
>>> 
>>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
>>> wrote:
>>> 
>>>> If I understand correctly, an HTable has two composite atomic
>>> operations,
>>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>>> column's value.  Why not allow checking more than one column?
>>>> 
>>>> Why no checkAndAppend?
>>>> 
>>>> The checkAndPut operation can put to multiple columns, right?  And 
the
>>>> checkAndDelete operation can delete multiple columns, right?  Why not
>>> let
>>>> them be mixed?  Why not checkAndMutate?
>>>> 
>>>> Thanks!
>>>> Mike
> 
> 
> 
> -- 
> // Jonathan Hsieh (shay)
> // Software Engineer, Cloudera
> // jon@cloudera.com



Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Michel Segel <mi...@hotmail.com>.
Silly question...
Why?

I mean while it is technically feasible to do, can you come up with a use case and then show how it is better than the alternatives?



Sent from a remote device. Please excuse any typos...

Mike Segel

On Nov 29, 2012, at 12:44 PM, Jonathan Hsieh <jo...@cloudera.com> wrote:

> Actually, I think we'd want to have repeated Conditions in to have multiple
> check predicates, and would want to add repeated Conditions to multi
> requests.
> 
> This would let us have arbitrary number of checks and arbitrary number of
> puts and deletes from an API point of view.
> 
> Jon.
> 
> On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:
> 
>> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I tried
>> the following formation to see if we can pass more than one qualifier:
>> 
>> Index: hbase-server/src/main/protobuf/Client.proto
>> ===================================================================
>> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
>> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
>> @@ -97,7 +97,7 @@
>> message Condition {
>>   required bytes row = 1;
>>   required bytes family = 2;
>> -  required bytes qualifier = 3;
>> +  repeated bytes qualifier = 3;
>>   required CompareType compareType = 4;
>>   required Comparator comparator = 5;
>> }
>> 
>> protoc is able to compile the above code.
>> This means we can potentially compare more than one qualifier in the check
>> step.
>> 
>> More discussion is needed to figure out the proper API which would be a
>> superset of what we have today:
>>  public boolean checkAndPut(final byte [] row,
>>      final byte [] family, final byte [] qualifier, final byte [] value,
>>      final Put put)
>> 
>> Cheers
>> 
>> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
>>> wrote:
>> 
>>> I am not looking at the trunk.  I am just a user looking at the interface
>>> documented on the web site and wondering why the atomic composite
>>> functionality is so limited.  It is not hard to imagine an expanded
>>> interface that allows checking an arbitrary set of columns and, if each
>>> has a value specified for it, doing an arbitrary set of Mutations.
>>> 
>>> Thanks,
>>> Mike
>>> 
>>> 
>>> 
>>> From:   Ted Yu <yu...@gmail.com>
>>> To:     user@hbase.apache.org
>>> Date:   11/17/2012 11:44 PM
>>> Subject:        Re: Why only check1-and-putMany and
>> check1-and-deleteMany?
>>> 
>>> 
>>> 
>>> Are you looking at trunk code ?
>>> 
>>> In trunk, take a look at HRegion.checkAndMutate() where you can specify
>>> ByteArrayComparable which does the comparison (matching).
>>> There is still the limit of single value:
>>>        } else if (result.size() == 1 && !valueIsNull) {
>>>          KeyValue kv = result.get(0);
>>> 
>>> For the moment, only Put and Delete are supported:
>>> 
>>>    if (!isPut && !(w instanceof Delete))
>>>      throw new DoNotRetryIOException("Action must be Put or Delete");
>>> If you have suggestion on how the check part can be more general, please
>>> comment.
>>> 
>>> Thanks
>>> 
>>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
>>> wrote:
>>> 
>>>> If I understand correctly, an HTable has two composite atomic
>>> operations,
>>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>>> column's value.  Why not allow checking more than one column?
>>>> 
>>>> Why no checkAndAppend?
>>>> 
>>>> The checkAndPut operation can put to multiple columns, right?  And the
>>>> checkAndDelete operation can delete multiple columns, right?  Why not
>>> let
>>>> them be mixed?  Why not checkAndMutate?
>>>> 
>>>> Thanks!
>>>> Mike
> 
> 
> 
> -- 
> // Jonathan Hsieh (shay)
> // Software Engineer, Cloudera
> // jon@cloudera.com

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Jonathan Hsieh <jo...@cloudera.com>.
Actually, I think we'd want to have repeated Conditions in to have multiple
check predicates, and would want to add repeated Conditions to multi
requests.

This would let us have arbitrary number of checks and arbitrary number of
puts and deletes from an API point of view.

Jon.

On Mon, Nov 19, 2012 at 10:55 AM, Ted Yu <yu...@gmail.com> wrote:

> Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I tried
> the following formation to see if we can pass more than one qualifier:
>
> Index: hbase-server/src/main/protobuf/Client.proto
> ===================================================================
> --- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
> +++ hbase-server/src/main/protobuf/Client.proto    (working copy)
> @@ -97,7 +97,7 @@
>  message Condition {
>    required bytes row = 1;
>    required bytes family = 2;
> -  required bytes qualifier = 3;
> +  repeated bytes qualifier = 3;
>    required CompareType compareType = 4;
>    required Comparator comparator = 5;
>  }
>
> protoc is able to compile the above code.
> This means we can potentially compare more than one qualifier in the check
> step.
>
> More discussion is needed to figure out the proper API which would be a
> superset of what we have today:
>   public boolean checkAndPut(final byte [] row,
>       final byte [] family, final byte [] qualifier, final byte [] value,
>       final Put put)
>
> Cheers
>
> On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <mspreitz@us.ibm.com
> >wrote:
>
> > I am not looking at the trunk.  I am just a user looking at the interface
> > documented on the web site and wondering why the atomic composite
> > functionality is so limited.  It is not hard to imagine an expanded
> > interface that allows checking an arbitrary set of columns and, if each
> > has a value specified for it, doing an arbitrary set of Mutations.
> >
> > Thanks,
> > Mike
> >
> >
> >
> > From:   Ted Yu <yu...@gmail.com>
> > To:     user@hbase.apache.org
> > Date:   11/17/2012 11:44 PM
> > Subject:        Re: Why only check1-and-putMany and
> check1-and-deleteMany?
> >
> >
> >
> > Are you looking at trunk code ?
> >
> > In trunk, take a look at HRegion.checkAndMutate() where you can specify
> > ByteArrayComparable which does the comparison (matching).
> > There is still the limit of single value:
> >         } else if (result.size() == 1 && !valueIsNull) {
> >           KeyValue kv = result.get(0);
> >
> > For the moment, only Put and Delete are supported:
> >
> >     if (!isPut && !(w instanceof Delete))
> >       throw new DoNotRetryIOException("Action must be Put or Delete");
> > If you have suggestion on how the check part can be more general, please
> > comment.
> >
> > Thanks
> >
> > On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
> > wrote:
> >
> > > If I understand correctly, an HTable has two composite atomic
> > operations,
> > > checkAndPut and checkAndDelete.  The check part checks just a single
> > > column's value.  Why not allow checking more than one column?
> > >
> > > Why no checkAndAppend?
> > >
> > > The checkAndPut operation can put to multiple columns, right?  And the
> > > checkAndDelete operation can delete multiple columns, right?  Why not
> > let
> > > them be mixed?  Why not checkAndMutate?
> > >
> > > Thanks!
> > > Mike
> >
> >
>



-- 
// Jonathan Hsieh (shay)
// Software Engineer, Cloudera
// jon@cloudera.com

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Ted Yu <yu...@gmail.com>.
Looking at hbase-server/src/main/protobuf/Client.proto in trunk, I tried
the following formation to see if we can pass more than one qualifier:

Index: hbase-server/src/main/protobuf/Client.proto
===================================================================
--- hbase-server/src/main/protobuf/Client.proto    (revision 1411337)
+++ hbase-server/src/main/protobuf/Client.proto    (working copy)
@@ -97,7 +97,7 @@
 message Condition {
   required bytes row = 1;
   required bytes family = 2;
-  required bytes qualifier = 3;
+  repeated bytes qualifier = 3;
   required CompareType compareType = 4;
   required Comparator comparator = 5;
 }

protoc is able to compile the above code.
This means we can potentially compare more than one qualifier in the check
step.

More discussion is needed to figure out the proper API which would be a
superset of what we have today:
  public boolean checkAndPut(final byte [] row,
      final byte [] family, final byte [] qualifier, final byte [] value,
      final Put put)

Cheers

On Sat, Nov 17, 2012 at 10:28 PM, Mike Spreitzer <ms...@us.ibm.com>wrote:

> I am not looking at the trunk.  I am just a user looking at the interface
> documented on the web site and wondering why the atomic composite
> functionality is so limited.  It is not hard to imagine an expanded
> interface that allows checking an arbitrary set of columns and, if each
> has a value specified for it, doing an arbitrary set of Mutations.
>
> Thanks,
> Mike
>
>
>
> From:   Ted Yu <yu...@gmail.com>
> To:     user@hbase.apache.org
> Date:   11/17/2012 11:44 PM
> Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?
>
>
>
> Are you looking at trunk code ?
>
> In trunk, take a look at HRegion.checkAndMutate() where you can specify
> ByteArrayComparable which does the comparison (matching).
> There is still the limit of single value:
>         } else if (result.size() == 1 && !valueIsNull) {
>           KeyValue kv = result.get(0);
>
> For the moment, only Put and Delete are supported:
>
>     if (!isPut && !(w instanceof Delete))
>       throw new DoNotRetryIOException("Action must be Put or Delete");
> If you have suggestion on how the check part can be more general, please
> comment.
>
> Thanks
>
> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com>
> wrote:
>
> > If I understand correctly, an HTable has two composite atomic
> operations,
> > checkAndPut and checkAndDelete.  The check part checks just a single
> > column's value.  Why not allow checking more than one column?
> >
> > Why no checkAndAppend?
> >
> > The checkAndPut operation can put to multiple columns, right?  And the
> > checkAndDelete operation can delete multiple columns, right?  Why not
> let
> > them be mixed?  Why not checkAndMutate?
> >
> > Thanks!
> > Mike
>
>

Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Michael Segel <mi...@hotmail.com>.
Which is what I mean when I ask what you mean by an append.  :-)


On Nov 19, 2012, at 11:01 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:

> I do not know what you mean about HBase not supporting appends.  I see 
> this:
> 
> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#append%28org.apache.hadoop.hbase.client.Append%29
> 
> However, the point of my question is not specific to appends.  I am asking 
> why HBase does not have checkMany-and-mutateMany.
> 
> Thanks,
> Mike
> 
> 
> 
> From:   Michael Segel <mi...@hotmail.com>
> To:     user@hbase.apache.org
> Date:   11/19/2012 11:54 AM
> Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?
> 
> 
> 
> Mike, 
> 
> What I am asking is how you define an append in a system that doesn't 
> support appends. 
> 
> I'm trying to understand what it is that you wish to achieve. 
> 
> To give you an answer which you will probably not like... HBase is still 
> very primitive in terms of a full feature functionality. 
> 
> 
> On Nov 19, 2012, at 10:19 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:
> 
>> If you are asking why the HBase API has appends as well as puts, I am 
> not 
>> going to play the expert here.  Either there is a good reason for it, or 
> 
>> not.
>> 
>> My goal in this line of questioning is to understand why there is not a 
>> more comprehensive composite atomic operation available.  If there is a 
>> good reason for the API to include appends, then that reason applies 
> here. 
>> If there is no such reason, then you may ignore the appends in my 
>> question.
>> 
>> Thanks,
>> Mike
>> 
>> 
>> 
>> From:   Michael Segel <mi...@hotmail.com>
>> To:     user@hbase.apache.org
>> Date:   11/18/2012 03:15 PM
>> Subject:        Re: Why only check1-and-putMany and 
> check1-and-deleteMany?
>> 
>> 
>> 
>> Ok, maybe this is a silly question on my part.... 
>> 
>> Could you define what you mean by check and append? 
>> With respect to HBase, how would that be different from check and put? 
>> 
>> 
>> On Nov 18, 2012, at 12:28 AM, Mike Spreitzer <ms...@us.ibm.com> 
> wrote:
>> 
>>> I am not looking at the trunk.  I am just a user looking at the 
>> interface 
>>> documented on the web site and wondering why the atomic composite 
>>> functionality is so limited.  It is not hard to imagine an expanded 
>>> interface that allows checking an arbitrary set of columns and, if each 
> 
>>> has a value specified for it, doing an arbitrary set of Mutations.
>>> 
>>> Thanks,
>>> Mike
>>> 
>>> 
>>> 
>>> From:   Ted Yu <yu...@gmail.com>
>>> To:     user@hbase.apache.org
>>> Date:   11/17/2012 11:44 PM
>>> Subject:        Re: Why only check1-and-putMany and 
>> check1-and-deleteMany?
>>> 
>>> 
>>> 
>>> Are you looking at trunk code ?
>>> 
>>> In trunk, take a look at HRegion.checkAndMutate() where you can specify
>>> ByteArrayComparable which does the comparison (matching).
>>> There is still the limit of single value:
>>>      } else if (result.size() == 1 && !valueIsNull) {
>>>        KeyValue kv = result.get(0);
>>> 
>>> For the moment, only Put and Delete are supported:
>>> 
>>>  if (!isPut && !(w instanceof Delete))
>>>    throw new DoNotRetryIOException("Action must be Put or Delete");
>>> If you have suggestion on how the check part can be more general, 
> please
>>> comment.
>>> 
>>> Thanks
>>> 
>>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> 
>>> wrote:
>>> 
>>>> If I understand correctly, an HTable has two composite atomic 
>>> operations,
>>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>>> column's value.  Why not allow checking more than one column?
>>>> 
>>>> Why no checkAndAppend?
>>>> 
>>>> The checkAndPut operation can put to multiple columns, right?  And the
>>>> checkAndDelete operation can delete multiple columns, right?  Why not 
>>> let
>>>> them be mixed?  Why not checkAndMutate?
>>>> 
>>>> Thanks!
>>>> Mike
>>> 
>> 
>> 
> 
> 


Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Mike Spreitzer <ms...@us.ibm.com>.
I do not know what you mean about HBase not supporting appends.  I see 
this:

http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTableInterface.html#append%28org.apache.hadoop.hbase.client.Append%29

However, the point of my question is not specific to appends.  I am asking 
why HBase does not have checkMany-and-mutateMany.

Thanks,
Mike



From:   Michael Segel <mi...@hotmail.com>
To:     user@hbase.apache.org
Date:   11/19/2012 11:54 AM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



Mike, 

What I am asking is how you define an append in a system that doesn't 
support appends. 

I'm trying to understand what it is that you wish to achieve. 

To give you an answer which you will probably not like... HBase is still 
very primitive in terms of a full feature functionality. 


On Nov 19, 2012, at 10:19 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:

> If you are asking why the HBase API has appends as well as puts, I am 
not 
> going to play the expert here.  Either there is a good reason for it, or 

> not.
> 
> My goal in this line of questioning is to understand why there is not a 
> more comprehensive composite atomic operation available.  If there is a 
> good reason for the API to include appends, then that reason applies 
here. 
> If there is no such reason, then you may ignore the appends in my 
> question.
> 
> Thanks,
> Mike
> 
> 
> 
> From:   Michael Segel <mi...@hotmail.com>
> To:     user@hbase.apache.org
> Date:   11/18/2012 03:15 PM
> Subject:        Re: Why only check1-and-putMany and 
check1-and-deleteMany?
> 
> 
> 
> Ok, maybe this is a silly question on my part.... 
> 
> Could you define what you mean by check and append? 
> With respect to HBase, how would that be different from check and put? 
> 
> 
> On Nov 18, 2012, at 12:28 AM, Mike Spreitzer <ms...@us.ibm.com> 
wrote:
> 
>> I am not looking at the trunk.  I am just a user looking at the 
> interface 
>> documented on the web site and wondering why the atomic composite 
>> functionality is so limited.  It is not hard to imagine an expanded 
>> interface that allows checking an arbitrary set of columns and, if each 

>> has a value specified for it, doing an arbitrary set of Mutations.
>> 
>> Thanks,
>> Mike
>> 
>> 
>> 
>> From:   Ted Yu <yu...@gmail.com>
>> To:     user@hbase.apache.org
>> Date:   11/17/2012 11:44 PM
>> Subject:        Re: Why only check1-and-putMany and 
> check1-and-deleteMany?
>> 
>> 
>> 
>> Are you looking at trunk code ?
>> 
>> In trunk, take a look at HRegion.checkAndMutate() where you can specify
>> ByteArrayComparable which does the comparison (matching).
>> There is still the limit of single value:
>>       } else if (result.size() == 1 && !valueIsNull) {
>>         KeyValue kv = result.get(0);
>> 
>> For the moment, only Put and Delete are supported:
>> 
>>   if (!isPut && !(w instanceof Delete))
>>     throw new DoNotRetryIOException("Action must be Put or Delete");
>> If you have suggestion on how the check part can be more general, 
please
>> comment.
>> 
>> Thanks
>> 
>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> 
>> wrote:
>> 
>>> If I understand correctly, an HTable has two composite atomic 
>> operations,
>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>> column's value.  Why not allow checking more than one column?
>>> 
>>> Why no checkAndAppend?
>>> 
>>> The checkAndPut operation can put to multiple columns, right?  And the
>>> checkAndDelete operation can delete multiple columns, right?  Why not 
>> let
>>> them be mixed?  Why not checkAndMutate?
>>> 
>>> Thanks!
>>> Mike
>> 
> 
> 



Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Michael Segel <mi...@hotmail.com>.
Mike, 

What I am asking is how you define an append in a system that doesn't support appends. 

I'm trying to understand what it is that you wish to achieve. 

To give you an answer which you will probably not like... HBase is still very primitive in terms of a full feature functionality. 


On Nov 19, 2012, at 10:19 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:

> If you are asking why the HBase API has appends as well as puts, I am not 
> going to play the expert here.  Either there is a good reason for it, or 
> not.
> 
> My goal in this line of questioning is to understand why there is not a 
> more comprehensive composite atomic operation available.  If there is a 
> good reason for the API to include appends, then that reason applies here. 
> If there is no such reason, then you may ignore the appends in my 
> question.
> 
> Thanks,
> Mike
> 
> 
> 
> From:   Michael Segel <mi...@hotmail.com>
> To:     user@hbase.apache.org
> Date:   11/18/2012 03:15 PM
> Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?
> 
> 
> 
> Ok, maybe this is a silly question on my part.... 
> 
> Could you define what you mean by check and append? 
> With respect to HBase, how would that be different from check and put? 
> 
> 
> On Nov 18, 2012, at 12:28 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:
> 
>> I am not looking at the trunk.  I am just a user looking at the 
> interface 
>> documented on the web site and wondering why the atomic composite 
>> functionality is so limited.  It is not hard to imagine an expanded 
>> interface that allows checking an arbitrary set of columns and, if each 
>> has a value specified for it, doing an arbitrary set of Mutations.
>> 
>> Thanks,
>> Mike
>> 
>> 
>> 
>> From:   Ted Yu <yu...@gmail.com>
>> To:     user@hbase.apache.org
>> Date:   11/17/2012 11:44 PM
>> Subject:        Re: Why only check1-and-putMany and 
> check1-and-deleteMany?
>> 
>> 
>> 
>> Are you looking at trunk code ?
>> 
>> In trunk, take a look at HRegion.checkAndMutate() where you can specify
>> ByteArrayComparable which does the comparison (matching).
>> There is still the limit of single value:
>>       } else if (result.size() == 1 && !valueIsNull) {
>>         KeyValue kv = result.get(0);
>> 
>> For the moment, only Put and Delete are supported:
>> 
>>   if (!isPut && !(w instanceof Delete))
>>     throw new DoNotRetryIOException("Action must be Put or Delete");
>> If you have suggestion on how the check part can be more general, please
>> comment.
>> 
>> Thanks
>> 
>> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> 
>> wrote:
>> 
>>> If I understand correctly, an HTable has two composite atomic 
>> operations,
>>> checkAndPut and checkAndDelete.  The check part checks just a single
>>> column's value.  Why not allow checking more than one column?
>>> 
>>> Why no checkAndAppend?
>>> 
>>> The checkAndPut operation can put to multiple columns, right?  And the
>>> checkAndDelete operation can delete multiple columns, right?  Why not 
>> let
>>> them be mixed?  Why not checkAndMutate?
>>> 
>>> Thanks!
>>> Mike
>> 
> 
> 


Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Mike Spreitzer <ms...@us.ibm.com>.
If you are asking why the HBase API has appends as well as puts, I am not 
going to play the expert here.  Either there is a good reason for it, or 
not.

My goal in this line of questioning is to understand why there is not a 
more comprehensive composite atomic operation available.  If there is a 
good reason for the API to include appends, then that reason applies here. 
 If there is no such reason, then you may ignore the appends in my 
question.

Thanks,
Mike



From:   Michael Segel <mi...@hotmail.com>
To:     user@hbase.apache.org
Date:   11/18/2012 03:15 PM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



Ok, maybe this is a silly question on my part.... 

Could you define what you mean by check and append? 
With respect to HBase, how would that be different from check and put? 


On Nov 18, 2012, at 12:28 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:

> I am not looking at the trunk.  I am just a user looking at the 
interface 
> documented on the web site and wondering why the atomic composite 
> functionality is so limited.  It is not hard to imagine an expanded 
> interface that allows checking an arbitrary set of columns and, if each 
> has a value specified for it, doing an arbitrary set of Mutations.
> 
> Thanks,
> Mike
> 
> 
> 
> From:   Ted Yu <yu...@gmail.com>
> To:     user@hbase.apache.org
> Date:   11/17/2012 11:44 PM
> Subject:        Re: Why only check1-and-putMany and 
check1-and-deleteMany?
> 
> 
> 
> Are you looking at trunk code ?
> 
> In trunk, take a look at HRegion.checkAndMutate() where you can specify
> ByteArrayComparable which does the comparison (matching).
> There is still the limit of single value:
>        } else if (result.size() == 1 && !valueIsNull) {
>          KeyValue kv = result.get(0);
> 
> For the moment, only Put and Delete are supported:
> 
>    if (!isPut && !(w instanceof Delete))
>      throw new DoNotRetryIOException("Action must be Put or Delete");
> If you have suggestion on how the check part can be more general, please
> comment.
> 
> Thanks
> 
> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> 
> wrote:
> 
>> If I understand correctly, an HTable has two composite atomic 
> operations,
>> checkAndPut and checkAndDelete.  The check part checks just a single
>> column's value.  Why not allow checking more than one column?
>> 
>> Why no checkAndAppend?
>> 
>> The checkAndPut operation can put to multiple columns, right?  And the
>> checkAndDelete operation can delete multiple columns, right?  Why not 
> let
>> them be mixed?  Why not checkAndMutate?
>> 
>> Thanks!
>> Mike
> 



Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Michael Segel <mi...@hotmail.com>.
Ok, maybe this is a silly question on my part.... 

Could you define what you mean by check and append? 
With respect to HBase, how would that be different from check and put? 


On Nov 18, 2012, at 12:28 AM, Mike Spreitzer <ms...@us.ibm.com> wrote:

> I am not looking at the trunk.  I am just a user looking at the interface 
> documented on the web site and wondering why the atomic composite 
> functionality is so limited.  It is not hard to imagine an expanded 
> interface that allows checking an arbitrary set of columns and, if each 
> has a value specified for it, doing an arbitrary set of Mutations.
> 
> Thanks,
> Mike
> 
> 
> 
> From:   Ted Yu <yu...@gmail.com>
> To:     user@hbase.apache.org
> Date:   11/17/2012 11:44 PM
> Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?
> 
> 
> 
> Are you looking at trunk code ?
> 
> In trunk, take a look at HRegion.checkAndMutate() where you can specify
> ByteArrayComparable which does the comparison (matching).
> There is still the limit of single value:
>        } else if (result.size() == 1 && !valueIsNull) {
>          KeyValue kv = result.get(0);
> 
> For the moment, only Put and Delete are supported:
> 
>    if (!isPut && !(w instanceof Delete))
>      throw new DoNotRetryIOException("Action must be Put or Delete");
> If you have suggestion on how the check part can be more general, please
> comment.
> 
> Thanks
> 
> On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> 
> wrote:
> 
>> If I understand correctly, an HTable has two composite atomic 
> operations,
>> checkAndPut and checkAndDelete.  The check part checks just a single
>> column's value.  Why not allow checking more than one column?
>> 
>> Why no checkAndAppend?
>> 
>> The checkAndPut operation can put to multiple columns, right?  And the
>> checkAndDelete operation can delete multiple columns, right?  Why not 
> let
>> them be mixed?  Why not checkAndMutate?
>> 
>> Thanks!
>> Mike
> 


Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Mike Spreitzer <ms...@us.ibm.com>.
I am not looking at the trunk.  I am just a user looking at the interface 
documented on the web site and wondering why the atomic composite 
functionality is so limited.  It is not hard to imagine an expanded 
interface that allows checking an arbitrary set of columns and, if each 
has a value specified for it, doing an arbitrary set of Mutations.

Thanks,
Mike



From:   Ted Yu <yu...@gmail.com>
To:     user@hbase.apache.org
Date:   11/17/2012 11:44 PM
Subject:        Re: Why only check1-and-putMany and check1-and-deleteMany?



Are you looking at trunk code ?

In trunk, take a look at HRegion.checkAndMutate() where you can specify
ByteArrayComparable which does the comparison (matching).
There is still the limit of single value:
        } else if (result.size() == 1 && !valueIsNull) {
          KeyValue kv = result.get(0);

For the moment, only Put and Delete are supported:

    if (!isPut && !(w instanceof Delete))
      throw new DoNotRetryIOException("Action must be Put or Delete");
If you have suggestion on how the check part can be more general, please
comment.

Thanks

On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> 
wrote:

> If I understand correctly, an HTable has two composite atomic 
operations,
> checkAndPut and checkAndDelete.  The check part checks just a single
> column's value.  Why not allow checking more than one column?
>
> Why no checkAndAppend?
>
> The checkAndPut operation can put to multiple columns, right?  And the
> checkAndDelete operation can delete multiple columns, right?  Why not 
let
> them be mixed?  Why not checkAndMutate?
>
> Thanks!
> Mike


Re: Why only check1-and-putMany and check1-and-deleteMany?

Posted by Ted Yu <yu...@gmail.com>.
Are you looking at trunk code ?

In trunk, take a look at HRegion.checkAndMutate() where you can specify
ByteArrayComparable which does the comparison (matching).
There is still the limit of single value:
        } else if (result.size() == 1 && !valueIsNull) {
          KeyValue kv = result.get(0);

For the moment, only Put and Delete are supported:

    if (!isPut && !(w instanceof Delete))
      throw new DoNotRetryIOException("Action must be Put or Delete");
If you have suggestion on how the check part can be more general, please
comment.

Thanks

On Sat, Nov 17, 2012 at 7:30 PM, Mike Spreitzer <ms...@us.ibm.com> wrote:

> If I understand correctly, an HTable has two composite atomic operations,
> checkAndPut and checkAndDelete.  The check part checks just a single
> column's value.  Why not allow checking more than one column?
>
> Why no checkAndAppend?
>
> The checkAndPut operation can put to multiple columns, right?  And the
> checkAndDelete operation can delete multiple columns, right?  Why not let
> them be mixed?  Why not checkAndMutate?
>
> Thanks!
> Mike