hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1452542 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase: master/SplitLogManager.java regionserver/SplitLogWorker.java util/FSUtils.java
Date Mon, 04 Mar 2013 21:42:57 GMT
Author: larsh
Date: Mon Mar  4 21:42:57 2013
New Revision: 1452542

URL: http://svn.apache.org/r1452542
Log:
HBASE-7723 Remove NameNode URI from ZK splitlogs (Himanshu)

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java?rev=1452542&r1=1452541&r2=1452542&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java
Mon Mar  4 21:42:57 2013
@@ -278,7 +278,8 @@ public class SplitLogManager extends Zoo
       // recover-lease is done. totalSize will be under in most cases and the
       // metrics that it drives will also be under-reported.
       totalSize += lf.getLen();
-      if (enqueueSplitTask(lf.getPath().toString(), batch) == false) {
+      String pathToLog = FSUtils.removeRootPath(lf.getPath(), conf);
+      if (!enqueueSplitTask(pathToLog, batch)) {
         throw new IOException("duplicate log split scheduled for " + lf.getPath());
       }
     }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java?rev=1452542&r1=1452541&r2=1452542&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitLogWorker.java
Mon Mar  4 21:42:57 2013
@@ -108,8 +108,8 @@ public class SplitLogWorker extends ZooK
         // interrupted or has encountered a transient error and when it has
         // encountered a bad non-retry-able persistent error.
         try {
-          if (!HLogSplitter.splitLogFile(rootdir,
-              fs.getFileStatus(new Path(filename)), fs, conf, p, sequenceIdChecker)) {
+          if (!HLogSplitter.splitLogFile(rootdir, fs.getFileStatus(new Path(rootdir, filename)),
+            fs, conf, p, sequenceIdChecker)) {
             return Status.PREEMPTED;
           }
         } catch (InterruptedIOException iioe) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1452542&r1=1452541&r2=1452542&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Mon Mar
 4 21:42:57 2013
@@ -636,6 +636,23 @@ public abstract class FSUtils {
   }
 
   /**
+   * Checks for the presence of the root path (using the provided conf object) in the given
path. If
+   * it exists, this method removes it and returns the String representation of remaining
relative path.
+   * @param path
+   * @param conf
+   * @return String representation of the remaining relative path
+   * @throws IOException
+   */
+  public static String removeRootPath(Path path, final Configuration conf) throws IOException
{
+    Path root = FSUtils.getRootDir(conf);
+    String pathStr = path.toString();
+    // check that the path is absolute... it has the root path in it.
+    if (!pathStr.startsWith(root.toString())) return pathStr;
+    // if not, return as it is.
+    return pathStr.substring(root.toString().length() + 1);// remove the "/" too.
+  }
+
+  /**
    * If DFS, check safe mode and if so, wait until we clear it.
    * @param conf configuration
    * @param wait Sleep between retries



Mime
View raw message