hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [2/2] hbase git commit: HBASE-19907 TestMetaWithReplicas still flakey
Date Wed, 31 Jan 2018 23:18:52 GMT
HBASE-19907 TestMetaWithReplicas still flakey


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e6d2682f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e6d2682f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e6d2682f

Branch: refs/heads/branch-2
Commit: e6d2682f0f918eecd901b5757e4b3d23a9612c30
Parents: 80af9bd
Author: Michael Stack <stack@apache.org>
Authored: Wed Jan 31 15:17:38 2018 -0800
Committer: Michael Stack <stack@apache.org>
Committed: Wed Jan 31 15:18:45 2018 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/client/TestMetaWithReplicas.java     | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e6d2682f/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
index 4f38fbe..a87bd7c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.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
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
 
 import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors;
 import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -113,11 +114,20 @@ public class TestMetaWithReplicas {
     // Fun. All meta region replicas have ended up on the one server. This will cause this
test
     // to fail ... sometimes.
     if (sns.size() == 1) {
+      int count = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size();
+      assertTrue("count=" + count, count == REGIONSERVERS_COUNT);
       LOG.warn("All hbase:meta replicas are on the one server; moving hbase:meta");
       int metaServerIndex = TEST_UTIL.getHBaseCluster().getServerWithMeta();
-      int newServerIndex = (metaServerIndex + 1) % REGIONSERVERS_COUNT;
+      int newServerIndex = metaServerIndex;
+      while (newServerIndex == metaServerIndex) {
+        newServerIndex = (newServerIndex + 1) % REGIONSERVERS_COUNT;
+      }
+      assertNotEquals(metaServerIndex, newServerIndex);
       ServerName destinationServerName =
           TEST_UTIL.getHBaseCluster().getRegionServer(newServerIndex).getServerName();
+      ServerName metaServerName =
+          TEST_UTIL.getHBaseCluster().getRegionServer(metaServerIndex).getServerName();
+      assertNotEquals(destinationServerName, metaServerName);
       TEST_UTIL.getAdmin().move(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
           Bytes.toBytes(destinationServerName.toString()));
     }


Mime
View raw message