hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r830447 - in /hadoop/hbase/trunk/src: contrib/transactional/src/test/org/apache/hadoop/hbase/regionserver/transactional/ java/org/apache/hadoop/hbase/client/ java/org/apache/hadoop/hbase/master/ java/org/apache/hadoop/hbase/regionserver/ ja...
Date Wed, 28 Oct 2009 06:06:55 GMT
Author: stack
Date: Wed Oct 28 06:06:54 2009
New Revision: 830447

URL: http://svn.apache.org/viewvc?rev=830447&view=rev
Log:
HBASE-1816 Master rewrite; remove safe-mode

Modified:
    hadoop/hbase/trunk/src/contrib/transactional/src/test/org/apache/hadoop/hbase/regionserver/transactional/TestTHLogRecovery.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestZooKeeper.java

Modified: hadoop/hbase/trunk/src/contrib/transactional/src/test/org/apache/hadoop/hbase/regionserver/transactional/TestTHLogRecovery.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/transactional/src/test/org/apache/hadoop/hbase/regionserver/transactional/TestTHLogRecovery.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/transactional/src/test/org/apache/hadoop/hbase/regionserver/transactional/TestTHLogRecovery.java
(original)
+++ hadoop/hbase/trunk/src/contrib/transactional/src/test/org/apache/hadoop/hbase/regionserver/transactional/TestTHLogRecovery.java
Wed Oct 28 06:06:54 2009
@@ -86,10 +86,9 @@
 
   @Override
   protected void setUp() throws Exception {
-    /*FileSystem lfs = FileSystem.getLocal(conf);
+    FileSystem lfs = FileSystem.getLocal(conf);
     Path p = new Path(conf.get(HConstants.HBASE_DIR));
     if (lfs.exists(p)) lfs.delete(p, true);
-    */
     super.setUp();
 
     HTableDescriptor desc = new HTableDescriptor(TABLE_NAME);

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java Wed
Oct 28 06:06:54 2009
@@ -907,10 +907,7 @@
         while (rootRegionAddress == null && localTimeouts < numRetries) {
           // Don't read root region until we're out of safe mode so we know
           // that the meta regions have been assigned.
-          boolean outOfSafeMode = zk.checkOutOfSafeMode();
-          if (outOfSafeMode) {
-            rootRegionAddress = zk.readRootRegionLocation();
-          }
+          rootRegionAddress = zk.readRootRegionLocation();
           if (rootRegionAddress == null) {
             try {
               if (LOG.isDebugEnabled()) {

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/RegionManager.java Wed Oct
28 06:06:54 2009
@@ -66,9 +66,7 @@
   
   private AtomicReference<HServerAddress> rootRegionLocation =
     new AtomicReference<HServerAddress>(null);
-  
-  private volatile boolean safeMode = true;
-  
+
   final Lock splitLogLock = new ReentrantLock();
   
   private final RootScanner rootScannerThread;
@@ -201,11 +199,7 @@
       regionsAwaitingAssignment(info.getServerAddress(), isSingleServer);
     if (regionsToAssign.size() == 0) {
       // There are no regions waiting to be assigned.
-      if (!inSafeMode()) {
-        // We only do load balancing once all regions are assigned.
-        // This prevents churn while the cluster is starting up.
-        loadBalancer.loadBalancing(info, mostLoadedRegions, returnMsgs);
-      }
+      this.loadBalancer.loadBalancing(info, mostLoadedRegions, returnMsgs);
     } else {
       // if there's only one server, just give it all the regions
       if (isSingleServer) {
@@ -1066,39 +1060,6 @@
     return metaScannerThread.isInitialScanComplete();
   }
 
-  private boolean tellZooKeeperOutOfSafeMode() {
-    for (int attempt = 0; attempt < zooKeeperNumRetries; ++attempt) {
-      if (zooKeeperWrapper.writeOutOfSafeMode()) {
-        return true;
-      }
-
-      sleep(attempt);
-    }
-
-    LOG.error("Failed to tell ZooKeeper we're out of safe mode after " +
-              zooKeeperNumRetries + " retries");
-
-    return false;
-  }
-
-  /** 
-   * @return true if the initial meta scan is complete and there are no
-   * unassigned or pending regions
-   */
-  public boolean inSafeMode() {
-    if (safeMode) {
-      if(isInitialMetaScanComplete() && regionsInTransition.size() == 0 &&
-         tellZooKeeperOutOfSafeMode()) {
-        master.getServerConnection().unsetRootRegionLocation();
-        safeMode = false;
-        LOG.info("exiting safe mode");
-      } else {
-        LOG.info("in safe mode");
-      }
-    }
-    return safeMode;
-  }
-  
   /** 
    * Get the root region location.
    * @return HServerAddress describing root region server.

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java Wed Oct
28 06:06:54 2009
@@ -575,10 +575,8 @@
 
           // Store the Root Region location (in memory)
           HServerAddress rootServer = serverInfo.getServerAddress();
-          if (this.master.getRegionManager().inSafeMode()) {
-            this.master.getServerConnection().setRootRegionLocation(
-                new HRegionLocation(region, rootServer));
-          }
+          this.master.getServerConnection().setRootRegionLocation(
+            new HRegionLocation(region, rootServer));
           this.master.getRegionManager().setRootRegionLocation(rootServer);
         } else {
           // Note that the table has been assigned and is waiting for the

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Wed
Oct 28 06:06:54 2009
@@ -486,15 +486,7 @@
                 !restart && !stopRequested.get() && i < msgs.length;
                 i++) {
               LOG.info(msgs[i].toString());
-              if (safeMode.get()) {
-                if (zooKeeperWrapper.checkOutOfSafeMode()) {
-                  this.connection.unsetRootRegionLocation();
-                  synchronized (safeMode) {
-                    safeMode.set(false);
-                    safeMode.notifyAll();
-                  }
-                }
-              }
+              this.connection.unsetRootRegionLocation();
               switch(msgs[i].getType()) {
               case MSG_CALL_SERVER_STARTUP:
                 // We the MSG_CALL_SERVER_STARTUP on startup but we can also

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Wed
Oct 28 06:06:54 2009
@@ -62,7 +62,6 @@
 
   private final String parentZNode;
   private final String rootRegionZNode;
-  private final String outOfSafeModeZNode;
   private final String rsZNode;
   private final String masterElectionZNode;
   public final String clusterStateZNode;
@@ -94,8 +93,6 @@
 
     String rootServerZNodeName = conf.get("zookeeper.znode.rootserver",
                                           "root-region-server");
-    String outOfSafeModeZNodeName = conf.get("zookeeper.znode.safemode",
-                                             "safe-mode");
     String rsZNodeName = conf.get("zookeeper.znode.rs", "rs");
     String masterAddressZNodeName = conf.get("zookeeper.znode.master",
       "master");
@@ -103,7 +100,6 @@
     "shutdown");
     
     rootRegionZNode = getZNode(parentZNode, rootServerZNodeName);
-    outOfSafeModeZNode = getZNode(parentZNode, outOfSafeModeZNodeName);
     rsZNode = getZNode(parentZNode, rsZNodeName);
     masterElectionZNode = getZNode(parentZNode, masterAddressZNodeName);
     clusterStateZNode = getZNode(parentZNode, stateZNodeName);
@@ -169,7 +165,6 @@
     StringBuilder sb = new StringBuilder();
     sb.append("\nHBase tree in ZooKeeper is rooted at ").append(parentZNode);
     sb.append("\n  Cluster up? ").append(exists(clusterStateZNode));
-    sb.append("\n  In safe mode? ").append(!checkOutOfSafeMode());
     sb.append("\n  Master address: ").append(readMasterAddress(null));
     sb.append("\n  Region server holding ROOT: ").append(readRootRegionLocation());
     sb.append("\n  Region servers:");
@@ -470,42 +465,6 @@
   }
 
   /**
-   * Check if we're out of safe mode. Being out of safe mode is signified by an
-   * ephemeral ZNode existing in ZooKeeper.
-   * @return true if we're out of safe mode, false otherwise.
-   */
-  public boolean checkOutOfSafeMode() {
-    if (!ensureParentExists(outOfSafeModeZNode)) {
-      return false;
-    }
-
-    return checkExistenceOf(outOfSafeModeZNode);
-  }
-
-  /**
-   * Create ephemeral ZNode signifying that we're out of safe mode.
-   * @return true if ephemeral ZNode created successfully, false otherwise.
-   */
-  public boolean writeOutOfSafeMode() {
-    if (!ensureParentExists(outOfSafeModeZNode)) {
-      return false;
-    }
-
-    try {
-      zooKeeper.create(outOfSafeModeZNode, new byte[0], Ids.OPEN_ACL_UNSAFE,
-                       CreateMode.EPHEMERAL);
-      LOG.debug("Wrote out of safe mode");
-      return true;
-    } catch (InterruptedException e) {
-      LOG.warn("Failed to create out of safe mode in ZooKeeper: " + e);
-    } catch (KeeperException e) {
-      LOG.warn("Failed to create out of safe mode in ZooKeeper: " + e);
-    }
-
-    return false;
-  }
-  
-  /**
    * Write in ZK this RS startCode and address.
    * Ensures that the full path exists.
    * @param info The RS info

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestZooKeeper.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestZooKeeper.java?rev=830447&r1=830446&r2=830447&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestZooKeeper.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestZooKeeper.java Wed Oct 28 06:06:54
2009
@@ -54,9 +54,6 @@
   public void testWritesRootRegionLocation() throws IOException {
     ZooKeeperWrapper zooKeeper = new ZooKeeperWrapper(conf, EmptyWatcher.instance);
 
-    boolean outOfSafeMode = zooKeeper.checkOutOfSafeMode();
-    assertFalse(outOfSafeMode);
-
     HServerAddress zooKeeperRootAddress = zooKeeper.readRootRegionLocation();
     assertNull(zooKeeperRootAddress);
 
@@ -66,9 +63,6 @@
 
     new HTable(conf, HConstants.META_TABLE_NAME);
 
-    outOfSafeMode = zooKeeper.checkOutOfSafeMode();
-    assertTrue(outOfSafeMode);
-
     zooKeeperRootAddress = zooKeeper.readRootRegionLocation();
     assertNotNull(zooKeeperRootAddress);
 
@@ -77,17 +71,6 @@
   }
 
   /**
-   * @throws IOException
-   */
-  public void testParentExists() throws IOException {
-    String oldValue = conf.get("zookeeper.znode.safemode");
-    conf.set("zookeeper.znode.safemode", "/a/b/c/d/e");
-    ZooKeeperWrapper zooKeeper = new ZooKeeperWrapper(conf, EmptyWatcher.instance);
-    assertTrue(zooKeeper.writeOutOfSafeMode());
-    conf.set("zookeeper.znode.safemode", oldValue);
-  }
-
-  /**
    * See HBASE-1232 and http://wiki.apache.org/hadoop/ZooKeeper/FAQ#4.
    * @throws IOException
    * @throws InterruptedException



Mime
View raw message