You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/09/03 13:14:08 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #574: HBASE-22964 Fix flaky TestClusterRestartFailover and TestClusterResta…

Apache9 commented on a change in pull request #574: HBASE-22964 Fix flaky TestClusterRestartFailover and TestClusterResta…
URL: https://github.com/apache/hbase/pull/574#discussion_r320263784
 
 

 ##########
 File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java
 ##########
 @@ -61,54 +66,51 @@ public void test() throws Exception {
     UTIL.waitFor(60000, () -> UTIL.getMiniHBaseCluster().getMaster().isInitialized());
     // wait for all SCPs finished
     UTIL.waitFor(60000, () -> UTIL.getHBaseCluster().getMaster().getProcedures().stream()
-      .noneMatch(p -> p instanceof ServerCrashProcedure));
+        .noneMatch(p -> p instanceof ServerCrashProcedure));
     TableName tableName = TABLES[0];
     ServerName testServer = UTIL.getHBaseCluster().getRegionServer(0).getServerName();
     UTIL.waitFor(30000, () -> getServerStateNode(testServer) != null);
     ServerStateNode serverNode = getServerStateNode(testServer);
-    Assert.assertNotNull(serverNode);
-    Assert.assertTrue("serverNode should be ONLINE when cluster runs normally",
-      serverNode.isInState(ServerState.ONLINE));
+    assertNotNull(serverNode);
+    assertTrue("serverNode should be ONLINE when cluster runs normally",
+        serverNode.isInState(ServerState.ONLINE));
     UTIL.createMultiRegionTable(tableName, FAMILY);
     UTIL.waitTableEnabled(tableName);
     Table table = UTIL.getConnection().getTable(tableName);
     for (int i = 0; i < 100; i++) {
       UTIL.loadTable(table, FAMILY);
     }
     List<Integer> ports =
-      UTIL.getHBaseCluster().getMaster().getServerManager().getOnlineServersList().stream()
-        .map(serverName -> serverName.getPort()).collect(Collectors.toList());
+        UTIL.getHBaseCluster().getMaster().getServerManager().getOnlineServersList().stream()
+            .map(serverName -> serverName.getPort()).collect(Collectors.toList());
     LOG.info("Shutting down cluster");
     UTIL.getHBaseCluster().killAll();
     UTIL.getHBaseCluster().waitUntilShutDown();
     LOG.info("Starting cluster the second time");
     UTIL.restartHBaseCluster(3, ports);
-    UTIL.waitFor(30000, () -> UTIL.getHBaseCluster().getMaster().isInitialized());
+    UTIL.waitFor(60000, () -> UTIL.getHBaseCluster().getMaster().isInitialized());
     serverNode = UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates()
-      .getServerNode(testServer);
-    Assert.assertNotNull("serverNode should not be null when restart whole cluster", serverNode);
-    Assert.assertFalse(serverNode.isInState(ServerState.ONLINE));
-    LOG.info("start to find the procedure of SCP for the severName we choose");
-    UTIL.waitFor(60000,
-      () -> UTIL.getHBaseCluster().getMaster().getProcedures().stream()
-        .anyMatch(procedure -> (procedure instanceof ServerCrashProcedure) &&
-          ((ServerCrashProcedure) procedure).getServerName().equals(testServer)));
-    Assert.assertFalse("serverNode should not be ONLINE during SCP processing",
-      serverNode.isInState(ServerState.ONLINE));
-    LOG.info("start to submit the SCP for the same serverName {} which should fail", testServer);
-    Assert
-      .assertFalse(UTIL.getHBaseCluster().getMaster().getServerManager().expireServer(testServer));
-    Procedure<?> procedure = UTIL.getHBaseCluster().getMaster().getProcedures().stream()
-      .filter(p -> (p instanceof ServerCrashProcedure) &&
-        ((ServerCrashProcedure) p).getServerName().equals(testServer))
-      .findAny().get();
-    UTIL.waitFor(60000, () -> procedure.isFinished());
+        .getServerNode(testServer);
+    if (serverNode != null) {
+      assertFalse(serverNode.isInState(ServerState.ONLINE));
+      LOG.info("start to find the procedure of SCP for the severName we choose");
+      Procedure<?> procedure = UTIL.getHBaseCluster().getMaster().getProcedures().stream().filter(
+          p -> (p instanceof ServerCrashProcedure) &&
+              ((ServerCrashProcedure) p).getServerName().equals(testServer)).findAny().get();
 
 Review comment:
   Optional.get will never return null, it will throw a NoSuchElementException...

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services