You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jx...@apache.org on 2013/09/05 18:07:00 UTC

svn commit: r1520357 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java

Author: jxiang
Date: Thu Sep  5 16:07:00 2013
New Revision: 1520357

URL: http://svn.apache.org/r1520357
Log:
HBASE-9434 hbck tries to sideline file to root dir

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1520357&r1=1520356&r2=1520357&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java Thu Sep  5 16:07:00 2013
@@ -497,6 +497,7 @@ public class HBaseFsck extends Configure
    * likely violate table integrity but will be dealt with by merging
    * overlapping regions.
    */
+  @SuppressWarnings("deprecation")
   private void adoptHdfsOrphan(HbckInfo hi) throws IOException {
     Path p = hi.getHdfsRegionDir();
     FileSystem fs = p.getFileSystem(getConf());
@@ -666,18 +667,18 @@ public class HBaseFsck extends Configure
       String pathStr = path.toString();
 
       // A reference file path should be like
-      // ${hbase.rootdir}/table_name/region_id/family_name/referred_file.region_name
-      // Up 3 directories to get the table folder.
+      // ${hbase.rootdir}/data/namespace/table_name/region_id/family_name/referred_file.region_name
+      // Up 5 directories to get the root folder.
       // So the file will be sidelined to a similar folder structure.
       int index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR);
-      for (int i = 0; index > 0 && i < 3; i++) {
-        index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index);
+      for (int i = 0; index > 0 && i < 5; i++) {
+        index = pathStr.lastIndexOf(Path.SEPARATOR_CHAR, index - 1);
       }
       if (index > 0) {
         Path rootDir = getSidelineDir();
-        Path dst = new Path(rootDir, pathStr.substring(index));
+        Path dst = new Path(rootDir, pathStr.substring(index + 1));
         fs.mkdirs(dst.getParent());
-        LOG.info("Trying to sildeline reference file"
+        LOG.info("Trying to sildeline reference file "
           + path + " to " + dst);
         setShouldRerun();