hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1305663 - in /hbase/branches/0.92: ./ src/main/java/org/apache/hadoop/hbase/ src/main/java/org/apache/hadoop/hbase/master/
Date Mon, 26 Mar 2012 23:06:25 GMT
Author: jmhsieh
Date: Mon Mar 26 23:06:24 2012
New Revision: 1305663

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

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

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1305663&r1=1305662&r2=1305663&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Mon Mar 26 23:06:24 2012
@@ -16,6 +16,7 @@ Release 0.92.2 - Unreleased
    HBASE-5624  Aborting regionserver when splitting region, may cause daughter
                region not assigned by ServerShutdownHandler (Chunhui Shen)
    HBASE-5615  The master never does balance because of balancing the parent region (Xufeng)
+   HBASE-5596  Few minor bugs from HBASE-5209 (David S. Wang)
 
   IMPROVEMENTS
    HBASE-5592  Make it easier to get a table from shell (Ben West)

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java?rev=1305663&r1=1305662&r2=1305663&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java Mon Mar 26
23:06:24 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.92/src/main/java/org/apache/hadoop/hbase/ServerName.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ServerName.java?rev=1305663&r1=1305662&r2=1305663&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ServerName.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/ServerName.java Mon Mar 26 23:06:24
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.92/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java?rev=1305663&r1=1305662&r2=1305663&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
(original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
Mon Mar 26 23:06:24 2012
@@ -165,7 +165,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.92/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1305663&r1=1305662&r2=1305663&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Mon Mar
26 23:06:24 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;
@@ -1251,8 +1253,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