HBASE-20362 TestMasterShutdown.testMasterShutdownBeforeStartingAnyRegionServer is flaky

This commit is contained in:
zhangduo 2018-04-08 15:31:02 +08:00
parent bdc0d3a4c6
commit 852025dd00
2 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,4 @@
/** /**
*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -1415,15 +1414,25 @@ public interface Admin extends Abortable, Closeable {
throws IOException; throws IOException;
/** /**
* <p>
* Shuts down the HBase cluster. * 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 * @throws IOException if a remote or network exception occurs
*/ */
void shutdown() throws IOException; void shutdown() throws IOException;
/** /**
* <p>
* Shuts down the current HBase master only. Does not shutdown the cluster. * 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 * @throws IOException if a remote or network exception occurs
* @see #shutdown() * @see #shutdown()
*/ */

View File

@ -55,7 +55,6 @@ public class TestMasterShutdown {
* <p> * <p>
* Starts with three masters. Tells the active master to shutdown the cluster. * Starts with three masters. Tells the active master to shutdown the cluster.
* Verifies that all masters are properly shutdown. * Verifies that all masters are properly shutdown.
* @throws Exception
*/ */
@Test @Test
public void testMasterShutdown() throws Exception { public void testMasterShutdown() throws Exception {
@ -130,16 +129,17 @@ public class TestMasterShutdown {
public void run() { public void run() {
LOG.info("Before call to shutdown master"); LOG.info("Before call to shutdown master");
try { try {
try (Connection connection = try (
ConnectionFactory.createConnection(util.getConfiguration())) { Connection connection = ConnectionFactory.createConnection(util.getConfiguration())) {
try (Admin admin = connection.getAdmin()) { try (Admin admin = connection.getAdmin()) {
admin.shutdown(); admin.shutdown();
} }
} }
} catch (Exception e) {
LOG.info("Error while calling Admin.shutdown, which is expected: " + e.getMessage());
}
LOG.info("After call to shutdown master"); LOG.info("After call to shutdown master");
cluster.waitOnMaster(MASTER_INDEX); cluster.waitOnMaster(MASTER_INDEX);
} catch (Exception e) {
}
} }
}; };
shutdownThread.start(); shutdownThread.start();