HBASE-14907 NPE of MobUtils.hasMobColumns in Build failed in Jenkins: HBase-Trunk_matrix » latest1.8,Hadoop #513 (Jingcheng Du)
Put back HBASE-14907 but with right JIRA number (by doing a revert of a revert)
This reverts commit 35a7b56e53
.
This commit is contained in:
parent
a4a44587b3
commit
c6b8e6f1ac
|
@ -31,7 +31,6 @@ 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;
|
||||
|
@ -345,19 +344,13 @@ public class DeleteTableProcedure
|
|||
LOG.debug("Table '" + tableName + "' archived!");
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Delete table directory from FS (temp directory)
|
||||
|
@ -366,7 +359,7 @@ public class DeleteTableProcedure
|
|||
}
|
||||
|
||||
// Delete the table directory where the mob files are saved
|
||||
if (hasMob && mobTableDir != null && fs.exists(mobTableDir)) {
|
||||
if (mobTableDir != null && fs.exists(mobTableDir)) {
|
||||
if (!fs.delete(mobTableDir, true)) {
|
||||
throw new IOException("Couldn't delete mob dir " + mobTableDir);
|
||||
}
|
||||
|
|
|
@ -195,32 +195,15 @@ public class TestCreateTableProcedure {
|
|||
@Test(timeout=90000)
|
||||
public void testRollbackAndDoubleExecution() throws Exception {
|
||||
final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecution");
|
||||
testRollbackAndDoubleExecution(MasterProcedureTestingUtility.createHTD(tableName, "f1", "f2"));
|
||||
}
|
||||
|
||||
// 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")
|
||||
};
|
||||
@Test(timeout=90000)
|
||||
public void testRollbackAndDoubleExecutionOnMobTable() throws Exception {
|
||||
final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecutionOnMobTable");
|
||||
HTableDescriptor htd = MasterProcedureTestingUtility.createHTD(tableName, "f1", "f2");
|
||||
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);
|
||||
htd.getFamily(Bytes.toBytes("f1")).setMobEnabled(true);
|
||||
testRollbackAndDoubleExecution(htd);
|
||||
}
|
||||
|
||||
@Test(timeout=90000)
|
||||
|
@ -282,4 +265,31 @@ 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue