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
* 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()
*/

View File

@ -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();