|
|
-
Re: checkAndPut, checkAndDelete
Dishant A 2012-07-02, 14:03
Hi Ram,
1) Can you do this check on client side? You can't, because this operation is supposed to be atomic and if you do a get and the value changes on server side in the meantime, you will be doing it wrong. 2) Can we just use the row that is stuffed inside the Put/Delete? (Anyway this change will be an api change).
This lose the case when you want to check the value of column A and based on it change the value of column B. So again we can't.
Hope this helps.
Thanks, Dishant
On Mon, Jul 2, 2012 at 4:44 AM, Ramkrishna.S.Vasudevan < [EMAIL PROTECTED]> wrote:
> Hi Devs > > > > Currently the checkAndPut, checkAndDelete these api currently accept the > row > that needs to be checked and the Delete/Put also along with it. > > > > Again internally in the code HRegion.checkAndMutate() there is a > verification to find if the row passed and the one inside the > Mutate(Put/Delete) object are same. If not throw an exception. > > > > 1) Can we do this check on the client side itself? > > 2) Can we just use the row that is stuffed inside the Put/Delete? > (Anyway this change will be an api change). > > > > Pls correct me if am missing something here. > > > > Regards > > Ram > > > > > > > > > >
+
Dishant A 2012-07-02, 14:03
-
RE: checkAndPut, checkAndDelete
Anoop Sam John 2012-07-02, 17:59
Yes as Ram said the rowId passed to the API and rowId in Put/Delete need to be the same. We can see this check at the server side. I was wondering why these APIs were taking the extra rowId param. I thought at 1st that these can be different rows, add a row if value of a column in another row is some 'x''. This can not be satisfied anyway I think. The operation needs to be under single transaction at server side. So these rows ( if we allow to be diff rows) to be in same region. Can some one explain why we added the rowId extra param in the API? Any way it might be better to add the client side check IMO. Fail fast wl be better..
-Anoop- ________________________________________ From: Dishant A [[EMAIL PROTECTED]] Sent: Monday, July 02, 2012 7:33 PM To: [EMAIL PROTECTED] Subject: Re: checkAndPut, checkAndDelete
Hi Ram,
1) Can you do this check on client side? You can't, because this operation is supposed to be atomic and if you do a get and the value changes on server side in the meantime, you will be doing it wrong. 2) Can we just use the row that is stuffed inside the Put/Delete? (Anyway this change will be an api change).
This lose the case when you want to check the value of column A and based on it change the value of column B. So again we can't.
Hope this helps.
Thanks, Dishant
On Mon, Jul 2, 2012 at 4:44 AM, Ramkrishna.S.Vasudevan < [EMAIL PROTECTED]> wrote:
> Hi Devs > > > > Currently the checkAndPut, checkAndDelete these api currently accept the > row > that needs to be checked and the Delete/Put also along with it. > > > > Again internally in the code HRegion.checkAndMutate() there is a > verification to find if the row passed and the one inside the > Mutate(Put/Delete) object are same. If not throw an exception. > > > > 1) Can we do this check on the client side itself? > > 2) Can we just use the row that is stuffed inside the Put/Delete? > (Anyway this change will be an api change). > > > > Pls correct me if am missing something here. > > > > Regards > > Ram > > > > > > > > > >
+
Anoop Sam John 2012-07-02, 17:59
-
RE: checkAndPut, checkAndDelete
Ramkrishna.S.Vasudevan 2012-07-02, 14:23
Hi Dishant
In my first point the check on the client side what I meant is {code} if (!Bytes.equals(row, r.getRow())) { throw new DoNotRetryIOException("Action's getRow must match the passed row"); } {code} Currently there is a check happening in server side before even we get the lock. I thought this check can be moved to client because the row passed in the param and the one in Delete/Put are expected to be same.
But seeing the code I felt like we are trying to check the same row only. I did not mean to compare the family and qualifier, the row is expected to be same as per the above code. So I meant that the row need not be passed explicity.
Regards Ram
> -----Original Message----- > From: Dishant A [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 02, 2012 7:34 PM > To: [EMAIL PROTECTED] > Subject: Re: checkAndPut, checkAndDelete > > Hi Ram, > > 1) Can you do this check on client side? > You can't, because this operation is supposed to be atomic and if you > do a > get and the value changes on server side in the meantime, you will be > doing > it wrong. > > > 2) Can we just use the row that is stuffed inside the Put/Delete? > (Anyway this change will be an api change). > > This lose the case when you want to check the value of column A and > based > on it change the value of column B. So again we can't. > > Hope this helps. > > Thanks, > Dishant > > On Mon, Jul 2, 2012 at 4:44 AM, Ramkrishna.S.Vasudevan < > [EMAIL PROTECTED]> wrote: > > > Hi Devs > > > > > > > > Currently the checkAndPut, checkAndDelete these api currently accept > the > > row > > that needs to be checked and the Delete/Put also along with it. > > > > > > > > Again internally in the code HRegion.checkAndMutate() there is a > > verification to find if the row passed and the one inside the > > Mutate(Put/Delete) object are same. If not throw an exception. > > > > > > > > 1) Can we do this check on the client side itself? > > > > 2) Can we just use the row that is stuffed inside the > Put/Delete? > > (Anyway this change will be an api change). > > > > > > > > Pls correct me if am missing something here. > > > > > > > > Regards > > > > Ram > > > > > > > > > > > > > > > > > > > >
+
Ramkrishna.S.Vasudevan 2012-07-02, 14:23
-
Re: checkAndPut, checkAndDelete
Stack 2012-07-02, 09:04
On Mon, Jul 2, 2012 at 10:44 AM, Ramkrishna.S.Vasudevan <[EMAIL PROTECTED]> wrote: > 1) Can we do this check on the client side itself? >
I'd say this not enough, that we have to have something serverside too. > 2) Can we just use the row that is stuffed inside the Put/Delete? > (Anyway this change will be an api change). >
We could do this. Seems redundant passing in row independently.
St.Ack
+
Stack 2012-07-02, 09:04
-
checkAndPut, checkAndDelete
Ramkrishna.S.Vasudevan 2012-07-02, 08:44
Hi Devs
Currently the checkAndPut, checkAndDelete these api currently accept the row that needs to be checked and the Delete/Put also along with it.
Again internally in the code HRegion.checkAndMutate() there is a verification to find if the row passed and the one inside the Mutate(Put/Delete) object are same. If not throw an exception.
1) Can we do this check on the client side itself?
2) Can we just use the row that is stuffed inside the Put/Delete? (Anyway this change will be an api change).
Pls correct me if am missing something here.
Regards
Ram
+
Ramkrishna.S.Vasudevan 2012-07-02, 08:44
|
|