hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [39/50] [abbrv] hbase git commit: Revert "HBASE-4907 NPE of MobUtils.hasMobColumns in Build failed in Jenkins: HBase-Trunk_matrix » latest1.8,Hadoop #513 (Jingcheng Du)" Revert because I pitched this against the wrong JIRA number!
Date Mon, 07 Dec 2015 16:56:16 GMT
Revert "HBASE-4907 NPE of MobUtils.hasMobColumns in Build failed in Jenkins: HBase-Trunk_matrix
» latest1.8,Hadoop #513 (Jingcheng Du)"
Revert because I pitched this against the wrong JIRA number!

This reverts commit 03e4712f0ca08d57586b3fc4d93cf02c999515d8.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/35a7b56e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/35a7b56e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/35a7b56e

Branch: refs/heads/hbase-12439
Commit: 35a7b56e530f3e4a12f1968df5aee9d3b63815bb
Parents: 26dd0d1
Author: stack <stack@apache.org>
Authored: Fri Dec 4 16:36:46 2015 -0800
Committer: stack <stack@apache.org>
Committed: Fri Dec 4 16:36:46 2015 -0800

----------------------------------------------------------------------
 .../master/procedure/DeleteTableProcedure.java  | 23 +++++---
 .../procedure/TestCreateTableProcedure.java     | 58 ++++++++------------
 2 files changed, 39 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/35a7b56e/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java
index 1e86254..4b95fa8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteTableProcedure.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.TableNotDisabledException;
@@ -344,13 +345,19 @@ public class DeleteTableProcedure
       LOG.debug("Table '" + tableName + "' archived!");
     }
 
-    // Archive mob data
-    Path mobTableDir = FSUtils.getTableDir(new Path(mfs.getRootDir(), MobConstants.MOB_DIR_NAME),
-            tableName);
-    Path regionDir =
-            new Path(mobTableDir, MobUtils.getMobRegionInfo(tableName).getEncodedName());
-    if (fs.exists(regionDir)) {
-      HFileArchiver.archiveRegion(fs, mfs.getRootDir(), mobTableDir, regionDir);
+    // Archive the mob data if there is a mob-enabled column
+    HTableDescriptor htd = env.getMasterServices().getTableDescriptors().get(tableName);
+    boolean hasMob = MobUtils.hasMobColumns(htd);
+    Path mobTableDir = null;
+    if (hasMob) {
+      // Archive mob data
+      mobTableDir = FSUtils.getTableDir(new Path(mfs.getRootDir(), MobConstants.MOB_DIR_NAME),
+              tableName);
+      Path regionDir =
+              new Path(mobTableDir, MobUtils.getMobRegionInfo(tableName).getEncodedName());
+      if (fs.exists(regionDir)) {
+        HFileArchiver.archiveRegion(fs, mfs.getRootDir(), mobTableDir, regionDir);
+      }
     }
 
     // Delete table directory from FS (temp directory)
@@ -359,7 +366,7 @@ public class DeleteTableProcedure
     }
 
     // Delete the table directory where the mob files are saved
-    if (mobTableDir != null && fs.exists(mobTableDir)) {
+    if (hasMob && mobTableDir != null && fs.exists(mobTableDir)) {
       if (!fs.delete(mobTableDir, true)) {
         throw new IOException("Couldn't delete mob dir " + mobTableDir);
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/35a7b56e/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateTableProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateTableProcedure.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateTableProcedure.java
index 676a3f4..0aad5fa 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateTableProcedure.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateTableProcedure.java
@@ -195,15 +195,32 @@ public class TestCreateTableProcedure {
   @Test(timeout=90000)
   public void testRollbackAndDoubleExecution() throws Exception {
     final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecution");
-    testRollbackAndDoubleExecution(MasterProcedureTestingUtility.createHTD(tableName, "f1",
"f2"));
-  }
 
-  @Test(timeout=90000)
-  public void testRollbackAndDoubleExecutionOnMobTable() throws Exception {
-    final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecutionOnMobTable");
+    // create the table
+    final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
+    ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);
+
+    // Start the Create procedure && kill the executor
+    final byte[][] splitKeys = new byte[][] {
+      Bytes.toBytes("a"), Bytes.toBytes("b"), Bytes.toBytes("c")
+    };
     HTableDescriptor htd = MasterProcedureTestingUtility.createHTD(tableName, "f1", "f2");
-    htd.getFamily(Bytes.toBytes("f1")).setMobEnabled(true);
-    testRollbackAndDoubleExecution(htd);
+    htd.setRegionReplication(3);
+    HRegionInfo[] regions = ModifyRegionUtils.createHRegionInfos(htd, splitKeys);
+    long procId = procExec.submitProcedure(
+      new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce);
+
+    // NOTE: the 4 (number of CreateTableState steps) is hardcoded,
+    //       so you have to look at this test at least once when you add a new step.
+    MasterProcedureTestingUtility.testRollbackAndDoubleExecution(
+        procExec, procId, 4, CreateTableState.values());
+
+    MasterProcedureTestingUtility.validateTableDeletion(
+      UTIL.getHBaseCluster().getMaster(), tableName, regions, "f1", "f2");
+
+    // are we able to create the table after a rollback?
+    resetProcExecutorTestingKillFlag();
+    testSimpleCreate(tableName, splitKeys);
   }
 
   @Test(timeout=90000)
@@ -265,31 +282,4 @@ public class TestCreateTableProcedure {
       }
     }
   }
-
-  private void testRollbackAndDoubleExecution(HTableDescriptor htd) throws Exception {
-    // create the table
-    final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
-    ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);
-
-    // Start the Create procedure && kill the executor
-    final byte[][] splitKeys = new byte[][] {
-      Bytes.toBytes("a"), Bytes.toBytes("b"), Bytes.toBytes("c")
-    };
-    htd.setRegionReplication(3);
-    HRegionInfo[] regions = ModifyRegionUtils.createHRegionInfos(htd, splitKeys);
-    long procId = procExec.submitProcedure(
-      new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce);
-
-    // NOTE: the 4 (number of CreateTableState steps) is hardcoded,
-    //       so you have to look at this test at least once when you add a new step.
-    MasterProcedureTestingUtility.testRollbackAndDoubleExecution(
-        procExec, procId, 4, CreateTableState.values());
-    TableName tableName = htd.getTableName();
-    MasterProcedureTestingUtility.validateTableDeletion(
-      UTIL.getHBaseCluster().getMaster(), tableName, regions, "f1", "f2");
-
-    // are we able to create the table after a rollback?
-    resetProcExecutorTestingKillFlag();
-    testSimpleCreate(tableName, splitKeys);
-  }
 }


Mime
View raw message