HBASE-26394 Cache in RSRpcServices.executeProcedures does not take effect (#3794)

Signed-off-by: Xiaolin Ha <haxiaolin@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
chenglei 2021-10-26 14:44:33 +08:00 committed by GitHub
parent 7af5277859
commit 773ff28967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -3759,7 +3759,8 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
long masterSystemTime = request.hasMasterSystemTime() ? request.getMasterSystemTime() : -1; long masterSystemTime = request.hasMasterSystemTime() ? request.getMasterSystemTime() : -1;
for (RegionOpenInfo regionOpenInfo : request.getOpenInfoList()) { for (RegionOpenInfo regionOpenInfo : request.getOpenInfoList()) {
RegionInfo regionInfo = ProtobufUtil.toRegionInfo(regionOpenInfo.getRegion()); RegionInfo regionInfo = ProtobufUtil.toRegionInfo(regionOpenInfo.getRegion());
TableDescriptor tableDesc = tdCache.get(regionInfo.getTable()); TableName tableName = regionInfo.getTable();
TableDescriptor tableDesc = tdCache.get(tableName);
if (tableDesc == null) { if (tableDesc == null) {
try { try {
tableDesc = server.getTableDescriptors().get(regionInfo.getTable()); tableDesc = server.getTableDescriptors().get(regionInfo.getTable());
@ -3771,6 +3772,9 @@ public class RSRpcServices extends HBaseRpcServicesBase<HRegionServer>
LOG.warn("Failed to get TableDescriptor of {}, will try again in the handler", LOG.warn("Failed to get TableDescriptor of {}, will try again in the handler",
regionInfo.getTable(), e); regionInfo.getTable(), e);
} }
if(tableDesc != null) {
tdCache.put(tableName, tableDesc);
}
} }
if (regionOpenInfo.getFavoredNodesCount() > 0) { if (regionOpenInfo.getFavoredNodesCount() > 0) {
server.updateRegionFavoredNodesMapping(regionInfo.getEncodedName(), server.updateRegionFavoredNodesMapping(regionInfo.getEncodedName(),