You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2011/07/07 18:41:34 UTC
svn commit: r1143914 - in /hbase/branches/0.90: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/HServerAddress.java
Author: tedyu
Date: Thu Jul 7 16:41:34 2011
New Revision: 1143914
URL: http://svn.apache.org/viewvc?rev=1143914&view=rev
Log:
HBASE-4074 When a RS has hostname with uppercase letter, there are two RS
entries in master
Modified:
hbase/branches/0.90/CHANGES.txt
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HServerAddress.java
Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1143914&r1=1143913&r2=1143914&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Thu Jul 7 16:41:34 2011
@@ -61,6 +61,8 @@ Release 0.90.4 - Unreleased
removed from cluster, master breaks down after restarting cluster.
HBASE-4033 The shutdown RegionServer could be added to
AssignmentManager.servers again (Jieshan Bean)
+ HBASE-4074 When a RS has hostname with uppercase letter, there are two RS
+ entries in master (Weihua Jiang via Ted Yu)
IMPROVEMENT
HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the
Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HServerAddress.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HServerAddress.java?rev=1143914&r1=1143913&r2=1143914&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HServerAddress.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HServerAddress.java Thu Jul 7 16:41:34 2011
@@ -61,7 +61,7 @@ public class HServerAddress implements W
}
String host = hostAndPort.substring(0, colonIndex);
int port = Integer.parseInt(hostAndPort.substring(colonIndex + 1));
- this.address = new InetSocketAddress(host, port);
+ this.address = getResolvedAddress(new InetSocketAddress(host, port));
this.stringValue = address.getHostName() + ":" + port;
checkBindAddressCanBeResolved();
}
@@ -71,7 +71,7 @@ public class HServerAddress implements W
* @param port Port number
*/
public HServerAddress(String bindAddress, int port) {
- this.address = new InetSocketAddress(bindAddress, port);
+ this.address = getResolvedAddress(new InetSocketAddress(bindAddress, port));
this.stringValue = address.getHostName() + ":" + port;
checkBindAddressCanBeResolved();
}
@@ -81,23 +81,31 @@ public class HServerAddress implements W
* @param other HServerAddress to copy from
*/
public HServerAddress(HServerAddress other) {
- String bindAddress = other.getBindAddress();
- int port = other.getPort();
- this.address = new InetSocketAddress(bindAddress, port);
+ this.address = getResolvedAddress(other.getInetSocketAddress());
stringValue = other.stringValue;
checkBindAddressCanBeResolved();
}
/** @return Bind address */
public String getBindAddress() {
+ return getBindAddressInternal(address);
+ }
+
+ private static String getBindAddressInternal(InetSocketAddress address) {
final InetAddress addr = address.getAddress();
if (addr != null) {
return addr.getHostAddress();
} else {
LogFactory.getLog(HServerAddress.class).error("Could not resolve the"
- + " DNS name of " + stringValue);
+ + " DNS name of " + address.getHostName());
return null;
- }
+ }
+ }
+
+ private static InetSocketAddress getResolvedAddress(InetSocketAddress address) {
+ String bindAddress = getBindAddressInternal(address);
+ int port = address.getPort();
+ return new InetSocketAddress(bindAddress, port);
}
private void checkBindAddressCanBeResolved() {
@@ -163,7 +171,7 @@ public class HServerAddress implements W
address = null;
stringValue = null;
} else {
- address = new InetSocketAddress(hostname, port);
+ address = getResolvedAddress(new InetSocketAddress(hostname, port));
stringValue = hostname + ":" + port;
checkBindAddressCanBeResolved();
}
@@ -191,5 +199,5 @@ public class HServerAddress implements W
if (o.address == null) return 1;
if (address.equals(o.address)) return 0;
return toString().compareTo(o.toString());
- }
+ }
}