HBASE-27237 The servername in the rsgroup table should be lowercase

This commit is contained in:
xiaozhang 2022-08-02 14:03:16 +08:00
parent 3556362c07
commit f674be7c57
3 changed files with 6 additions and 5 deletions

View File

@ -3416,7 +3416,7 @@ public final class ProtobufUtil {
RSGroupInfo rsGroupInfo = new RSGroupInfo(proto.getName());
Collection<Address> addresses = proto.getServersList().parallelStream()
.map(serverName -> Address.fromParts(serverName.getHostName(), serverName.getPort()))
.map(serverName -> Address.fromParts(serverName.getHostName().toLowerCase(Locale.ROOT), serverName.getPort()))
.collect(Collectors.toList());
rsGroupInfo.addAllServers(addresses);

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@ -162,7 +163,7 @@ class RSGroupAdminServiceImpl extends RSGroupAdminProtos.RSGroupAdminService {
MoveServersResponse.Builder builder = MoveServersResponse.newBuilder();
Set<Address> hostPorts = Sets.newHashSet();
for (HBaseProtos.ServerName el : request.getServersList()) {
hostPorts.add(Address.fromParts(el.getHostName(), el.getPort()));
hostPorts.add(Address.fromParts(el.getHostName().toLowerCase(Locale.ROOT), el.getPort()));
}
LOG.info(master.getClientIdAuditPrefix() + " move servers " + hostPorts + " to rsgroup "
+ request.getTargetGroup());
@ -357,7 +358,7 @@ class RSGroupAdminServiceImpl extends RSGroupAdminProtos.RSGroupAdminService {
MoveServersAndTablesResponse.Builder builder = MoveServersAndTablesResponse.newBuilder();
Set<Address> hostPorts = Sets.newHashSet();
for (HBaseProtos.ServerName el : request.getServersList()) {
hostPorts.add(Address.fromParts(el.getHostName(), el.getPort()));
hostPorts.add(Address.fromParts(el.getHostName().toLowerCase(Locale.ROOT), el.getPort()));
}
Set<TableName> tables = new HashSet<>(request.getTableNameList().size());
for (HBaseProtos.TableName tableName : request.getTableNameList()) {
@ -388,7 +389,7 @@ class RSGroupAdminServiceImpl extends RSGroupAdminProtos.RSGroupAdminService {
RemoveServersResponse.Builder builder = RemoveServersResponse.newBuilder();
Set<Address> servers = Sets.newHashSet();
for (HBaseProtos.ServerName el : request.getServersList()) {
servers.add(Address.fromParts(el.getHostName(), el.getPort()));
servers.add(Address.fromParts(el.getHostName().toLowerCase(Locale.ROOT), el.getPort()));
}
LOG.info(
master.getClientIdAuditPrefix() + " remove decommissioned servers from rsgroup: " + servers);

View File

@ -761,7 +761,7 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
// Get all online servers from Zookeeper and find out servers in default group
SortedSet<Address> defaultServers = Sets.newTreeSet();
for (ServerName serverName : masterServices.getServerManager().getOnlineServers().keySet()) {
Address server = Address.fromParts(serverName.getHostname(), serverName.getPort());
Address server = Address.fromParts(serverName.getHostnameLowerCase(), serverName.getPort());
if (!serversInOtherGroup.contains(server)) { // not in other groups
defaultServers.add(server);
}