Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,18 @@ private List<ServerName> filterServers(Set<Address> servers, List<ServerName> on
} catch (IOException exp) {
LOG.debug("RSGroup information null for region of table " + tableName, exp);
}
List<ServerName> candidateServers = Collections.emptyList();
if (targetRSGInfo != null) {
List<ServerName> onlineServers = Lists.newArrayList(clusterLoad.keySet());
candidateServers = filterOfflineServers(targetRSGInfo, onlineServers);
if (isFallbackEnabled() && candidateServers.isEmpty()) {
candidateServers = getFallBackCandidates(onlineServers);
}
}
for (Map.Entry<ServerName, List<RegionInfo>> serverRegionMap : clusterLoad.entrySet()) {
ServerName currentHostServer = serverRegionMap.getKey();
List<RegionInfo> regionInfoList = serverRegionMap.getValue();
if (
targetRSGInfo == null || !targetRSGInfo.containsServer(currentHostServer.getAddress())
) {
if (!candidateServers.contains(currentHostServer)) {
regionInfoList.forEach(regionInfo -> {
regionPlansForMisplacedRegions.add(new RegionPlan(regionInfo, currentHostServer, null));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hbase.rsgroup;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
Expand Down Expand Up @@ -93,10 +94,12 @@ public void testFallback() throws Exception {
// server of test group crash, regions move to default group
crashRsInGroup(groupName);
assertRegionsInGroup(tableName, RSGroupInfo.DEFAULT_GROUP);
assertEquals(0, MASTER.balance().getMovesCalculated());

// server of default group crash, regions move to any other group
crashRsInGroup(RSGroupInfo.DEFAULT_GROUP);
assertRegionsInGroup(tableName, FALLBACK_GROUP);
assertEquals(0, MASTER.balance().getMovesCalculated());

@chaijunjie0101 chaijunjie0101 Aug 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need trigger balancer once before we check the balance plan,and make sure balancer is doing to generate plan, because the default balance is scheduled


// add a new server to default group, regions move to default group
TEST_UTIL.getMiniHBaseCluster().startRegionServerAndWait(60000);
Expand Down