From e736b4641e289cdc9b532fc7cbb059ddbfbd10d0 Mon Sep 17 00:00:00 2001 From: zhangduo Date: Sun, 8 Apr 2018 15:31:02 +0800 Subject: [PATCH] HBASE-20362 TestMasterShutdown.testMasterShutdownBeforeStartingAnyRegionServer is flaky --- .../main/java/org/apache/hadoop/hbase/client/Admin.java | 15 ++++++++++++--- .../apache/hadoop/hbase/master/TestMasterShutdown.java | 10 +++++----- 2 files changed, 17 insertions(+), 8 deletions(-) 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; /** + *

* Shuts down the HBase cluster. - * + *

+ *

+ * Notice that, a success shutdown call may ends with an error since the remote server has already + * been shutdown. + *

* @throws IOException if a remote or network exception occurs */ void shutdown() throws IOException; /** + *

* Shuts down the current HBase master only. Does not shutdown the cluster. - * + *

+ *

+ * Notice that, a success stopMaster call may ends with an error since the remote server has + * already been shutdown. + *

* @throws IOException if a remote or network exception occurs * @see #shutdown() */ 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 { *

* 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(); -- 2.7.4