hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1305662 - in /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase: ClusterStatus.java ServerName.java master/ActiveMasterManager.java master/HMaster.java
Date Mon, 26 Mar 2012 23:06:16 GMT
Author: jmhsieh
Date: Mon Mar 26 23:06:16 2012
New Revision: 1305662

URL: http://svn.apache.org/viewvc?rev=1305662&view=rev
Log:
HBASE-5596 Few minor bugs from HBASE-5209 (David S. Wang)

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ServerName.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java?rev=1305662&r1=1305661&r2=1305662&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java Mon Mar 26
23:06:16 2012
@@ -67,7 +67,6 @@ public class ClusterStatus extends Versi
    */
   private static final byte VERSION_MASTER_BACKUPMASTERS = 2;
   private static final byte VERSION = 2;
-  private static final String UNKNOWN_SERVERNAME = "unknown";
 
   private String hbaseVersion;
   private Map<ServerName, HServerLoad> liveServers;
@@ -173,11 +172,11 @@ public class ClusterStatus extends Versi
     return (getVersion() == ((ClusterStatus)o).getVersion()) &&
       getHBaseVersion().equals(((ClusterStatus)o).getHBaseVersion()) &&
       this.liveServers.equals(((ClusterStatus)o).liveServers) &&
-      this.deadServers.equals(((ClusterStatus)o).deadServers) &&
+      this.deadServers.containsAll(((ClusterStatus)o).deadServers) &&
       Arrays.equals(this.masterCoprocessors,
                     ((ClusterStatus)o).masterCoprocessors) &&
       this.master.equals(((ClusterStatus)o).master) &&
-      this.backupMasters.equals(((ClusterStatus)o).backupMasters);
+      this.backupMasters.containsAll(((ClusterStatus)o).backupMasters);
   }
 
   /**
@@ -340,7 +339,7 @@ public class ClusterStatus extends Versi
                                  Bytes.readByteArray(in)));
       }
     } else {
-      this.master = new ServerName(UNKNOWN_SERVERNAME, -1,
+      this.master = new ServerName(ServerName.UNKNOWN_SERVERNAME, -1,
                                    ServerName.NON_STARTCODE);
       this.backupMasters = new ArrayList<ServerName>(0);
     }

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ServerName.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ServerName.java?rev=1305662&r1=1305661&r2=1305662&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ServerName.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ServerName.java Mon Mar 26 23:06:16
2012
@@ -69,6 +69,11 @@ public class ServerName implements Compa
       SERVERNAME_SEPARATOR + Addressing.VALID_PORT_REGEX +
       SERVERNAME_SEPARATOR + Addressing.VALID_PORT_REGEX + "$");
 
+  /**
+   * What to use if server name is unknown.
+   */
+  public static final String UNKNOWN_SERVERNAME = "#unknown#";
+
   private final String servername;
   private final String hostname;
   private final int port;
@@ -287,4 +292,4 @@ public class ServerName implements Compa
     return SERVERNAME_PATTERN.matcher(str).matches()? new ServerName(str):
       new ServerName(str, NON_STARTCODE);
   }
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java?rev=1305662&r1=1305661&r2=1305662&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
Mon Mar 26 23:06:16 2012
@@ -167,7 +167,7 @@ class ActiveMasterManager extends ZooKee
       LOG.info("Adding ZNode for " + backupZNode +
                " in backup master directory");
       ZKUtil.createEphemeralNodeAndWatch(this.watcher, backupZNode,
-          HConstants.EMPTY_BYTE_ARRAY);
+          this.sn.getVersionedBytes());
 
       String msg;
       byte [] bytes =

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1305662&r1=1305661&r2=1305662&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Mon Mar
26 23:06:16 2012
@@ -25,6 +25,8 @@ import java.lang.reflect.InvocationTarge
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -1438,8 +1440,20 @@ Server {
     List<ServerName> backupMasters = new ArrayList<ServerName>(
                                           backupMasterStrings.size());
     for (String s: backupMasterStrings) {
-      backupMasters.add(new ServerName(s));
+      try {
+        byte[] bytes = ZKUtil.getData(this.zooKeeper, ZKUtil.joinZNode(this.zooKeeper.backupMasterAddressesZNode,
s));
+        if (bytes != null) {
+          backupMasters.add(ServerName.parseVersionedServerName(bytes));
+        }
+      } catch (KeeperException e) {
+        LOG.warn(this.zooKeeper.prefix("Unable to get information about " +
+                 "backup servers"), e);
+      }
     }
+    Collections.sort(backupMasters, new Comparator<ServerName>() {
+      public int compare(ServerName s1, ServerName s2) {
+        return s1.getServerName().compareTo(s2.getServerName());
+      }});
 
     return new ClusterStatus(VersionInfo.getVersion(),
       this.fileSystemManager.getClusterId(),



Mime
View raw message