You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/12/18 01:56:45 UTC
svn commit: r1551792 -
/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
Author: larsh
Date: Wed Dec 18 00:56:45 2013
New Revision: 1551792
URL: http://svn.apache.org/r1551792
Log:
HBASE-10189 Intermittent TestReplicationSyncUpTool failure (LarsH and Demai Ni)
Modified:
hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java?rev=1551792&r1=1551791&r2=1551792&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java (original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java Wed Dec 18 00:56:45 2013
@@ -22,8 +22,6 @@ import static org.junit.Assert.assertEqu
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 @@ import org.junit.experimental.categories
@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 @@ public class TestReplicationSyncUpTool e
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 @@ public class TestReplicationSyncUpTool e
// 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 @@ public class TestReplicationSyncUpTool e
}
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 @@ public class TestReplicationSyncUpTool e
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 @@ public class TestReplicationSyncUpTool e
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 @@ public class TestReplicationSyncUpTool e
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,