You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2020/02/17 21:18:01 UTC

[hbase] branch branch-2 updated: HBASE-23863 [Flakey Test] TestReplicationEndpointWithMultipleWAL#testInterClusterReplication Debug

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 9f752da  HBASE-23863 [Flakey Test] TestReplicationEndpointWithMultipleWAL#testInterClusterReplication Debug
9f752da is described below

commit 9f752dabd4064c4f043576113988cd6d93da0b7d
Author: stack <st...@apache.org>
AuthorDate: Mon Feb 17 13:15:59 2020 -0800

    HBASE-23863 [Flakey Test] TestReplicationEndpointWithMultipleWAL#testInterClusterReplication Debug
---
 .../hbase/replication/TestReplicationEndpoint.java | 27 ++++++++++++++--------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
index 2a32e3d..6f6fb59 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -210,11 +209,25 @@ public class TestReplicationEndpoint extends TestReplicationBase {
     final String id = "testInterClusterReplication";
 
     List<HRegion> regions = UTIL1.getHBaseCluster().getRegions(tableName);
+    // This trick of waiting on peer to show up is taken from test above.
+    int peerCount = admin.getPeersCount();
+    admin.addPeer(id,
+        new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(CONF2))
+            .setReplicationEndpointImpl(InterClusterReplicationEndpointForTest.class.getName()),
+        null);
+    // This test is flakey and then there is so much stuff flying around in here its, hard to
+    // debug.  Peer needs to be up for the edit to make it across. This wait on
+    // peer count seems to be a hack that has us not progress till peer is up.
+    if (admin.getPeersCount() <= peerCount) {
+      LOG.info("Waiting on peercount to go up from " + peerCount);
+      Threads.sleep(100);
+    }
+
     int totEdits = 0;
 
     // Make sure edits are spread across regions because we do region based batching
     // before shipping edits.
-    for(HRegion region: regions) {
+    for (HRegion region: regions) {
       RegionInfo hri = region.getRegionInfo();
       byte[] row = hri.getStartKey();
       for (int i = 0; i < 100; i++) {
@@ -227,12 +240,8 @@ public class TestReplicationEndpoint extends TestReplicationBase {
       }
     }
 
-    admin.addPeer(id,
-        new ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(CONF2))
-            .setReplicationEndpointImpl(InterClusterReplicationEndpointForTest.class.getName()),
-        null);
-
     final int numEdits = totEdits;
+    LOG.info("Waiting on replication of {}", numEdits);
     Waiter.waitFor(CONF1, 30000, new Waiter.ExplainingPredicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
@@ -560,7 +569,7 @@ public class TestReplicationEndpoint extends TestReplicationBase {
       return entry;
     }
 
-    public static boolean hasPassedAnEntry(){
+    public static boolean hasPassedAnEntry() {
       return passedEntry;
     }
   }