You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by "Yakubovich, Alexey" <Al...@searshc.com> on 2016/01/25 21:40:59 UTC
HBase atomic update
I am trying to master HBase, and vuala, I discover that so nice API components:
checkAndPut, checkAndDelete, Increment, Append (HTable)
Or may be not so nice? So e.g. checkAndPut can atomically update the specified cell.
But what if I want to update two cells (from one row) in one atomic operation? What if it’s two cells from two different rows, but in need to be updated atomically?
What is the best way to achieve that?
Thank you
Alexey
This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.
Re: HBase atomic update
Posted by Ted Yu <yu...@gmail.com>.
bq. I still can do with with coprocessor
Please take a look at the following methods in BaseRegionObserver:
public boolean preCheckAndPut(final
ObserverContext<RegionCoprocessorEnvironment> e,
public boolean preCheckAndPutAfterRowLock(
FYI
On Tue, Jan 26, 2016 at 1:52 PM, Yakubovich, Alexey <
Alexey.Yakubovich@searshc.com> wrote:
> Thank you. But what is the meaning of “HRegion is on server side”? Does it
> means that I can’t obtain the instance of HRegion in my java client
> program and so I can’t use the method checkAndMutate with comparator?
> Or may be I still can do with with coprocessor?
>
> On 1/26/16, 2:51 PM, "Ted Yu" <yu...@gmail.com> wrote:
>
> >From Connection, you can call:
> >
> > public RegionLocator getRegionLocator(TableName tableName) throws
> >IOException;
> >
> >RegionLocator has this method:
> >
> > public HRegionLocation getRegionLocation(final byte [] row) throws
> >IOException;
> >
> >HRegionLocation has:
> >
> > public HRegionInfo getRegionInfo(){
> >
> > return regionInfo;
> >
> >
> >However, HRegion is on server side.
> >
> >
> >FYI
> >
> >On Tue, Jan 26, 2016 at 12:17 PM, Yakubovich, Alexey <
> >Alexey.Yakubovich@searshc.com> wrote:
> >
> >> Great, it looks as exactly what I need. Thank you very much.
> >> If only I new how to get HRegion object for my row and table. I can get
> >> HRegionLocation,HRegionInfo, but … how to get an HRegion object instance
> >> for the given HTable and row…
> >>
> >>
> >>
> >>
> >> On 1/26/16, 1:05 PM, "Ted Yu" <yu...@gmail.com> wrote:
> >>
> >> >bq. can you completely customize
> >> >
> >> >Please take a look at HRegion#checkAndMutate() - you would get better
> >> >idea.
> >> >
> >> >FYI
> >> >
> >> >On Tue, Jan 26, 2016 at 9:21 AM, Yakubovich, Alexey <
> >> >Alexey.Yakubovich@searshc.com> wrote:
> >> >
> >> >> Actually a found another question (HBase : Check and Put method used
> >> >>with
> >> >> a long). That is also my question. I mean by design, can you use in
> >> >> checkAndPut with CompareFilter.CompareOp to conditionally update (in
> >>my
> >> >> case, with CompareFilter.CompareOp.GREATER enum value) for int? Or
> >>even
> >> >> better, can you completely customize (within reasonable
> >>restrictions))
> >> >>the
> >> >> condition for the atomic update?
> >> >>
> >> >> On 1/26/16, 9:52 AM, "Ted Yu" <yu...@gmail.com> wrote:
> >> >>
> >> >> >As long as C1 and C2 are updated using one checkAndPut() call, it
> >> >>should
> >> >> >work.
> >> >> >
> >> >> >On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
> >> >> >Alexey.Yakubovich@searshc.com> wrote:
> >> >> >
> >> >> >> Thank you Ted.
> >> >> >> You are right it should works. Concerning condition when it can be
> >> >> >> necessary: one case is when several (spark) executors can update
> >>the
> >> >> >>same
> >> >> >> row with two int cells: C1 and C2, representing a range. Then C1
> >> >>Should
> >> >> >>be
> >> >> >> always <= C2. But without synch between executors, the data
> >>integrity
> >> >> >>can
> >> >> >> be broken.
> >> >> >> Thanks again
> >> >> >>
> >> >> >> + something), and data integrity for instance require
> >> >> >> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
> >> >> >>
> >> >> >> >bq. what if I want to update two cells (from one row) in one
> >>atomic
> >> >> >> >operation
> >> >> >> >
> >> >> >> >Can you clarify the condition on which the update should be
> >> >>performed ?
> >> >> >> >Meaning, do you want to compare with one column or compare with
> >>two
> >> >> >> >columns
> >> >> >> >?
> >> >> >> >
> >> >> >> >If you want to compare with one column and update the row
> >>depending
> >> >>on
> >> >> >> >result of the comparison, you can call addColumn() of Put twice
> >>(for
> >> >> >>the
> >> >> >> >two columns, respectively) and pass the Put to checkAndPut().
> >> >> >> >
> >> >> >> >Cheers
> >> >> >> >
> >> >> >> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
> >> >> >> >Alexey.Yakubovich@searshc.com> wrote:
> >> >> >> >
> >> >> >> >> I am trying to master HBase, and vuala, I discover that so nice
> >> >>API
> >> >> >> >> components:
> >> >> >> >>
> >> >> >> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
> >> >> >> >>
> >> >> >> >> Or may be not so nice? So e.g. checkAndPut can atomically
> >>update
> >> >>the
> >> >> >> >> specified cell.
> >> >> >> >> But what if I want to update two cells (from one row) in one
> >> >>atomic
> >> >> >> >> operation? What if it易s two cells from two different rows, but
> >>in
> >> >> >>need
> >> >> >> >>to
> >> >> >> >> be updated atomically?
> >> >> >> >>
> >> >> >> >> What is the best way to achieve that?
> >> >> >> >>
> >> >> >> >> Thank you
> >> >> >> >> Alexey
> >> >> >> >>
> >> >> >> >> This message, including any attachments, is the property of
> >>Sears
> >> >> >> >>Holdings
> >> >> >> >> Corporation and/or one of its subsidiaries. It is confidential
> >>and
> >> >> >>may
> >> >> >> >> contain proprietary or legally privileged information. If you
> >>are
> >> >>not
> >> >> >> >>the
> >> >> >> >> intended recipient, please delete it without reading the
> >>contents.
> >> >> >>Thank
> >> >> >> >> you.
> >> >> >> >>
> >> >> >>
> >> >> >> This message, including any attachments, is the property of Sears
> >> >> >>Holdings
> >> >> >> Corporation and/or one of its subsidiaries. It is confidential and
> >> >>may
> >> >> >> contain proprietary or legally privileged information. If you are
> >>not
> >> >> >>the
> >> >> >> intended recipient, please delete it without reading the contents.
> >> >>Thank
> >> >> >> you.
> >> >> >>
> >> >>
> >> >>
> >> >> This message, including any attachments, is the property of Sears
> >> >>Holdings
> >> >> Corporation and/or one of its subsidiaries. It is confidential and
> >>may
> >> >> contain proprietary or legally privileged information. If you are not
> >> >>the
> >> >> intended recipient, please delete it without reading the contents.
> >>Thank
> >> >> you.
> >> >>
> >>
> >> This message, including any attachments, is the property of Sears
> >>Holdings
> >> Corporation and/or one of its subsidiaries. It is confidential and may
> >> contain proprietary or legally privileged information. If you are not
> >>the
> >> intended recipient, please delete it without reading the contents. Thank
> >> you.
>
> This message, including any attachments, is the property of Sears Holdings
> Corporation and/or one of its subsidiaries. It is confidential and may
> contain proprietary or legally privileged information. If you are not the
> intended recipient, please delete it without reading the contents. Thank
> you.
>
Re: HBase atomic update
Posted by "Yakubovich, Alexey" <Al...@searshc.com>.
Thank you. But what is the meaning of “HRegion is on server side”? Does it
means that I can’t obtain the instance of HRegion in my java client
program and so I can’t use the method checkAndMutate with comparator?
Or may be I still can do with with coprocessor?
On 1/26/16, 2:51 PM, "Ted Yu" <yu...@gmail.com> wrote:
>From Connection, you can call:
>
> public RegionLocator getRegionLocator(TableName tableName) throws
>IOException;
>
>RegionLocator has this method:
>
> public HRegionLocation getRegionLocation(final byte [] row) throws
>IOException;
>
>HRegionLocation has:
>
> public HRegionInfo getRegionInfo(){
>
> return regionInfo;
>
>
>However, HRegion is on server side.
>
>
>FYI
>
>On Tue, Jan 26, 2016 at 12:17 PM, Yakubovich, Alexey <
>Alexey.Yakubovich@searshc.com> wrote:
>
>> Great, it looks as exactly what I need. Thank you very much.
>> If only I new how to get HRegion object for my row and table. I can get
>> HRegionLocation,HRegionInfo, but … how to get an HRegion object instance
>> for the given HTable and row…
>>
>>
>>
>>
>> On 1/26/16, 1:05 PM, "Ted Yu" <yu...@gmail.com> wrote:
>>
>> >bq. can you completely customize
>> >
>> >Please take a look at HRegion#checkAndMutate() - you would get better
>> >idea.
>> >
>> >FYI
>> >
>> >On Tue, Jan 26, 2016 at 9:21 AM, Yakubovich, Alexey <
>> >Alexey.Yakubovich@searshc.com> wrote:
>> >
>> >> Actually a found another question (HBase : Check and Put method used
>> >>with
>> >> a long). That is also my question. I mean by design, can you use in
>> >> checkAndPut with CompareFilter.CompareOp to conditionally update (in
>>my
>> >> case, with CompareFilter.CompareOp.GREATER enum value) for int? Or
>>even
>> >> better, can you completely customize (within reasonable
>>restrictions))
>> >>the
>> >> condition for the atomic update?
>> >>
>> >> On 1/26/16, 9:52 AM, "Ted Yu" <yu...@gmail.com> wrote:
>> >>
>> >> >As long as C1 and C2 are updated using one checkAndPut() call, it
>> >>should
>> >> >work.
>> >> >
>> >> >On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
>> >> >Alexey.Yakubovich@searshc.com> wrote:
>> >> >
>> >> >> Thank you Ted.
>> >> >> You are right it should works. Concerning condition when it can be
>> >> >> necessary: one case is when several (spark) executors can update
>>the
>> >> >>same
>> >> >> row with two int cells: C1 and C2, representing a range. Then C1
>> >>Should
>> >> >>be
>> >> >> always <= C2. But without synch between executors, the data
>>integrity
>> >> >>can
>> >> >> be broken.
>> >> >> Thanks again
>> >> >>
>> >> >> + something), and data integrity for instance require
>> >> >> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
>> >> >>
>> >> >> >bq. what if I want to update two cells (from one row) in one
>>atomic
>> >> >> >operation
>> >> >> >
>> >> >> >Can you clarify the condition on which the update should be
>> >>performed ?
>> >> >> >Meaning, do you want to compare with one column or compare with
>>two
>> >> >> >columns
>> >> >> >?
>> >> >> >
>> >> >> >If you want to compare with one column and update the row
>>depending
>> >>on
>> >> >> >result of the comparison, you can call addColumn() of Put twice
>>(for
>> >> >>the
>> >> >> >two columns, respectively) and pass the Put to checkAndPut().
>> >> >> >
>> >> >> >Cheers
>> >> >> >
>> >> >> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
>> >> >> >Alexey.Yakubovich@searshc.com> wrote:
>> >> >> >
>> >> >> >> I am trying to master HBase, and vuala, I discover that so nice
>> >>API
>> >> >> >> components:
>> >> >> >>
>> >> >> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
>> >> >> >>
>> >> >> >> Or may be not so nice? So e.g. checkAndPut can atomically
>>update
>> >>the
>> >> >> >> specified cell.
>> >> >> >> But what if I want to update two cells (from one row) in one
>> >>atomic
>> >> >> >> operation? What if it易s two cells from two different rows, but
>>in
>> >> >>need
>> >> >> >>to
>> >> >> >> be updated atomically?
>> >> >> >>
>> >> >> >> What is the best way to achieve that?
>> >> >> >>
>> >> >> >> Thank you
>> >> >> >> Alexey
>> >> >> >>
>> >> >> >> This message, including any attachments, is the property of
>>Sears
>> >> >> >>Holdings
>> >> >> >> Corporation and/or one of its subsidiaries. It is confidential
>>and
>> >> >>may
>> >> >> >> contain proprietary or legally privileged information. If you
>>are
>> >>not
>> >> >> >>the
>> >> >> >> intended recipient, please delete it without reading the
>>contents.
>> >> >>Thank
>> >> >> >> you.
>> >> >> >>
>> >> >>
>> >> >> This message, including any attachments, is the property of Sears
>> >> >>Holdings
>> >> >> Corporation and/or one of its subsidiaries. It is confidential and
>> >>may
>> >> >> contain proprietary or legally privileged information. If you are
>>not
>> >> >>the
>> >> >> intended recipient, please delete it without reading the contents.
>> >>Thank
>> >> >> you.
>> >> >>
>> >>
>> >>
>> >> This message, including any attachments, is the property of Sears
>> >>Holdings
>> >> Corporation and/or one of its subsidiaries. It is confidential and
>>may
>> >> contain proprietary or legally privileged information. If you are not
>> >>the
>> >> intended recipient, please delete it without reading the contents.
>>Thank
>> >> you.
>> >>
>>
>> This message, including any attachments, is the property of Sears
>>Holdings
>> Corporation and/or one of its subsidiaries. It is confidential and may
>> contain proprietary or legally privileged information. If you are not
>>the
>> intended recipient, please delete it without reading the contents. Thank
>> you.
This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.
Re: HBase atomic update
Posted by Ted Yu <yu...@gmail.com>.
>From Connection, you can call:
public RegionLocator getRegionLocator(TableName tableName) throws
IOException;
RegionLocator has this method:
public HRegionLocation getRegionLocation(final byte [] row) throws
IOException;
HRegionLocation has:
public HRegionInfo getRegionInfo(){
return regionInfo;
However, HRegion is on server side.
FYI
On Tue, Jan 26, 2016 at 12:17 PM, Yakubovich, Alexey <
Alexey.Yakubovich@searshc.com> wrote:
> Great, it looks as exactly what I need. Thank you very much.
> If only I new how to get HRegion object for my row and table. I can get
> HRegionLocation,HRegionInfo, but … how to get an HRegion object instance
> for the given HTable and row…
>
>
>
>
> On 1/26/16, 1:05 PM, "Ted Yu" <yu...@gmail.com> wrote:
>
> >bq. can you completely customize
> >
> >Please take a look at HRegion#checkAndMutate() - you would get better
> >idea.
> >
> >FYI
> >
> >On Tue, Jan 26, 2016 at 9:21 AM, Yakubovich, Alexey <
> >Alexey.Yakubovich@searshc.com> wrote:
> >
> >> Actually a found another question (HBase : Check and Put method used
> >>with
> >> a long). That is also my question. I mean by design, can you use in
> >> checkAndPut with CompareFilter.CompareOp to conditionally update (in my
> >> case, with CompareFilter.CompareOp.GREATER enum value) for int? Or even
> >> better, can you completely customize (within reasonable restrictions))
> >>the
> >> condition for the atomic update?
> >>
> >> On 1/26/16, 9:52 AM, "Ted Yu" <yu...@gmail.com> wrote:
> >>
> >> >As long as C1 and C2 are updated using one checkAndPut() call, it
> >>should
> >> >work.
> >> >
> >> >On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
> >> >Alexey.Yakubovich@searshc.com> wrote:
> >> >
> >> >> Thank you Ted.
> >> >> You are right it should works. Concerning condition when it can be
> >> >> necessary: one case is when several (spark) executors can update the
> >> >>same
> >> >> row with two int cells: C1 and C2, representing a range. Then C1
> >>Should
> >> >>be
> >> >> always <= C2. But without synch between executors, the data integrity
> >> >>can
> >> >> be broken.
> >> >> Thanks again
> >> >>
> >> >> + something), and data integrity for instance require
> >> >> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
> >> >>
> >> >> >bq. what if I want to update two cells (from one row) in one atomic
> >> >> >operation
> >> >> >
> >> >> >Can you clarify the condition on which the update should be
> >>performed ?
> >> >> >Meaning, do you want to compare with one column or compare with two
> >> >> >columns
> >> >> >?
> >> >> >
> >> >> >If you want to compare with one column and update the row depending
> >>on
> >> >> >result of the comparison, you can call addColumn() of Put twice (for
> >> >>the
> >> >> >two columns, respectively) and pass the Put to checkAndPut().
> >> >> >
> >> >> >Cheers
> >> >> >
> >> >> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
> >> >> >Alexey.Yakubovich@searshc.com> wrote:
> >> >> >
> >> >> >> I am trying to master HBase, and vuala, I discover that so nice
> >>API
> >> >> >> components:
> >> >> >>
> >> >> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
> >> >> >>
> >> >> >> Or may be not so nice? So e.g. checkAndPut can atomically update
> >>the
> >> >> >> specified cell.
> >> >> >> But what if I want to update two cells (from one row) in one
> >>atomic
> >> >> >> operation? What if it易s two cells from two different rows, but in
> >> >>need
> >> >> >>to
> >> >> >> be updated atomically?
> >> >> >>
> >> >> >> What is the best way to achieve that?
> >> >> >>
> >> >> >> Thank you
> >> >> >> Alexey
> >> >> >>
> >> >> >> This message, including any attachments, is the property of Sears
> >> >> >>Holdings
> >> >> >> Corporation and/or one of its subsidiaries. It is confidential and
> >> >>may
> >> >> >> contain proprietary or legally privileged information. If you are
> >>not
> >> >> >>the
> >> >> >> intended recipient, please delete it without reading the contents.
> >> >>Thank
> >> >> >> you.
> >> >> >>
> >> >>
> >> >> This message, including any attachments, is the property of Sears
> >> >>Holdings
> >> >> Corporation and/or one of its subsidiaries. It is confidential and
> >>may
> >> >> contain proprietary or legally privileged information. If you are not
> >> >>the
> >> >> intended recipient, please delete it without reading the contents.
> >>Thank
> >> >> you.
> >> >>
> >>
> >>
> >> This message, including any attachments, is the property of Sears
> >>Holdings
> >> Corporation and/or one of its subsidiaries. It is confidential and may
> >> contain proprietary or legally privileged information. If you are not
> >>the
> >> intended recipient, please delete it without reading the contents. Thank
> >> you.
> >>
>
> This message, including any attachments, is the property of Sears Holdings
> Corporation and/or one of its subsidiaries. It is confidential and may
> contain proprietary or legally privileged information. If you are not the
> intended recipient, please delete it without reading the contents. Thank
> you.
>
Re: HBase atomic update
Posted by "Yakubovich, Alexey" <Al...@searshc.com>.
Great, it looks as exactly what I need. Thank you very much.
If only I new how to get HRegion object for my row and table. I can get
HRegionLocation,HRegionInfo, but … how to get an HRegion object instance
for the given HTable and row…
On 1/26/16, 1:05 PM, "Ted Yu" <yu...@gmail.com> wrote:
>bq. can you completely customize
>
>Please take a look at HRegion#checkAndMutate() - you would get better
>idea.
>
>FYI
>
>On Tue, Jan 26, 2016 at 9:21 AM, Yakubovich, Alexey <
>Alexey.Yakubovich@searshc.com> wrote:
>
>> Actually a found another question (HBase : Check and Put method used
>>with
>> a long). That is also my question. I mean by design, can you use in
>> checkAndPut with CompareFilter.CompareOp to conditionally update (in my
>> case, with CompareFilter.CompareOp.GREATER enum value) for int? Or even
>> better, can you completely customize (within reasonable restrictions))
>>the
>> condition for the atomic update?
>>
>> On 1/26/16, 9:52 AM, "Ted Yu" <yu...@gmail.com> wrote:
>>
>> >As long as C1 and C2 are updated using one checkAndPut() call, it
>>should
>> >work.
>> >
>> >On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
>> >Alexey.Yakubovich@searshc.com> wrote:
>> >
>> >> Thank you Ted.
>> >> You are right it should works. Concerning condition when it can be
>> >> necessary: one case is when several (spark) executors can update the
>> >>same
>> >> row with two int cells: C1 and C2, representing a range. Then C1
>>Should
>> >>be
>> >> always <= C2. But without synch between executors, the data integrity
>> >>can
>> >> be broken.
>> >> Thanks again
>> >>
>> >> + something), and data integrity for instance require
>> >> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
>> >>
>> >> >bq. what if I want to update two cells (from one row) in one atomic
>> >> >operation
>> >> >
>> >> >Can you clarify the condition on which the update should be
>>performed ?
>> >> >Meaning, do you want to compare with one column or compare with two
>> >> >columns
>> >> >?
>> >> >
>> >> >If you want to compare with one column and update the row depending
>>on
>> >> >result of the comparison, you can call addColumn() of Put twice (for
>> >>the
>> >> >two columns, respectively) and pass the Put to checkAndPut().
>> >> >
>> >> >Cheers
>> >> >
>> >> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
>> >> >Alexey.Yakubovich@searshc.com> wrote:
>> >> >
>> >> >> I am trying to master HBase, and vuala, I discover that so nice
>>API
>> >> >> components:
>> >> >>
>> >> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
>> >> >>
>> >> >> Or may be not so nice? So e.g. checkAndPut can atomically update
>>the
>> >> >> specified cell.
>> >> >> But what if I want to update two cells (from one row) in one
>>atomic
>> >> >> operation? What if it易s two cells from two different rows, but in
>> >>need
>> >> >>to
>> >> >> be updated atomically?
>> >> >>
>> >> >> What is the best way to achieve that?
>> >> >>
>> >> >> Thank you
>> >> >> Alexey
>> >> >>
>> >> >> This message, including any attachments, is the property of Sears
>> >> >>Holdings
>> >> >> Corporation and/or one of its subsidiaries. It is confidential and
>> >>may
>> >> >> contain proprietary or legally privileged information. If you are
>>not
>> >> >>the
>> >> >> intended recipient, please delete it without reading the contents.
>> >>Thank
>> >> >> you.
>> >> >>
>> >>
>> >> This message, including any attachments, is the property of Sears
>> >>Holdings
>> >> Corporation and/or one of its subsidiaries. It is confidential and
>>may
>> >> contain proprietary or legally privileged information. If you are not
>> >>the
>> >> intended recipient, please delete it without reading the contents.
>>Thank
>> >> you.
>> >>
>>
>>
>> This message, including any attachments, is the property of Sears
>>Holdings
>> Corporation and/or one of its subsidiaries. It is confidential and may
>> contain proprietary or legally privileged information. If you are not
>>the
>> intended recipient, please delete it without reading the contents. Thank
>> you.
>>
This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.
Re: HBase atomic update
Posted by Ted Yu <yu...@gmail.com>.
bq. can you completely customize
Please take a look at HRegion#checkAndMutate() - you would get better idea.
FYI
On Tue, Jan 26, 2016 at 9:21 AM, Yakubovich, Alexey <
Alexey.Yakubovich@searshc.com> wrote:
> Actually a found another question (HBase : Check and Put method used with
> a long). That is also my question. I mean by design, can you use in
> checkAndPut with CompareFilter.CompareOp to conditionally update (in my
> case, with CompareFilter.CompareOp.GREATER enum value) for int? Or even
> better, can you completely customize (within reasonable restrictions)) the
> condition for the atomic update?
>
> On 1/26/16, 9:52 AM, "Ted Yu" <yu...@gmail.com> wrote:
>
> >As long as C1 and C2 are updated using one checkAndPut() call, it should
> >work.
> >
> >On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
> >Alexey.Yakubovich@searshc.com> wrote:
> >
> >> Thank you Ted.
> >> You are right it should works. Concerning condition when it can be
> >> necessary: one case is when several (spark) executors can update the
> >>same
> >> row with two int cells: C1 and C2, representing a range. Then C1 Should
> >>be
> >> always <= C2. But without synch between executors, the data integrity
> >>can
> >> be broken.
> >> Thanks again
> >>
> >> + something), and data integrity for instance require
> >> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
> >>
> >> >bq. what if I want to update two cells (from one row) in one atomic
> >> >operation
> >> >
> >> >Can you clarify the condition on which the update should be performed ?
> >> >Meaning, do you want to compare with one column or compare with two
> >> >columns
> >> >?
> >> >
> >> >If you want to compare with one column and update the row depending on
> >> >result of the comparison, you can call addColumn() of Put twice (for
> >>the
> >> >two columns, respectively) and pass the Put to checkAndPut().
> >> >
> >> >Cheers
> >> >
> >> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
> >> >Alexey.Yakubovich@searshc.com> wrote:
> >> >
> >> >> I am trying to master HBase, and vuala, I discover that so nice API
> >> >> components:
> >> >>
> >> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
> >> >>
> >> >> Or may be not so nice? So e.g. checkAndPut can atomically update the
> >> >> specified cell.
> >> >> But what if I want to update two cells (from one row) in one atomic
> >> >> operation? What if it易s two cells from two different rows, but in
> >>need
> >> >>to
> >> >> be updated atomically?
> >> >>
> >> >> What is the best way to achieve that?
> >> >>
> >> >> Thank you
> >> >> Alexey
> >> >>
> >> >> This message, including any attachments, is the property of Sears
> >> >>Holdings
> >> >> Corporation and/or one of its subsidiaries. It is confidential and
> >>may
> >> >> contain proprietary or legally privileged information. If you are not
> >> >>the
> >> >> intended recipient, please delete it without reading the contents.
> >>Thank
> >> >> you.
> >> >>
> >>
> >> This message, including any attachments, is the property of Sears
> >>Holdings
> >> Corporation and/or one of its subsidiaries. It is confidential and may
> >> contain proprietary or legally privileged information. If you are not
> >>the
> >> intended recipient, please delete it without reading the contents. Thank
> >> you.
> >>
>
>
> This message, including any attachments, is the property of Sears Holdings
> Corporation and/or one of its subsidiaries. It is confidential and may
> contain proprietary or legally privileged information. If you are not the
> intended recipient, please delete it without reading the contents. Thank
> you.
>
Re: HBase atomic update
Posted by "Yakubovich, Alexey" <Al...@searshc.com>.
Actually a found another question (HBase : Check and Put method used with
a long). That is also my question. I mean by design, can you use in
checkAndPut with CompareFilter.CompareOp to conditionally update (in my
case, with CompareFilter.CompareOp.GREATER enum value) for int? Or even
better, can you completely customize (within reasonable restrictions)) the
condition for the atomic update?
On 1/26/16, 9:52 AM, "Ted Yu" <yu...@gmail.com> wrote:
>As long as C1 and C2 are updated using one checkAndPut() call, it should
>work.
>
>On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
>Alexey.Yakubovich@searshc.com> wrote:
>
>> Thank you Ted.
>> You are right it should works. Concerning condition when it can be
>> necessary: one case is when several (spark) executors can update the
>>same
>> row with two int cells: C1 and C2, representing a range. Then C1 Should
>>be
>> always <= C2. But without synch between executors, the data integrity
>>can
>> be broken.
>> Thanks again
>>
>> + something), and data integrity for instance require
>> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
>>
>> >bq. what if I want to update two cells (from one row) in one atomic
>> >operation
>> >
>> >Can you clarify the condition on which the update should be performed ?
>> >Meaning, do you want to compare with one column or compare with two
>> >columns
>> >?
>> >
>> >If you want to compare with one column and update the row depending on
>> >result of the comparison, you can call addColumn() of Put twice (for
>>the
>> >two columns, respectively) and pass the Put to checkAndPut().
>> >
>> >Cheers
>> >
>> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
>> >Alexey.Yakubovich@searshc.com> wrote:
>> >
>> >> I am trying to master HBase, and vuala, I discover that so nice API
>> >> components:
>> >>
>> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
>> >>
>> >> Or may be not so nice? So e.g. checkAndPut can atomically update the
>> >> specified cell.
>> >> But what if I want to update two cells (from one row) in one atomic
>> >> operation? What if it易s two cells from two different rows, but in
>>need
>> >>to
>> >> be updated atomically?
>> >>
>> >> What is the best way to achieve that?
>> >>
>> >> Thank you
>> >> Alexey
>> >>
>> >> This message, including any attachments, is the property of Sears
>> >>Holdings
>> >> Corporation and/or one of its subsidiaries. It is confidential and
>>may
>> >> contain proprietary or legally privileged information. If you are not
>> >>the
>> >> intended recipient, please delete it without reading the contents.
>>Thank
>> >> you.
>> >>
>>
>> This message, including any attachments, is the property of Sears
>>Holdings
>> Corporation and/or one of its subsidiaries. It is confidential and may
>> contain proprietary or legally privileged information. If you are not
>>the
>> intended recipient, please delete it without reading the contents. Thank
>> you.
>>
This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.
Re: HBase atomic update
Posted by Ted Yu <yu...@gmail.com>.
As long as C1 and C2 are updated using one checkAndPut() call, it should
work.
On Tue, Jan 26, 2016 at 7:47 AM, Yakubovich, Alexey <
Alexey.Yakubovich@searshc.com> wrote:
> Thank you Ted.
> You are right it should works. Concerning condition when it can be
> necessary: one case is when several (spark) executors can update the same
> row with two int cells: C1 and C2, representing a range. Then C1 Should be
> always <= C2. But without synch between executors, the data integrity can
> be broken.
> Thanks again
>
> + something), and data integrity for instance require
> On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
>
> >bq. what if I want to update two cells (from one row) in one atomic
> >operation
> >
> >Can you clarify the condition on which the update should be performed ?
> >Meaning, do you want to compare with one column or compare with two
> >columns
> >?
> >
> >If you want to compare with one column and update the row depending on
> >result of the comparison, you can call addColumn() of Put twice (for the
> >two columns, respectively) and pass the Put to checkAndPut().
> >
> >Cheers
> >
> >On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
> >Alexey.Yakubovich@searshc.com> wrote:
> >
> >> I am trying to master HBase, and vuala, I discover that so nice API
> >> components:
> >>
> >> checkAndPut, checkAndDelete, Increment, Append (HTable)
> >>
> >> Or may be not so nice? So e.g. checkAndPut can atomically update the
> >> specified cell.
> >> But what if I want to update two cells (from one row) in one atomic
> >> operation? What if it¹s two cells from two different rows, but in need
> >>to
> >> be updated atomically?
> >>
> >> What is the best way to achieve that?
> >>
> >> Thank you
> >> Alexey
> >>
> >> This message, including any attachments, is the property of Sears
> >>Holdings
> >> Corporation and/or one of its subsidiaries. It is confidential and may
> >> contain proprietary or legally privileged information. If you are not
> >>the
> >> intended recipient, please delete it without reading the contents. Thank
> >> you.
> >>
>
> This message, including any attachments, is the property of Sears Holdings
> Corporation and/or one of its subsidiaries. It is confidential and may
> contain proprietary or legally privileged information. If you are not the
> intended recipient, please delete it without reading the contents. Thank
> you.
>
Re: HBase atomic update
Posted by "Yakubovich, Alexey" <Al...@searshc.com>.
Thank you Ted.
You are right it should works. Concerning condition when it can be
necessary: one case is when several (spark) executors can update the same
row with two int cells: C1 and C2, representing a range. Then C1 Should be
always <= C2. But without synch between executors, the data integrity can
be broken.
Thanks again
+ something), and data integrity for instance require
On 1/25/16, 3:02 PM, "Ted Yu" <yu...@gmail.com> wrote:
>bq. what if I want to update two cells (from one row) in one atomic
>operation
>
>Can you clarify the condition on which the update should be performed ?
>Meaning, do you want to compare with one column or compare with two
>columns
>?
>
>If you want to compare with one column and update the row depending on
>result of the comparison, you can call addColumn() of Put twice (for the
>two columns, respectively) and pass the Put to checkAndPut().
>
>Cheers
>
>On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
>Alexey.Yakubovich@searshc.com> wrote:
>
>> I am trying to master HBase, and vuala, I discover that so nice API
>> components:
>>
>> checkAndPut, checkAndDelete, Increment, Append (HTable)
>>
>> Or may be not so nice? So e.g. checkAndPut can atomically update the
>> specified cell.
>> But what if I want to update two cells (from one row) in one atomic
>> operation? What if it¹s two cells from two different rows, but in need
>>to
>> be updated atomically?
>>
>> What is the best way to achieve that?
>>
>> Thank you
>> Alexey
>>
>> This message, including any attachments, is the property of Sears
>>Holdings
>> Corporation and/or one of its subsidiaries. It is confidential and may
>> contain proprietary or legally privileged information. If you are not
>>the
>> intended recipient, please delete it without reading the contents. Thank
>> you.
>>
This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.
Re: HBase atomic update
Posted by Ted Yu <yu...@gmail.com>.
bq. what if I want to update two cells (from one row) in one atomic
operation
Can you clarify the condition on which the update should be performed ?
Meaning, do you want to compare with one column or compare with two columns
?
If you want to compare with one column and update the row depending on
result of the comparison, you can call addColumn() of Put twice (for the
two columns, respectively) and pass the Put to checkAndPut().
Cheers
On Mon, Jan 25, 2016 at 12:40 PM, Yakubovich, Alexey <
Alexey.Yakubovich@searshc.com> wrote:
> I am trying to master HBase, and vuala, I discover that so nice API
> components:
>
> checkAndPut, checkAndDelete, Increment, Append (HTable)
>
> Or may be not so nice? So e.g. checkAndPut can atomically update the
> specified cell.
> But what if I want to update two cells (from one row) in one atomic
> operation? What if it’s two cells from two different rows, but in need to
> be updated atomically?
>
> What is the best way to achieve that?
>
> Thank you
> Alexey
>
> This message, including any attachments, is the property of Sears Holdings
> Corporation and/or one of its subsidiaries. It is confidential and may
> contain proprietary or legally privileged information. If you are not the
> intended recipient, please delete it without reading the contents. Thank
> you.
>
Re: HBase atomic update
Posted by Jameson Li <ho...@gmail.com>.
it seems parallel-update issue for the same rowkey and column?
can you let the column with multi-versions and every update using a special
timestamp, ti will be work and bypass the parallel-update issue.
And when just two parallel request update
same-rowkey-same-column-same-timestamp, there isn't impossibility way to
solve it, it will let a random query success and another fail or retry.
If just need this cases, and not want random solves, Or maybe there is some
other way to let the parallel request have an ordered order, rather than
parallel in an same nanosecond.
2016-01-26 4:40 GMT+08:00 Yakubovich, Alexey <Al...@searshc.com>
:
> I am trying to master HBase, and vuala, I discover that so nice API
> components:
>
> checkAndPut, checkAndDelete, Increment, Append (HTable)
>
> Or may be not so nice? So e.g. checkAndPut can atomically update the
> specified cell.
> But what if I want to update two cells (from one row) in one atomic
> operation? What if it’s two cells from two different rows, but in need to
> be updated atomically?
>
> What is the best way to achieve that?
>
> Thank you
> Alexey
>
> This message, including any attachments, is the property of Sears Holdings
> Corporation and/or one of its subsidiaries. It is confidential and may
> contain proprietary or legally privileged information. If you are not the
> intended recipient, please delete it without reading the contents. Thank
> you.
>
--
Thanks & Regards,
李剑 Jameson Li
Focus on Hadoop,Mysql