hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject svn commit: r1236998 - in /hbase/branches/0.90: ./ src/main/java/org/apache/hadoop/hbase/catalog/ src/main/java/org/apache/hadoop/hbase/client/ src/main/java/org/apache/hadoop/hbase/master/ src/main/java/org/apache/hadoop/hbase/regionserver/ src/main/j...
Date Sat, 28 Jan 2012 06:57:46 GMT
Author: ramkrishna
Date: Sat Jan 28 06:57:45 2012
New Revision: 1236998

URL: http://svn.apache.org/viewvc?rev=1236998&view=rev
Log:
HBASE-5153 HBASE-5153  Addendum for 0.90 branch (Jieshan)

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperNodeTracker.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Sat Jan 28 06:57:45 2012
@@ -43,6 +43,7 @@ Release 0.90.6 - Unreleased
    HBASE-5243  LogSyncerThread not getting shutdown waiting for the interrupted flag (Ram)
    HBASE-5269  IllegalMonitorStateException while retryin HLog split in 0.90 branch. (Ram)
    HBASE-5137  MasterFileSystem.splitLog() should abort even if waitOnSafeMode() throws IOException
(Ram)
+   HBASE-5153  Addendum for 0.90 branch (Jieshan)
 
   IMPROVEMENT
    HBASE-5102  Change the default value of the property "hbase.connection.per.config" to
false in

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
Sat Jan 28 06:57:45 2012
@@ -170,8 +170,8 @@ public class CatalogTracker {
   public void start() throws IOException, InterruptedException {
     
     try {
-      this.rootRegionTracker.start(true);
-      this.metaNodeTracker.start(true);
+      this.rootRegionTracker.start();
+      this.metaNodeTracker.start();
       LOG.debug("Starting catalog tracker " + this);
     }catch (RuntimeException e){
       Throwable t = e.getCause();

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
Sat Jan 28 06:57:45 2012
@@ -444,6 +444,8 @@ public class HConnectionManager {
     private volatile boolean closed;
     private volatile HMasterInterface master;
     private volatile boolean masterChecked;
+    private volatile boolean isResettingZKTrackers;
+
     // ZooKeeper reference
     private ZooKeeperWatcher zooKeeper;
     // ZooKeeper-based master address tracker
@@ -511,25 +513,28 @@ public class HConnectionManager {
           HConstants.HBASE_CLIENT_PREFETCH_LIMIT,
           HConstants.DEFAULT_HBASE_CLIENT_PREFETCH_LIMIT);
 
-      setupZookeeperTrackers(true);
+      setupZookeeperTrackers();
 
       this.master = null;
       this.masterChecked = false;
+      this.isResettingZKTrackers = false;
     }
 
-    private boolean setupZookeeperTrackers(boolean allowAbort)
+    private boolean setupZookeeperTrackers()
         throws ZooKeeperConnectionException{
       // initialize zookeeper and master address manager
       this.zooKeeper = getZooKeeperWatcher();
       this.masterAddressTracker = new MasterAddressTracker(this.zooKeeper, this);
       this.rootRegionTracker = new RootRegionTracker(this.zooKeeper, this);
-      if (!this.masterAddressTracker.start(allowAbort)) {
+      if (!this.masterAddressTracker.start()) {
+        this.zooKeeper.close();
         this.masterAddressTracker.stop();
         this.masterAddressTracker = null;
         this.zooKeeper = null;
         return false;
       }
-      if (!this.rootRegionTracker.start(allowAbort)) {
+      if (!this.rootRegionTracker.start()) {
+        this.zooKeeper.close();
         this.masterAddressTracker.stop();
         this.rootRegionTracker.stop();
         this.masterAddressTracker = null;
@@ -544,33 +549,40 @@ public class HConnectionManager {
     public synchronized void resetZooKeeperTrackersWithRetries()
         throws ZooKeeperConnectionException {
       LOG.info("Trying to reconnect to zookeeper.");
-      if (this.masterAddressTracker != null) {
-        this.masterAddressTracker.stop();
-        this.masterAddressTracker = null;
-      }
-      if (this.rootRegionTracker != null) {
-        this.rootRegionTracker.stop();
-        this.rootRegionTracker = null;
-      }
-      this.zooKeeper = null;
-      for (int tries = 0; tries < this.numRetries; tries++) {
-        boolean isLastTime = (tries == (this.numRetries - 1));
-        try {
-          if (setupZookeeperTrackers(isLastTime)) {
-            break;
+      this.isResettingZKTrackers = true;
+      try {
+        if (this.masterAddressTracker != null) {
+          this.masterAddressTracker.stop();
+          this.masterAddressTracker = null;
+        }
+        if (this.rootRegionTracker != null) {
+          this.rootRegionTracker.stop();
+          this.rootRegionTracker = null;
+        }
+        if (this.zooKeeper != null) {
+          this.zooKeeper.close();
+          this.zooKeeper = null;
+        }
+        for (int tries = 0; tries < this.numRetries; tries++) {
+          try {
+            if (setupZookeeperTrackers()) {
+              break;
+            }
+          } catch (ZooKeeperConnectionException zkce) {
+            if (tries + 1 >= this.numRetries) {
+              throw zkce;
+            }
           }
-        } catch (ZooKeeperConnectionException zkce) {
-          if (isLastTime) {
-            throw zkce;
+          LOG.info("Tried to reconnect to zookeeper but failed,  already tried "
+              + tries + " times.");
+          try {
+            Thread.sleep(ConnectionUtils.getPauseTime(this.pause, tries));
+          } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
           }
         }
-        LOG.info("Tried to reconnect to zookeeper but failed,  already tried "
-            + tries + " times.");
-        try {
-          Thread.sleep(ConnectionUtils.getPauseTime(this.pause, tries));
-        } catch (InterruptedException e1) {
-          Thread.currentThread().interrupt();
-        }
+      } finally {
+        this.isResettingZKTrackers = false;
       }
     }
 
@@ -1569,6 +1581,9 @@ public class HConnectionManager {
     public void abort(final String msg, Throwable t) {
       if ((t instanceof KeeperException.SessionExpiredException)
           || (t instanceof KeeperException.ConnectionLossException)) {
+        if (this.isResettingZKTrackers) {
+          return;
+        }
         try {
           LOG.info("This client just lost it's session with ZooKeeper, trying" +
               " to reconnect.");

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Sat Jan
28 06:57:45 2012
@@ -362,7 +362,7 @@ implements HMasterInterface, HMasterRegi
     // Set the cluster as up.  If new RSs, they'll be waiting on this before
     // going ahead with their startup.
     this.clusterStatusTracker = new ClusterStatusTracker(getZooKeeper(), this);
-    this.clusterStatusTracker.start(true);
+    this.clusterStatusTracker.start();
     boolean wasUp = this.clusterStatusTracker.isClusterUp();
     if (!wasUp) this.clusterStatusTracker.setClusterUp();
 

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Sat Jan 28 06:57:45 2012
@@ -489,13 +489,13 @@ public class HRegionServer implements HR
     // block until a master is available.  No point in starting up if no master
     // running.
     this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
-    this.masterAddressManager.start(true);
+    this.masterAddressManager.start();
     blockAndCheckIfStopped(this.masterAddressManager);
 
     // Wait on cluster being up.  Master will set this flag up in zookeeper
     // when ready.
     this.clusterStatusTracker = new ClusterStatusTracker(this.zooKeeper, this);
-    this.clusterStatusTracker.start(true);
+    this.clusterStatusTracker.start();
     blockAndCheckIfStopped(this.clusterStatusTracker);
 
     // Create the catalog tracker and start it;

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
Sat Jan 28 06:57:45 2012
@@ -171,7 +171,7 @@ public class ReplicationZookeeper {
     // Set a tracker on replicationStateNodeNode
     this.statusTracker =
         new ReplicationStatusTracker(this.zookeeper, abortable);
-    statusTracker.start(true);
+    statusTracker.start();
     readReplicationStateZnode();
   }
 

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperNodeTracker.java
Sat Jan 28 06:57:45 2012
@@ -71,7 +71,7 @@ public abstract class ZooKeeperNodeTrack
    *          KeeperException occur. 
    * @return start result. true if start successfully.
    */
-  public synchronized boolean start(boolean allowAbort) {
+  public synchronized boolean start() {
     this.watcher.registerListener(this);
     try {
       if(ZKUtil.watchAndCheckExists(watcher, node)) {
@@ -80,12 +80,12 @@ public abstract class ZooKeeperNodeTrack
           this.data = data;
         } else {
           // It existed but now does not, try again to ensure a watch is set
-          return start(allowAbort);
+          return start();
         }
       }
       return true;
     } catch (KeeperException e) {
-      if (allowAbort && (abortable != null)) {
+      if (abortable != null) {
         abortable.abort("Unexpected exception during initialization, aborting",
             e);
       }

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
Sat Jan 28 06:57:45 2012
@@ -64,7 +64,7 @@ public class TestMasterAddressManager {
 
     // Should not have a master yet
     MasterAddressTracker addressManager = new MasterAddressTracker(zk, null);
-    addressManager.start(true);
+    addressManager.start();
     assertFalse(addressManager.hasMaster());
     zk.registerListener(addressManager);
 

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperNodeTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperNodeTracker.java?rev=1236998&r1=1236997&r2=1236998&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperNodeTracker.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperNodeTracker.java
Sat Jan 28 06:57:45 2012
@@ -72,7 +72,7 @@ public class TestZooKeeperNodeTracker {
     ZooKeeperWatcher zk = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
       "testInterruptible", abortable);
     final TestTracker tracker = new TestTracker(zk, "/xyz", abortable);
-    tracker.start(true);
+    tracker.start();
     Thread t = new Thread() {
       @Override
       public void run() {
@@ -105,7 +105,7 @@ public class TestZooKeeperNodeTracker {
 
     // Start a ZKNT with no node currently available
     TestTracker localTracker = new TestTracker(zk, node, abortable);
-    localTracker.start(true);
+    localTracker.start();
     zk.registerListener(localTracker);
 
     // Make sure we don't have a node
@@ -120,7 +120,7 @@ public class TestZooKeeperNodeTracker {
 
     // Now, start a new ZKNT with the node already available
     TestTracker secondTracker = new TestTracker(zk, node, null);
-    secondTracker.start(true);
+    secondTracker.start();
     zk.registerListener(secondTracker);
 
     // Put up an additional zk listener so we know when zk event is done
@@ -213,7 +213,7 @@ public class TestZooKeeperNodeTracker {
 
     public WaitToGetDataThread(ZooKeeperWatcher zk, String node) {
       tracker = new TestTracker(zk, node, null);
-      tracker.start(true);
+      tracker.start();
       zk.registerListener(tracker);
       hasData = false;
     }



Mime
View raw message