Index: src/test/java/org/apache/hadoop/hbase/TestServerName.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/TestServerName.java (revision 1190158) +++ src/test/java/org/apache/hadoop/hbase/TestServerName.java (working copy) @@ -33,10 +33,11 @@ public void testRegexPatterns() { assertTrue(Pattern.matches(Addressing.VALID_PORT_REGEX, "123")); assertFalse(Pattern.matches(Addressing.VALID_PORT_REGEX, "")); - assertTrue(Pattern.matches(Addressing.VALID_HOSTNAME_REGEX, "example.org")); - assertTrue(Pattern.matches(Addressing.VALID_HOSTNAME_REGEX, - "www1.example.org")); assertTrue(ServerName.SERVERNAME_PATTERN.matcher("www1.example.org,1234,567").matches()); + ServerName.parseServerName("a.b.c,58102,1319771740322"); + ServerName.parseServerName("192.168.1.199,58102,1319771740322"); + ServerName.parseServerName("a.b.c:58102"); + ServerName.parseServerName("192.168.1.199:58102"); } @Test public void testParseOfBytes() { Index: src/main/java/org/apache/hadoop/hbase/util/Addressing.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/Addressing.java (revision 1190158) +++ src/main/java/org/apache/hadoop/hbase/util/Addressing.java (working copy) @@ -25,20 +25,6 @@ * Utility for network addresses, resolving and naming. */ public class Addressing { - /** - * Regex for RFC952 hostname matching. Does not have a '$" on the end. Can - * be used as prefix on a larger regex. - * @see http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address - */ - public static final String VALID_HOSTNAME_REGEX_PREFIX = - "^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9])"; - /** - * Regex for RFC952 hostname matching. - * @see http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address - */ - public static final String VALID_HOSTNAME_REGEX = - VALID_HOSTNAME_REGEX_PREFIX + "$"; - public static final String VALID_PORT_REGEX = "[\\d]+"; public static final String HOSTNAME_PORT_SEPARATOR = ":"; Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1190158) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -1018,7 +1018,6 @@ /** * @param encodedRegionName * @return An instance of RegionLoad. - * @throws IOException */ public HServerLoad.RegionLoad createRegionLoad(final String encodedRegionName) { HRegion r = null; Index: src/main/java/org/apache/hadoop/hbase/ServerName.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/ServerName.java (revision 1190158) +++ src/main/java/org/apache/hadoop/hbase/ServerName.java (working copy) @@ -65,7 +65,7 @@ public static final String SERVERNAME_SEPARATOR = ","; public static Pattern SERVERNAME_PATTERN = - Pattern.compile(Addressing.VALID_HOSTNAME_REGEX_PREFIX + + Pattern.compile("[^" + SERVERNAME_SEPARATOR + "]+" + SERVERNAME_SEPARATOR + Addressing.VALID_PORT_REGEX + SERVERNAME_SEPARATOR + Addressing.VALID_PORT_REGEX + "$"); @@ -286,4 +286,4 @@ return SERVERNAME_PATTERN.matcher(str).matches()? new ServerName(str): new ServerName(str, NON_STARTCODE); } -} +} \ No newline at end of file Index: src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java (revision 1190158) +++ src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java (working copy) @@ -42,7 +42,7 @@ * for the active master to fail. * *

This class is instantiated in the HMaster constructor and the method - * {@link #blockUntilBecomingActiveMaster()} is called to wait until becoming + * #blockUntilBecomingActiveMaster() is called to wait until becoming * the active master of the cluster. */ class ActiveMasterManager extends ZooKeeperListener { @@ -128,10 +128,11 @@ boolean blockUntilBecomingActiveMaster(MonitoredTask startupStatus) { startupStatus.setStatus("Trying to register in ZK as active master"); boolean cleanSetOfActiveMaster = true; - // Try to become the active master, watch if there is another master + // Try to become the active master, watch if there is another master. + // Write out our ServerName as versioned bytes. try { if (ZKUtil.createEphemeralNodeAndWatch(this.watcher, - this.watcher.masterAddressZNode, Bytes.toBytes(this.sn.toString()))) { + this.watcher.masterAddressZNode, sn.getVersionedBytes())) { // We are the master, return startupStatus.setStatus("Successfully registered as active master."); this.clusterHasActiveMaster.set(true);