HBASE-3286 Master passes IP and not hostname back to region server
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1040848 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
826fbd99ff
commit
d4eeff6d35
@ -726,6 +726,7 @@ Release 0.90.0 - Unreleased
|
|||||||
HBASE-3265 Regionservers waiting for ROOT while Master waiting for RegionServers
|
HBASE-3265 Regionservers waiting for ROOT while Master waiting for RegionServers
|
||||||
HBASE-3263 Stack overflow in AssignmentManager
|
HBASE-3263 Stack overflow in AssignmentManager
|
||||||
HBASE-3234 hdfs-724 "breaks" TestHBaseTestingUtility multiClusters
|
HBASE-3234 hdfs-724 "breaks" TestHBaseTestingUtility multiClusters
|
||||||
|
HBASE-3286 Master passes IP and not hostname back to region server
|
||||||
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
@ -62,7 +62,7 @@ public class HServerAddress implements WritableComparable<HServerAddress> {
|
|||||||
String host = hostAndPort.substring(0, colonIndex);
|
String host = hostAndPort.substring(0, colonIndex);
|
||||||
int port = Integer.parseInt(hostAndPort.substring(colonIndex + 1));
|
int port = Integer.parseInt(hostAndPort.substring(colonIndex + 1));
|
||||||
this.address = new InetSocketAddress(host, port);
|
this.address = new InetSocketAddress(host, port);
|
||||||
this.stringValue = hostAndPort;
|
this.stringValue = address.getHostName() + ":" + port;
|
||||||
checkBindAddressCanBeResolved();
|
checkBindAddressCanBeResolved();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class HServerAddress implements WritableComparable<HServerAddress> {
|
|||||||
*/
|
*/
|
||||||
public HServerAddress(String bindAddress, int port) {
|
public HServerAddress(String bindAddress, int port) {
|
||||||
this.address = new InetSocketAddress(bindAddress, port);
|
this.address = new InetSocketAddress(bindAddress, port);
|
||||||
this.stringValue = bindAddress + ":" + port;
|
this.stringValue = address.getHostName() + ":" + port;
|
||||||
checkBindAddressCanBeResolved();
|
checkBindAddressCanBeResolved();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,15 +156,15 @@ public class HServerAddress implements WritableComparable<HServerAddress> {
|
|||||||
//
|
//
|
||||||
|
|
||||||
public void readFields(DataInput in) throws IOException {
|
public void readFields(DataInput in) throws IOException {
|
||||||
String bindAddress = in.readUTF();
|
String hostname = in.readUTF();
|
||||||
int port = in.readInt();
|
int port = in.readInt();
|
||||||
|
|
||||||
if (bindAddress == null || bindAddress.length() == 0) {
|
if (hostname == null || hostname.length() == 0) {
|
||||||
address = null;
|
address = null;
|
||||||
stringValue = null;
|
stringValue = null;
|
||||||
} else {
|
} else {
|
||||||
address = new InetSocketAddress(bindAddress, port);
|
address = new InetSocketAddress(hostname, port);
|
||||||
stringValue = bindAddress + ":" + port;
|
stringValue = hostname + ":" + port;
|
||||||
checkBindAddressCanBeResolved();
|
checkBindAddressCanBeResolved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ public class HServerAddress implements WritableComparable<HServerAddress> {
|
|||||||
out.writeUTF("");
|
out.writeUTF("");
|
||||||
out.writeInt(0);
|
out.writeInt(0);
|
||||||
} else {
|
} else {
|
||||||
out.writeUTF(address.getAddress().getHostAddress());
|
out.writeUTF(address.getAddress().getHostName());
|
||||||
out.writeInt(address.getPort());
|
out.writeInt(address.getPort());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ public class HServerInfo implements WritableComparable<HServerInfo> {
|
|||||||
|
|
||||||
public synchronized void setServerAddress(HServerAddress serverAddress) {
|
public synchronized void setServerAddress(HServerAddress serverAddress) {
|
||||||
this.serverAddress = serverAddress;
|
this.serverAddress = serverAddress;
|
||||||
|
this.hostname = serverAddress.getHostname();
|
||||||
this.serverName = null;
|
this.serverName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.master;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -599,16 +600,18 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
|
|||||||
// not the ip that the master sees here. See at end of this method where
|
// not the ip that the master sees here. See at end of this method where
|
||||||
// we pass it back to the regionserver by setting "hbase.regionserver.address"
|
// we pass it back to the regionserver by setting "hbase.regionserver.address"
|
||||||
// Everafter, the HSI combination 'server name' is what uniquely identifies
|
// Everafter, the HSI combination 'server name' is what uniquely identifies
|
||||||
// the incoming RegionServer. No more DNS meddling of this little messing
|
// the incoming RegionServer.
|
||||||
// belose.
|
InetSocketAddress address = new InetSocketAddress(
|
||||||
String rsAddress = HBaseServer.getRemoteAddress();
|
HBaseServer.getRemoteIp().getHostName(),
|
||||||
serverInfo.setServerAddress(new HServerAddress(rsAddress,
|
serverInfo.getServerAddress().getPort());
|
||||||
serverInfo.getServerAddress().getPort()));
|
serverInfo.setServerAddress(new HServerAddress(address));
|
||||||
|
|
||||||
// Register with server manager
|
// Register with server manager
|
||||||
this.serverManager.regionServerStartup(serverInfo, serverCurrentTime);
|
this.serverManager.regionServerStartup(serverInfo, serverCurrentTime);
|
||||||
// Send back some config info
|
// Send back some config info
|
||||||
MapWritable mw = createConfigurationSubset();
|
MapWritable mw = createConfigurationSubset();
|
||||||
mw.put(new Text("hbase.regionserver.address"), new Text(rsAddress));
|
mw.put(new Text("hbase.regionserver.address"),
|
||||||
|
serverInfo.getServerAddress());
|
||||||
return mw;
|
return mw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,31 +801,22 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||||||
protected void handleReportForDutyResponse(final MapWritable c) throws IOException {
|
protected void handleReportForDutyResponse(final MapWritable c) throws IOException {
|
||||||
try {
|
try {
|
||||||
for (Map.Entry<Writable, Writable> e : c.entrySet()) {
|
for (Map.Entry<Writable, Writable> e : c.entrySet()) {
|
||||||
|
|
||||||
String key = e.getKey().toString();
|
String key = e.getKey().toString();
|
||||||
|
// Use the address the master passed us
|
||||||
|
if (key.equals("hbase.regionserver.address")) {
|
||||||
|
HServerAddress hsa = (HServerAddress) e.getValue();
|
||||||
|
LOG.info("Master passed us address to use. Was="
|
||||||
|
+ this.serverInfo.getServerAddress() + ", Now=" + hsa.toString());
|
||||||
|
this.serverInfo.setServerAddress(hsa);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String value = e.getValue().toString();
|
String value = e.getValue().toString();
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Config from master: " + key + "=" + value);
|
LOG.debug("Config from master: " + key + "=" + value);
|
||||||
}
|
}
|
||||||
this.conf.set(key, value);
|
this.conf.set(key, value);
|
||||||
}
|
}
|
||||||
// Master may have sent us a new address with the other configs.
|
|
||||||
// Update our address in this case. See HBASE-719
|
|
||||||
String hra = conf.get("hbase.regionserver.address");
|
|
||||||
// TODO: The below used to be this.address != null. Was broken by what
|
|
||||||
// looks like a mistake in:
|
|
||||||
//
|
|
||||||
// HBASE-1215 migration; metautils scan of meta region was broken;
|
|
||||||
// wouldn't see first row
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// r796326 | stack | 2009-07-21 07:40:34 -0700 (Tue, 21 Jul 2009) | 38
|
|
||||||
// lines
|
|
||||||
if (hra != null) {
|
|
||||||
HServerAddress hsa = new HServerAddress(hra, this.serverInfo
|
|
||||||
.getServerAddress().getPort());
|
|
||||||
LOG.info("Master passed us address to use. Was="
|
|
||||||
+ this.serverInfo.getServerAddress() + ", Now=" + hsa.toString());
|
|
||||||
this.serverInfo.setServerAddress(hsa);
|
|
||||||
}
|
|
||||||
|
|
||||||
// hack! Maps DFSClient => RegionServer for logs. HDFS made this
|
// hack! Maps DFSClient => RegionServer for logs. HDFS made this
|
||||||
// config param for task trackers, but we can piggyback off of it.
|
// config param for task trackers, but we can piggyback off of it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user