File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 186186import org .apache .hbase .thirdparty .com .google .common .cache .Cache ;
187187import org .apache .hbase .thirdparty .com .google .common .cache .CacheBuilder ;
188188import org .apache .hbase .thirdparty .com .google .common .collect .Maps ;
189+ import org .apache .hbase .thirdparty .com .google .common .net .InetAddresses ;
189190import org .apache .hbase .thirdparty .com .google .protobuf .BlockingRpcChannel ;
190191import org .apache .hbase .thirdparty .com .google .protobuf .Descriptors .MethodDescriptor ;
191192import org .apache .hbase .thirdparty .com .google .protobuf .Descriptors .ServiceDescriptor ;
@@ -1383,9 +1384,17 @@ protected void handleReportForDutyResponse(final RegionServerStartupResponse c)
13831384 LOG .error (msg );
13841385 throw new IOException (msg );
13851386 }
1387+ // if Master use-ip is enabled, RegionServer use-ip will be enabled by default even if it
1388+ // is set to disable. so we will use the ip of the RegionServer to compare with the
1389+ // hostname passed by the Master, see HBASE-27304 for details.
1390+ InetSocketAddress isa = rpcServices .getSocketAddress ();
1391+ // here getActiveMaster() is definitely not null.
1392+ String isaHostName = InetAddresses .isInetAddress (getActiveMaster ().get ().getHostname ())
1393+ ? isa .getAddress ().getHostAddress ()
1394+ : isa .getHostName ();
13861395 if (
13871396 StringUtils .isBlank (useThisHostnameInstead )
1388- && !hostnameFromMasterPOV .equals (rpcServices . getSocketAddress (). getHostName () )
1397+ && !hostnameFromMasterPOV .equals (isaHostName )
13891398 ) {
13901399 String msg = "Master passed us a different hostname to use; was="
13911400 + rpcServices .getSocketAddress ().getHostName () + ", but now=" + hostnameFromMasterPOV ;
You can’t perform that action at this time.
0 commit comments