Repository: hbase Updated Branches: refs/heads/branch-1.3 6891e8195 -> 04f1029c0
HBASE-19385 [1.3] TestReplicator failed 1.3 nightly Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/04f1029c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/04f1029c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/04f1029c Branch: refs/heads/branch-1.3 Commit: 04f1029c03cca0c3303595fec5d654a304db2c03 Parents: 6891e81 Author: Michael Stack <[email protected]> Authored: Wed Nov 29 23:06:31 2017 -0800 Committer: Michael Stack <[email protected]> Committed: Wed Nov 29 23:10:46 2017 -0800 ---------------------------------------------------------------------- .../replication/regionserver/TestReplicator.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/04f1029c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicator.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicator.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicator.java index 6d15a1b..b328b70 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicator.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicator.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -95,6 +96,7 @@ public class TestReplicator extends TestReplicationBase { Waiter.waitFor(conf1, 60000, new Waiter.ExplainingPredicate<Exception>() { @Override public boolean evaluate() throws Exception { + LOG.info("Count=" + ReplicationEndpointForTest.getBatchCount()); return ReplicationEndpointForTest.getBatchCount() >= NUM_ROWS; } @@ -176,7 +178,7 @@ public class TestReplicator extends TestReplicationBase { public static class ReplicationEndpointForTest extends HBaseInterClusterReplicationEndpoint { - private static int batchCount; + private static AtomicInteger batchCount = new AtomicInteger(0); private static int entriesCount; private static final Object latch = new Object(); private static AtomicBoolean useLatch = new AtomicBoolean(false); @@ -195,17 +197,20 @@ public class TestReplicator extends TestReplicationBase { public static void await() throws InterruptedException { if (useLatch.get()) { LOG.info("Waiting on latch"); - latch.wait(); + synchronized(latch) { + latch.wait(); + } LOG.info("Waited on latch, now proceeding"); } } public static int getBatchCount() { - return batchCount; + return batchCount.get(); } public static void setBatchCount(int i) { - batchCount = i; + LOG.info("SetBatchCount=" + i + ", old=" + getBatchCount()); + batchCount.set(i); } public static int getEntriesCount() { @@ -213,6 +218,7 @@ public class TestReplicator extends TestReplicationBase { } public static void setEntriesCount(int i) { + LOG.info("SetEntriesCount=" + i); entriesCount = i; } @@ -238,8 +244,9 @@ public class TestReplicator extends TestReplicationBase { super.replicateEntries(rrs, entries, replicationClusterId, baseNamespaceDir, hfileArchiveDir); entriesCount += entries.size(); - batchCount++; - LOG.info("Completed replicating batch " + System.identityHashCode(entries)); + int count = batchCount.incrementAndGet(); + LOG.info("Completed replicating batch " + System.identityHashCode(entries) + + " count=" + count); } catch (IOException e) { LOG.info("Failed to replicate batch " + System.identityHashCode(entries), e); throw e;
