HBASE-27489 Fix several problems after HBASE-27304 (#4903)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
3f1087fe82
commit
4add5250ed
|
@ -186,6 +186,7 @@ import org.apache.hbase.thirdparty.com.google.common.base.Throwables;
|
||||||
import org.apache.hbase.thirdparty.com.google.common.cache.Cache;
|
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.cache.CacheBuilder;
|
||||||
import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
|
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.BlockingRpcChannel;
|
||||||
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor;
|
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor;
|
||||||
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.ServiceDescriptor;
|
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.ServiceDescriptor;
|
||||||
|
@ -1383,9 +1384,17 @@ public class HRegionServer extends HBaseServerBase<RSRpcServices>
|
||||||
LOG.error(msg);
|
LOG.error(msg);
|
||||||
throw new IOException(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 (
|
if (
|
||||||
StringUtils.isBlank(useThisHostnameInstead)
|
StringUtils.isBlank(useThisHostnameInstead)
|
||||||
&& !hostnameFromMasterPOV.equals(rpcServices.getSocketAddress().getHostName())
|
&& !hostnameFromMasterPOV.equals(isaHostName)
|
||||||
) {
|
) {
|
||||||
String msg = "Master passed us a different hostname to use; was="
|
String msg = "Master passed us a different hostname to use; was="
|
||||||
+ rpcServices.getSocketAddress().getHostName() + ", but now=" + hostnameFromMasterPOV;
|
+ rpcServices.getSocketAddress().getHostName() + ", but now=" + hostnameFromMasterPOV;
|
||||||
|
|
Loading…
Reference in New Issue