hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1521736 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java
Date Wed, 11 Sep 2013 05:29:06 GMT
Author: stack
Date: Wed Sep 11 05:29:05 2013
New Revision: 1521736

URL: http://svn.apache.org/r1521736
Log:
HBASE-9497 Old .META. .tableinfo file kills HMaster

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java?rev=1521736&r1=1521735&r2=1521736&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java
Wed Sep 11 05:29:05 2013
@@ -312,6 +312,9 @@ public class NamespaceUpgrade implements
             + oldMetaRegionDir + " to " + newMetaRegionDir);
       }
     }
+    // Remove .tableinfo files as they refer to ".META.".
+    // They will be recreated by master on startup.
+    removeTableInfoInPre96Format(TableName.META_TABLE_NAME);
 
     Path oldRootDir = new Path(rootDir, "-ROOT-");
     if(!fs.rename(oldRootDir, backupDir)) {
@@ -319,6 +322,21 @@ public class NamespaceUpgrade implements
     }
   }
 
+  /**
+   * Removes .tableinfo files that are laid in pre-96 format (i.e., the tableinfo files are
under
+   * table directory).
+   * @param tableName
+   * @throws IOException
+   */
+  private void removeTableInfoInPre96Format(TableName tableName) throws IOException {
+    Path tableDir = FSUtils.getTableDir(rootDir, tableName);
+    FileStatus[] status = FSUtils.listStatus(fs, tableDir, TABLEINFO_PATHFILTER);
+    if (status == null) return;
+    for (FileStatus fStatus : status) {
+      FSUtils.delete(fs, fStatus.getPath(), false);
+    }
+  }
+
   public void migrateACL() throws IOException {
 
     TableName oldTableName = TableName.valueOf(OLD_ACL);



Mime
View raw message