Skip to content

Commit

Permalink
HBASE-27489 Fix several problems after HBASE-27304 (#4903)
Browse files Browse the repository at this point in the history
Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
2005hithlj authored Jan 10, 2023
1 parent 3f1087f commit 4add525
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
import org.apache.hbase.thirdparty.com.google.common.cache.Cache;
import org.apache.hbase.thirdparty.com.google.common.cache.CacheBuilder;
import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
import org.apache.hbase.thirdparty.com.google.common.net.InetAddresses;
import org.apache.hbase.thirdparty.com.google.protobuf.BlockingRpcChannel;
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor;
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.ServiceDescriptor;
Expand Down Expand Up @@ -1383,9 +1384,17 @@ protected void handleReportForDutyResponse(final RegionServerStartupResponse c)
LOG.error(msg);
throw new IOException(msg);
}
// if Master use-ip is enabled, RegionServer use-ip will be enabled by default even if it
// is set to disable. so we will use the ip of the RegionServer to compare with the
// hostname passed by the Master, see HBASE-27304 for details.
InetSocketAddress isa = rpcServices.getSocketAddress();
// here getActiveMaster() is definitely not null.
String isaHostName = InetAddresses.isInetAddress(getActiveMaster().get().getHostname())
? isa.getAddress().getHostAddress()
: isa.getHostName();
if (
StringUtils.isBlank(useThisHostnameInstead)
&& !hostnameFromMasterPOV.equals(rpcServices.getSocketAddress().getHostName())
&& !hostnameFromMasterPOV.equals(isaHostName)
) {
String msg = "Master passed us a different hostname to use; was="
+ rpcServices.getSocketAddress().getHostName() + ", but now=" + hostnameFromMasterPOV;
Expand Down

0 comments on commit 4add525

Please sign in to comment.