hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r793970 - in /hadoop/hbase/branches/0.19: CHANGES.txt src/java/org/apache/hadoop/hbase/master/BaseScanner.java src/java/org/apache/hadoop/hbase/master/HMaster.java
Date Tue, 14 Jul 2009 16:47:44 GMT
Author: jdcryans
Date: Tue Jul 14 16:47:44 2009
New Revision: 793970

URL: http://svn.apache.org/viewvc?rev=793970&view=rev
Log:
HBASE-698   HLog recovery is not performed after master failure
Old setups should first delete eveything that's log_* in HBase
root HDFS folder before updating.

Modified:
    hadoop/hbase/branches/0.19/CHANGES.txt
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/HMaster.java

Modified: hadoop/hbase/branches/0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/CHANGES.txt?rev=793970&r1=793969&r2=793970&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.19/CHANGES.txt Tue Jul 14 16:47:44 2009
@@ -19,6 +19,7 @@
                into .META. but catalog scanner just got old values
    HBASE-1618  Investigate further into the MemStoreFlusher StoreFile limit
                (Jon Gray via Stack)
+   HBASE-698   HLog recovery is not performed after master failure
 
 Release 0.19.3 - May 27th, 2009
   BUG FIXES

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=793970&r1=793969&r2=793970&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/BaseScanner.java (original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/BaseScanner.java Tue
Jul 14 16:47:44 2009
@@ -381,34 +381,6 @@
                 startCode + ", storedInfo.startCode: " +
                 storedInfo.getStartCode()));
         }
-
-        // Recover the region server's log if there is one.
-        // This is only done from here if we are restarting and there is stale
-        // data in the meta region. Once we are on-line, dead server log
-        // recovery is handled by lease expiration and ProcessServerShutdown
-        if (!this.master.regionManager.isInitialMetaScanComplete() &&
-            (serverName != null && serverName.length() != 0)) {
-          StringBuilder dirName = new StringBuilder("log_");
-          dirName.append(serverName.replace(":", "_"));
-          Path logDir = new Path(this.master.rootdir, dirName.toString());
-          try {
-            if (master.fs.exists(logDir)) {
-              this.master.regionManager.splitLogLock.lock();
-              try {
-                HLog.splitLog(master.rootdir, logDir, master.fs,
-                    master.getConfiguration());
-              } finally {
-                this.master.regionManager.splitLogLock.unlock();
-              }
-            }
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Split " + logDir.toString());
-            }
-          } catch (IOException e) {
-            LOG.warn("unable to split region server log because: ", e);
-            throw e;
-          }
-        }
         // Now get the region assigned
         this.master.regionManager.setUnassigned(info, true);
       }

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/HMaster.java?rev=793970&r1=793969&r2=793970&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/HMaster.java Tue Jul
14 16:47:44 2009
@@ -36,6 +36,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -66,6 +67,7 @@
 import org.apache.hadoop.hbase.ipc.HMasterRegionInterface;
 import org.apache.hadoop.hbase.ipc.HRegionInterface;
 import org.apache.hadoop.hbase.master.metrics.MasterMetrics;
+import org.apache.hadoop.hbase.regionserver.HLog;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
@@ -361,9 +363,10 @@
   public void run() {
     final String threadName = "HMaster";
     Thread.currentThread().setName(threadName);
-    startServiceThreads();
-    /* Main processing loop */
     try {
+      splitLogAfterStartup();
+      startServiceThreads();
+      /* Main processing loop */
       while (!closed.get()) {
         // check if we should be shutting down
         if (shutdownRequested.get()) {
@@ -523,6 +526,29 @@
       LOG.debug("Started service threads");
     }
   }
+  
+  /**
+   * Inspect the log directories to recover any log file.
+   * @throws IOException
+   */
+  private void splitLogAfterStartup() throws IOException{
+    FileStatus [] logFolders = this.fs.listStatus(this.rootdir);
+    for (FileStatus status : logFolders) {
+      String folder = status.getPath().getName();
+      if(folder.startsWith(HConstants.HREGION_LOGDIR_NAME)) {
+        LOG.info("Found log folder : " + folder + " to split");
+        this.regionManager.splitLogLock.lock();
+        Path logDir =
+          new Path(this.rootdir, folder);
+        try {
+          HLog.splitLog(this.rootdir, logDir, this.fs,
+              getConfiguration());
+        } finally {
+          this.regionManager.splitLogLock.unlock();
+        }
+      }
+    }
+  }
 
   /*
    * Start shutting down the master



Mime
View raw message