You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Jean-Marc Spaggiari (JIRA)" <ji...@apache.org> on 2014/08/25 13:16:58 UTC

[jira] [Updated] (HBASE-11817) HTable.batch() loses operations when region is splited

     [ https://issues.apache.org/jira/browse/HBASE-11817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Marc Spaggiari updated HBASE-11817:
----------------------------------------

    Description: 
Using HTable.batch() often loses increment operation when region split ran.

Test code snpipet is below; 
Running this 2 code blocks concurrently, different values were often recoreded although all value should be same 0xffff.
{code}
// --- code 1 ---
HTable table = new HTable(CONF);
byte[] rowKey = new byte[1];
for (int i=0;i<0xffff;i++){
 ArrayList<Increment> operations = new ArrayList<Increment>();
 for (byte c1 = (byte)'A'; c1<=(byte)'Z'; c1++) {
   rowKey[0] = c1;
   Increment opIncr = new Increment(rowKey);
   opIncr.addColumn(FAM, HConstants.EMPTY_BYTE_ARRAY, 1);
   operations.add(opIncr);
 }
 table.batch(operations, null);
}

// -- code2 --
HBaseAdmin admin = new HBaseAdmin(CONF);
byte[] rowKey = new byte[1];
for (byte c1 = (byte)'A'; c1<=(byte)'Z'; c1++) {
 try { Thread.sleep(2000L); } catch (InterruptedException iex) {}
 rowKey[0] = c1;
 admin.split(TABLE_NAME, rowKey);
}
/////
{code}

Using table.increment() instead of table.batch() works fine. But that change gets slower . 

  was:
Using HTable.batch() often loses increment operation when region split ran.

Test code snpipet is below; 
Running this 2 code blocks concurrently, different values were often recoreded although all value should be same 0xffff.

// --- code 1 ---
HTable table = new HTable(CONF);
byte[] rowKey = new byte[1];
for (int i=0;i<0xffff;i++){
 ArrayList<Increment> operations = new ArrayList<Increment>();
 for (byte c1 = (byte)'A'; c1<=(byte)'Z'; c1++) {
   rowKey[0] = c1;
   Increment opIncr = new Increment(rowKey);
   opIncr.addColumn(FAM, HConstants.EMPTY_BYTE_ARRAY, 1);
   operations.add(opIncr);
 }
 table.batch(operations, null);
}

// -- code2 --
HBaseAdmin admin = new HBaseAdmin(CONF);
byte[] rowKey = new byte[1];
for (byte c1 = (byte)'A'; c1<=(byte)'Z'; c1++) {
 try { Thread.sleep(2000L); } catch (InterruptedException iex) {}
 rowKey[0] = c1;
 admin.split(TABLE_NAME, rowKey);
}
/////

Using table.increment() instead of table.batch() works fine. But that change gets slower . 


> HTable.batch() loses operations when region is splited
> ------------------------------------------------------
>
>                 Key: HBASE-11817
>                 URL: https://issues.apache.org/jira/browse/HBASE-11817
>             Project: HBase
>          Issue Type: Bug
>          Components: Admin, Client
>    Affects Versions: 0.98.4
>         Environment: 0.98.4+hadoop 2.4.1, 0.98.4 stand-alone, jdk1.6
>            Reporter: t samkawa
>
> Using HTable.batch() often loses increment operation when region split ran.
> Test code snpipet is below; 
> Running this 2 code blocks concurrently, different values were often recoreded although all value should be same 0xffff.
> {code}
> // --- code 1 ---
> HTable table = new HTable(CONF);
> byte[] rowKey = new byte[1];
> for (int i=0;i<0xffff;i++){
>  ArrayList<Increment> operations = new ArrayList<Increment>();
>  for (byte c1 = (byte)'A'; c1<=(byte)'Z'; c1++) {
>    rowKey[0] = c1;
>    Increment opIncr = new Increment(rowKey);
>    opIncr.addColumn(FAM, HConstants.EMPTY_BYTE_ARRAY, 1);
>    operations.add(opIncr);
>  }
>  table.batch(operations, null);
> }
> // -- code2 --
> HBaseAdmin admin = new HBaseAdmin(CONF);
> byte[] rowKey = new byte[1];
> for (byte c1 = (byte)'A'; c1<=(byte)'Z'; c1++) {
>  try { Thread.sleep(2000L); } catch (InterruptedException iex) {}
>  rowKey[0] = c1;
>  admin.split(TABLE_NAME, rowKey);
> }
> /////
> {code}
> Using table.increment() instead of table.batch() works fine. But that change gets slower . 



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