[ 
https://issues.apache.org/jira/browse/HBASE-10803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13944318#comment-13944318
 ] 

LiJianyin commented on HBASE-10803:
-----------------------------------

I used our data from online(asyn) to test. The mothods just as bellow, maybe 
you can try:

        public boolean addOrUpdate(String rowkey, Long mid, String value, long 
time){
                HTableInterface table = null;
                try{
                        table = connection.getTable(TABLE_NAME);
                        Put p = new Put(Bytes.toBytes(rowkey));
                        p.add(FAMILY, Bytes.toBytes(mid), Bytes.toBytes(value));
                        table.put(p);
                        table.close();
                        return true;
                } catch (Exception e){
                        logger.warn("hbase put failed!",e);
                        return false;
                }
        }
when the method "addOrUpdate" returns true, write the params (rowkey, mid, 
String , time) to PUT_SUCCESS_LOG; when it returns false, ignore it.
The addOrUpdate method about 200-500 times/s

        //delete and put atomically on a single row
        public boolean delete(String rowkey, Long mid, String value, long time){
                try{
                        HTableInterface table = connection.getTable(TABLE_NAME);
                        Delete d = new Delete(Bytes.toBytes(rowkey), time);
                        d.deleteColumns(FAMILY, Bytes.toBytes(mid), time);
                        Put p = new Put(Bytes.toBytes(rowkey));
                        p.add(FAMILY_DEL, Bytes.toBytes(mid), time, 
Bytes.toBytes(value));
                        RowMutations rm = new 
RowMutations(Bytes.toBytes(rowkey));
                        rm.add(d);
                        rm.add(p);
                        table.mutateRow(rm);
                        table.close();
                        return true;
                } catch (Exception e){
                        logger.warn("hbase delete failed!",e);
                        return false;
                }
        }
when the method "delete" returns true, write the params (rowkey, mid, String , 
time) to DEL_SUCCESS_LOG; when it returns false, ignore it.
The delete method about 50-120 times/s

Both addOrUpdate and delete were running for 15+ days, the two types of method 
maybe operate the same rowkey and mid.

Then check every record in PUT_SUCCESS_LOG and DEL_SUCCESS_LOG whether the 
method success. PUT_SUCCESS_LOG all right, but few of DEL_SUCCESS_LOG wrong, 
and the wrong time just restarting or balancing.

Thanks.

> "mutateRow" maybe fail when Region Server restarted(or killed) or Region 
> Balance
> --------------------------------------------------------------------------------
>
>                 Key: HBASE-10803
>                 URL: https://issues.apache.org/jira/browse/HBASE-10803
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.96.1.1
>         Environment: hbase0.96.1.1
> hadoop2.2 
> jdk1.7
> 5 Region Server 
>            Reporter: LiJianyin
>
>  found that the operation "mutateRow" maybe fail if Region Server 
> restarted(or killed) or Region Balance, but the java client didnot throw 
> exceptions and  there was no exception in the server's log either. 
> the client code :
>                       HTableInterface table = connection.getTable(TABLE_NAME);
>                       Delete d = new Delete(Bytes.toBytes(rowkey), time);
>                       d.deleteColumns(FAMILY, Bytes.toBytes(id), time);
>                       Put p = new Put(Bytes.toBytes(rowkey));
>                       p.add(FAMILY_DEL, Bytes.toBytes(id), time, 
> Bytes.toBytes(value));
>                       RowMutations rm = new 
> RowMutations(Bytes.toBytes(rowkey));
>                       rm.add(d);
>                       rm.add(p);
>                       table.mutateRow(rm);
>                       table.close();
> the test data:
>       Operator Type: put; mutateRow(delete+put) 
>       Operator Total Count:202194822  put:160866148 mutateRow:41328674
>       All put correct, but 161 mutateRow incorrect (161 data was not 
> mutateRowed in fact).
>       then we checked log when the time mutateRow failed, NO EXCEPTION 
> THROWED, found that as follow:
>       
> 39 failed  hbase auto region-balance
> 44 failed  hbase region server killed
> 59 failed  hbase region server restart
> 19 failed  hadoop datanode restart



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to