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/39c1ddc6 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/39c1ddc6 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/39c1ddc6 Branch: refs/heads/HBASE-20046-branch-2 Commit: 39c1ddc6e33fcdb4086ea3e6e7a671dd55bb469a Parents: 1ec708b Author: zhangduo <zhang...@apache.org> Authored: Sun Apr 8 15:31:02 2018 +0800 Committer: zhangduo <zhang...@apache.org> Committed: Mon Apr 9 14:55:42 2018 +0800 ---------------------------------------------------------------------- .../java/org/apache/hadoop/hbase/client/Admin.java | 15 ++++++++++++--- .../hadoop/hbase/master/TestMasterShutdown.java | 12 ++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/39c1ddc6/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/39c1ddc6/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 4c51026..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,17 +129,18 @@ 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(); LOG.info("Called master join on " + master.getName());