Index: src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java (revision 1551642) +++ src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java (working copy) @@ -22,8 +22,6 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.HBaseAdmin; @@ -39,8 +37,6 @@ @Category(LargeTests.class) public class TestReplicationSyncUpTool extends TestReplicationBase { - private static final Log LOG = LogFactory.getLog(TestReplicationSyncUpTool.class); - private static final byte[] t1_su = Bytes.toBytes("t1_syncup"); private static final byte[] t2_su = Bytes.toBytes("t2_syncup"); @@ -53,8 +49,6 @@ private HTableDescriptor t2_syncupSource, t2_syncupTarget; private HTable ht1Source, ht2Source, ht1TargetAtPeer1, ht2TargetAtPeer1; - private int rowCount_ht1Source, rowCount_ht2Source, rowCount_ht1TargetAtPeer1, - rowCount_ht2TargetAtPeer1; @Before public void setUp() throws Exception { @@ -234,17 +228,31 @@ // ensure replication completed Thread.sleep(SLEEP_TIME); + int rowCount_ht1Source = utility1.countRows(ht1Source); + for (int i = 0; i < NB_RETRIES; i++) { + int rowCount_ht1TargetAtPeer1 = utility2.countRows(ht1TargetAtPeer1); + if (i==NB_RETRIES-1) { + assertEquals("t1_syncup has 101 rows on source, and 100 on slave1", rowCount_ht1Source - 1, + rowCount_ht1TargetAtPeer1); + } + if (rowCount_ht1Source - 1 == rowCount_ht1TargetAtPeer1) { + break; + } + Thread.sleep(SLEEP_TIME); + } - rowCount_ht1Source = utility1.countRows(ht1Source); - rowCount_ht1TargetAtPeer1 = utility2.countRows(ht1TargetAtPeer1); - assertEquals("t1_syncup has 101 rows on source, and 100 on slave1", rowCount_ht1Source - 1, - rowCount_ht1TargetAtPeer1); - - rowCount_ht2Source = utility1.countRows(ht2Source); - rowCount_ht2TargetAtPeer1 = utility2.countRows(ht2TargetAtPeer1); - assertEquals("t2_syncup has 201 rows on source, and 200 on slave1", rowCount_ht2Source - 1, - rowCount_ht2TargetAtPeer1); - + int rowCount_ht2Source = utility1.countRows(ht2Source); + for (int i = 0; i < NB_RETRIES; i++) { + int rowCount_ht2TargetAtPeer1 = utility2.countRows(ht2TargetAtPeer1); + if (i==NB_RETRIES-1) { + assertEquals("t2_syncup has 201 rows on source, and 200 on slave1", rowCount_ht2Source - 1, + rowCount_ht2TargetAtPeer1); + } + if (rowCount_ht2Source - 1 == rowCount_ht2TargetAtPeer1) { + break; + } + Thread.sleep(SLEEP_TIME); + } } private void mimicSyncUpAfterDelete() throws Exception { @@ -266,11 +274,11 @@ } ht2Source.delete(list); - rowCount_ht1Source = utility1.countRows(ht1Source); + int rowCount_ht1Source = utility1.countRows(ht1Source); assertEquals("t1_syncup has 51 rows on source, after remove 50 of the replicated colfam", 51, rowCount_ht1Source); - rowCount_ht2Source = utility1.countRows(ht2Source); + int rowCount_ht2Source = utility1.countRows(ht2Source); assertEquals("t2_syncup has 101 rows on source, after remove 100 of the replicated colfam", 101, rowCount_ht2Source); @@ -280,8 +288,8 @@ Thread.sleep(SLEEP_TIME); // before sync up - rowCount_ht1TargetAtPeer1 = utility2.countRows(ht1TargetAtPeer1); - rowCount_ht2TargetAtPeer1 = utility2.countRows(ht2TargetAtPeer1); + int rowCount_ht1TargetAtPeer1 = utility2.countRows(ht1TargetAtPeer1); + int rowCount_ht2TargetAtPeer1 = utility2.countRows(ht2TargetAtPeer1); assertEquals("@Peer1 t1_syncup should still have 100 rows", 100, rowCount_ht1TargetAtPeer1); assertEquals("@Peer1 t2_syncup should still have 200 rows", 200, rowCount_ht2TargetAtPeer1); @@ -323,9 +331,9 @@ p.add(noRepfamName, qualName, Bytes.toBytes("val" + 9998)); ht2Source.put(p); - rowCount_ht1Source = utility1.countRows(ht1Source); + int rowCount_ht1Source = utility1.countRows(ht1Source); assertEquals("t1_syncup has 102 rows on source", 102, rowCount_ht1Source); - rowCount_ht2Source = utility1.countRows(ht2Source); + int rowCount_ht2Source = utility1.countRows(ht2Source); assertEquals("t2_syncup has 202 rows on source", 202, rowCount_ht2Source); utility1.shutdownMiniHBaseCluster(); @@ -334,8 +342,8 @@ Thread.sleep(SLEEP_TIME); // before sync up - rowCount_ht1TargetAtPeer1 = utility2.countRows(ht1TargetAtPeer1); - rowCount_ht2TargetAtPeer1 = utility2.countRows(ht2TargetAtPeer1); + int rowCount_ht1TargetAtPeer1 = utility2.countRows(ht1TargetAtPeer1); + int rowCount_ht2TargetAtPeer1 = utility2.countRows(ht2TargetAtPeer1); assertEquals("@Peer1 t1_syncup should be NOT sync up and have 50 rows", 50, rowCount_ht1TargetAtPeer1); assertEquals("@Peer1 t2_syncup should be NOT sync up and have 100 rows", 100, Index: src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java (revision 1551642) +++ src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java (working copy) @@ -42,6 +42,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.hbase.ClusterStatus; +import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; @@ -668,7 +669,7 @@ instance = tryInstantiateProtobuf(declaredClass, in); } catch (ClassNotFoundException e) { LOG.error("Can't find class " + className, e); - throw new IOException("Can't find class " + className, e); + throw new DoNotRetryIOException("Can't find class " + className, e); } } else { // Writable or Serializable Class instanceClass = null; @@ -679,7 +680,7 @@ instanceClass = getClassByName(conf, className); } catch (ClassNotFoundException e) { LOG.error("Can't find class " + className, e); - throw new IOException("Can't find class " + className, e); + throw new DoNotRetryIOException("Can't find class " + className, e); } } else { instanceClass = CODE_TO_CLASS.get(b); @@ -688,6 +689,9 @@ Writable writable = WritableFactories.newInstance(instanceClass, conf); try { writable.readFields(in); + } catch (IOException io) { + LOG.error("Error in readFields", io); + throw io; } catch (Exception e) { LOG.error("Error in readFields", e); throw new IOException("Error in readFields" , e); @@ -709,7 +713,7 @@ instance = ois.readObject(); } catch (ClassNotFoundException e) { LOG.error("Class not found when attempting to deserialize object", e); - throw new IOException("Class not found when attempting to " + + throw new DoNotRetryIOException("Class not found when attempting to " + "deserialize object", e); } finally { if(bis!=null) bis.close();