bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test]
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141#discussion_r376536908
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
##########
@@ -128,41 +142,50 @@ public void
testMasterShutdownBeforeStartingAnyRegionServer() throws Exception {
conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
// Start the cluster
- final HBaseTestingUtility util = new HBaseTestingUtility(conf);
- util.startMiniDFSCluster(3);
- util.startMiniZKCluster();
- util.createRootDir();
- final LocalHBaseCluster cluster =
- new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
- MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
- final int MASTER_INDEX = 0;
- final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
- master.start();
- LOG.info("Called master start on " + master.getName());
- Thread shutdownThread = new Thread("Shutdown-Thread") {
- @Override
- public void run() {
- LOG.info("Before call to shutdown master");
- try (Connection connection = createConnection(util); Admin admin =
connection.getAdmin()) {
- admin.shutdown();
- } catch (Exception e) {
- LOG.info("Error while calling Admin.shutdown, which is expected: " +
e.getMessage());
+ LocalHBaseCluster cluster = null;
+ try {
+ htu = new HBaseTestingUtility(conf);
+ htu.startMiniDFSCluster(3);
+ htu.startMiniZKCluster();
+ htu.createRootDir();
+ cluster = new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
+ MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
+ final int MASTER_INDEX = 0;
+ final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
+ master.start();
+ LOG.info("Called master start on " + master.getName());
+ final LocalHBaseCluster finalCluster = cluster;
+ Thread shutdownThread = new Thread("Shutdown-Thread") {
+ @Override
+ public void run() {
+ LOG.info("Before call to shutdown master");
+ try (Connection connection = createConnection(htu); Admin admin =
connection.getAdmin()) {
+ admin.shutdown();
Review comment:
No, not after adding this check
https://github.com/apache/hbase/blob/d110c08dce482ef3161294ab931d2559d8e57fca/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java#L141
This check basically works around the actual problem without fixing it.
Ideally you could do the same because that check is anyway applied in the
master after the branch merge.
Fwiw, I think this race is exposed after committing HBASE-23764, because
that speeds up the connections.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services