Repository: hbase
Updated Branches:
  refs/heads/master 60827fc1e -> 414b2d088


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/414b2d08
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/414b2d08
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/414b2d08

Branch: refs/heads/master
Commit: 414b2d0889f511089ad575a9c96814a95b5e8797
Parents: 60827fc
Author: Michael Stack <st...@apache.org>
Authored: Wed Jan 31 15:17:38 2018 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Wed Jan 31 15:17:38 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/414b2d08/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 1111bb1..736bee0 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()));
     }

Reply via email to