This is an automated email from the ASF dual-hosted git repository.

taklwu pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new f8d9cd3da3e  HBASE-29724: Backport missing changes of "HBASE-25334: 
TestRSGroupsFallback.testFallback is flaky" into branch-2 and branch-2.6 
(#7472) #7476 (#7476)
f8d9cd3da3e is described below

commit f8d9cd3da3e3f44e402e9e31feffcf7de8895491
Author: Tak Lon (Stephen) Wu <[email protected]>
AuthorDate: Tue Nov 25 02:37:59 2025 +0800

     HBASE-29724: Backport missing changes of "HBASE-25334: 
TestRSGroupsFallback.testFallback is flaky" into branch-2 and branch-2.6 
(#7472) #7476 (#7476)
    
    The change in HBASE-25334 (introduced by commit 32c4432 in branch-2 and
    branch-2.6) has diverged between the master (#2728) and branch-2 branches.
    This is a following up changes after HBASE-29720 and have the complete 
functional
    changes of HBASE-25334 that uses SCP as the source of dead servers in 
progress.
    
    Signed-off-by: Istvan Toth <[email protected]>
    Co-authored-by: Kevin Geiszler <[email protected]>
---
 .../apache/hadoop/hbase/rsgroup/TestRSGroupsFallback.java   | 13 +++++--------
 .../java/org/apache/hadoop/hbase/master/ServerManager.java  |  3 ++-
 .../java/org/apache/hadoop/hbase/master/TestDeadServer.java |  9 ++++++---
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git 
a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsFallback.java
 
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsFallback.java
index dee907fea62..12cc5df1cab 100644
--- 
a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsFallback.java
+++ 
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsFallback.java
@@ -101,16 +101,13 @@ public class TestRSGroupsFallback extends 
TestRSGroupsBase {
     assertRegionsInGroup(tableName, FALLBACK_GROUP);
 
     // add a new server to default group, regions move to default group
-    JVMClusterUtil.RegionServerThread t =
-      TEST_UTIL.getMiniHBaseCluster().startRegionServerAndWait(60000);
-    Address startRSAddress = t.getRegionServer().getServerName().getAddress();
-    TEST_UTIL.waitFor(3000,
-      () -> 
rsGroupAdmin.getRSGroupInfo(RSGroupInfo.DEFAULT_GROUP).containsServer(startRSAddress));
+    TEST_UTIL.getMiniHBaseCluster().startRegionServerAndWait(60000);
     assertTrue(master.balance().isBalancerRan());
     assertRegionsInGroup(tableName, RSGroupInfo.DEFAULT_GROUP);
 
     // add a new server to test group, regions move back
-    t = TEST_UTIL.getMiniHBaseCluster().startRegionServerAndWait(60000);
+    JVMClusterUtil.RegionServerThread t =
+      TEST_UTIL.getMiniHBaseCluster().startRegionServerAndWait(60000);
     rsGroupAdmin.moveServers(
       Collections.singleton(t.getRegionServer().getServerName().getAddress()), 
groupName);
     assertTrue(master.balance().isBalancerRan());
@@ -119,11 +116,11 @@ public class TestRSGroupsFallback extends 
TestRSGroupsBase {
     TEST_UTIL.deleteTable(tableName);
   }
 
-  private void assertRegionsInGroup(TableName tableName, String group) throws 
IOException {
+  private void assertRegionsInGroup(TableName table, String group) throws 
IOException {
     ProcedureTestingUtility
       
.waitAllProcedures(TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor());
     RSGroupInfo groupInfo = rsGroupAdmin.getRSGroupInfo(group);
-    
master.getAssignmentManager().getRegionStates().getRegionsOfTable(tableName).forEach(region
 -> {
+    
master.getAssignmentManager().getRegionStates().getRegionsOfTable(table).forEach(region
 -> {
       Address regionOnServer = master.getAssignmentManager().getRegionStates()
         .getRegionAssignments().get(region).getAddress();
       assertTrue(groupInfo.getServers().contains(regionOnServer));
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
index 075fb78198f..443ef742f4f 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
@@ -549,7 +549,8 @@ public class ServerManager implements ConfigurationObserver 
{
    * @return true if any RS are being processed as dead, false if not
    */
   public boolean areDeadServersInProgress() throws IOException {
-    return master.getProcedures().stream().anyMatch(p -> p instanceof 
ServerCrashProcedure);
+    return master.getProcedures().stream()
+      .anyMatch(p -> !p.isFinished() && p instanceof ServerCrashProcedure);
   }
 
   void letRegionServersShutdown() {
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java
index 94ac1823ac3..ecad5a19343 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.master;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import java.io.IOException;
 import java.util.List;
 import java.util.Set;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -93,15 +92,19 @@ public class TestDeadServer {
   }
 
   @Test
-  public void testCrashProcedureReplay() throws IOException {
+  public void testCrashProcedureReplay() throws Exception {
     HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
     final ProcedureExecutor<MasterProcedureEnv> pExecutor = 
master.getMasterProcedureExecutor();
     ServerCrashProcedure proc =
       new ServerCrashProcedure(pExecutor.getEnvironment(), hostname123, false, 
false);
 
+    pExecutor.stop();
     ProcedureTestingUtility.submitAndWait(pExecutor, proc);
-
     assertTrue(master.getServerManager().areDeadServersInProgress());
+
+    ProcedureTestingUtility.restart(pExecutor);
+    ProcedureTestingUtility.waitProcedure(pExecutor, proc);
+    assertFalse(master.getServerManager().areDeadServersInProgress());
   }
 
   @Test

Reply via email to