HBASE-20362 TestMasterShutdown.testMasterShutdownBeforeStartingAnyRegionServer 
is flaky


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

Branch: refs/heads/HBASE-19064
Commit: 852025dd00100f1ed2ebc0f04026b2d045f71f13
Parents: bdc0d3a
Author: zhangduo <zhang...@apache.org>
Authored: Sun Apr 8 15:31:02 2018 +0800
Committer: zhangduo <zhang...@apache.org>
Committed: Sun Apr 8 16:09:50 2018 +0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/client/Admin.java   | 15 ++++++++++++---
 .../hadoop/hbase/master/TestMasterShutdown.java      | 10 +++++-----
 2 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/852025dd/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
index b8546fa..a6a4224 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java
@@ -1,5 +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
@@ -1415,15 +1414,25 @@ public interface Admin extends Abortable, Closeable {
       throws IOException;
 
   /**
+   * <p>
    * Shuts down the HBase cluster.
-   *
+   * </p>
+   * <p>
+   * Notice that, a success shutdown call may ends with an error since the 
remote server has already
+   * been shutdown.
+   * </p>
    * @throws IOException if a remote or network exception occurs
    */
   void shutdown() throws IOException;
 
   /**
+   * <p>
    * Shuts down the current HBase master only. Does not shutdown the cluster.
-   *
+   * </p>
+   * <p>
+   * Notice that, a success stopMaster call may ends with an error since the 
remote server has
+   * already been shutdown.
+   * </p>
    * @throws IOException if a remote or network exception occurs
    * @see #shutdown()
    */

http://git-wip-us.apache.org/repos/asf/hbase/blob/852025dd/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
index 0844e81..63cfe1f 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
@@ -55,7 +55,6 @@ public class TestMasterShutdown {
    * <p>
    * Starts with three masters.  Tells the active master to shutdown the 
cluster.
    * Verifies that all masters are properly shutdown.
-   * @throws Exception
    */
   @Test
   public void testMasterShutdown() throws Exception {
@@ -130,16 +129,17 @@ public class TestMasterShutdown {
       public void run() {
         LOG.info("Before call to shutdown master");
         try {
-          try (Connection connection =
-              ConnectionFactory.createConnection(util.getConfiguration())) {
+          try (
+            Connection connection = 
ConnectionFactory.createConnection(util.getConfiguration())) {
             try (Admin admin = connection.getAdmin()) {
               admin.shutdown();
             }
           }
-          LOG.info("After call to shutdown master");
-          cluster.waitOnMaster(MASTER_INDEX);
         } catch (Exception e) {
+          LOG.info("Error while calling Admin.shutdown, which is expected: " + 
e.getMessage());
         }
+        LOG.info("After call to shutdown master");
+        cluster.waitOnMaster(MASTER_INDEX);
       }
     };
     shutdownThread.start();

Reply via email to