ndimiduk commented on a change in pull request #1141: HBASE-23808 [Flakey Test] 
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141#discussion_r376481912
 
 

 ##########
 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:
   I think this is the source of the instability I've seen in this test, but I 
cannot reproduce it reliably.
   
   You see this test failing reliably on your branch?

----------------------------------------------------------------
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

Reply via email to