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

svn commit: r1521737 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java

Author: stack
Date: Wed Sep 11 05:29:25 2013
New Revision: 1521737

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

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

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java?rev=1521737&r1=1521736&r2=1521737&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/migration/NamespaceUpgrade.java Wed Sep 11 05:29:25 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);