You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by tvraju <tv...@gmail.com> on 2014/11/24 21:31:49 UTC

PreBatchMutate - Delete another row inside this method

Hi,
IN PreBatchMutate method in Observer, I am trying to check whether a row ,
say '123', exists and delete the row.  This row is different from the
current row , say '111' ,in the method, which has locked the current row.
But Delete operation is waiting for the lock to '111' instead of '123'.

Say,  I have a table - test_delete, cf:delete_row
I have two rows 1) '123','defaultRow' 2) '111','111'

I will try to re-insert the second row with '111','123'. IN PreBatchMutate
method, I am trying to check if row '123' exists and delete it.

Result result = c.getEnvironment().getRegion().get(new
Get(Bytes.toBytes('123')));
                                byte[] deleteRow = result.getRow();
                                logger.debug(String.format("Deleting row
:%s", Bytes.toString(deleteRow)));
                                Delete delete = new Delete(deleteRow);
                               
c.getEnvironment().getRegion().delete(delete);

Exception :

org.apache.hadoop.hbase.regionserver.HRegion: Failed getting lock in batch
put, row=111
java.io.IOException: Timed out waiting for lock for row: 111

Please advice.





--
View this message in context: http://apache-hbase.679495.n3.nabble.com/PreBatchMutate-Delete-another-row-inside-this-method-tp4066298.html
Sent from the HBase User mailing list archive at Nabble.com.

Re: PreBatchMutate - Delete another row inside this method

Posted by tvraju <tv...@gmail.com>.
I got you, better to avoid delete in coprocessor. Thank You



--
View this message in context: http://apache-hbase.679495.n3.nabble.com/PreBatchMutate-Delete-another-row-inside-this-method-tp4066298p4066345.html
Sent from the HBase User mailing list archive at Nabble.com.

Re: PreBatchMutate - Delete another row inside this method

Posted by Ted Yu <yu...@gmail.com>.
Row '123' may be in a different region from the one row '111' is in. 
Cross region RPC should be avoided in coprocessor. 

Does your application require that the deletion of row '123' be in the same transaction as the mutation ?

Cheers

On Nov 24, 2014, at 12:31 PM, tvraju <tv...@gmail.com> wrote:

> Hi,
> IN PreBatchMutate method in Observer, I am trying to check whether a row ,
> say '123', exists and delete the row.  This row is different from the
> current row , say '111' ,in the method, which has locked the current row.
> But Delete operation is waiting for the lock to '111' instead of '123'.
> 
> Say,  I have a table - test_delete, cf:delete_row
> I have two rows 1) '123','defaultRow' 2) '111','111'
> 
> I will try to re-insert the second row with '111','123'. IN PreBatchMutate
> method, I am trying to check if row '123' exists and delete it.
> 
> Result result = c.getEnvironment().getRegion().get(new
> Get(Bytes.toBytes('123')));
>                                byte[] deleteRow = result.getRow();
>                                logger.debug(String.format("Deleting row
> :%s", Bytes.toString(deleteRow)));
>                                Delete delete = new Delete(deleteRow);
> 
> c.getEnvironment().getRegion().delete(delete);
> 
> Exception :
> 
> org.apache.hadoop.hbase.regionserver.HRegion: Failed getting lock in batch
> put, row=111
> java.io.IOException: Timed out waiting for lock for row: 111
> 
> Please advice.
> 
> 
> 
> 
> 
> --
> View this message in context: http://apache-hbase.679495.n3.nabble.com/PreBatchMutate-Delete-another-row-inside-this-method-tp4066298.html
> Sent from the HBase User mailing list archive at Nabble.com.