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.yakubov...@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" <yuzhih...@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.yakubov...@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" <yuzhih...@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.yakubov...@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" <yuzhih...@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.yakubov...@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" <yuzhih...@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.yakubov...@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. >