Repository: hbase Updated Branches: refs/heads/master a5ee36d93 -> da356069f
http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCloneSnapshotProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCloneSnapshotProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCloneSnapshotProcedure.java index f5211be..b0ac627 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCloneSnapshotProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCloneSnapshotProcedure.java @@ -118,29 +118,6 @@ public class TestCloneSnapshotProcedure extends TestTableDDLProcedureBase { clonedTableName); } - @Test(timeout = 60000) - public void testCloneSnapshotTwiceWithSameNonce() throws Exception { - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - final TableName clonedTableName = TableName.valueOf("testCloneSnapshotTwiceWithSameNonce"); - final HTableDescriptor htd = createHTableDescriptor(clonedTableName, CF); - - // take the snapshot - HBaseProtos.SnapshotDescription snapshotDesc = getSnapshot(); - - long procId1 = procExec.submitProcedure( - new CloneSnapshotProcedure(procExec.getEnvironment(), htd, snapshotDesc), nonceGroup, nonce); - long procId2 = procExec.submitProcedure( - new CloneSnapshotProcedure(procExec.getEnvironment(), htd, snapshotDesc), nonceGroup, nonce); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - // The second proc should succeed too - because it is the same proc. - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - @Test(timeout=60000) public void testCloneSnapshotToSameTable() throws Exception { // take the snapshot @@ -172,7 +149,7 @@ public class TestCloneSnapshotProcedure extends TestTableDDLProcedureBase { // Start the Clone snapshot procedure && kill the executor long procId = procExec.submitProcedure( - new CloneSnapshotProcedure(procExec.getEnvironment(), htd, snapshotDesc), nonceGroup, nonce); + new CloneSnapshotProcedure(procExec.getEnvironment(), htd, snapshotDesc)); // Restart the executor and execute the step twice int numberOfSteps = CloneSnapshotState.values().length; @@ -197,7 +174,7 @@ public class TestCloneSnapshotProcedure extends TestTableDDLProcedureBase { // Start the Clone snapshot procedure && kill the executor long procId = procExec.submitProcedure( - new CloneSnapshotProcedure(procExec.getEnvironment(), htd, snapshotDesc), nonceGroup, nonce); + new CloneSnapshotProcedure(procExec.getEnvironment(), htd, snapshotDesc)); int numberOfSteps = 0; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateNamespaceProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateNamespaceProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateNamespaceProcedure.java index 8bbf5dc..2a47a62 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateNamespaceProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestCreateNamespaceProcedure.java @@ -52,9 +52,6 @@ public class TestCreateNamespaceProcedure { protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static long nonceGroup = HConstants.NO_NONCE; - private static long nonce = HConstants.NO_NONCE; - private static void setupConf(Configuration conf) { conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1); } @@ -77,9 +74,6 @@ public class TestCreateNamespaceProcedure { @Before public void setup() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); - nonceGroup = - MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster()); - nonce = MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster()); } @After @@ -93,9 +87,7 @@ public class TestCreateNamespaceProcedure { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -110,18 +102,14 @@ public class TestCreateNamespaceProcedure { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); long procId1 = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); // Create the namespace that exists long procId2 = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup + 1, - nonce + 1); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId2); @@ -140,9 +128,7 @@ public class TestCreateNamespaceProcedure { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -163,9 +149,7 @@ public class TestCreateNamespaceProcedure { nsd.setConfiguration(nsKey, nsValue); long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -185,9 +169,7 @@ public class TestCreateNamespaceProcedure { nsd.setConfiguration(nsKey, nsValue); long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -196,32 +178,6 @@ public class TestCreateNamespaceProcedure { assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof ConstraintException); } - @Test(timeout=60000) - public void testCreateSameNamespaceTwiceWithSameNonce() throws Exception { - final NamespaceDescriptor nsd = - NamespaceDescriptor.create("testCreateSameNamespaceTwiceWithSameNonce").build(); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - long procId1 = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); - long procId2 = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - - validateNamespaceCreated(nsd); - - // Wait the completion and expect not fail - because it is the same proc - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - @Test(timeout = 60000) public void testRecoveryAndDoubleExecution() throws Exception { final NamespaceDescriptor nsd = @@ -233,9 +189,7 @@ public class TestCreateNamespaceProcedure { // Start the CreateNamespace procedure && kill the executor long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Restart the executor and execute the step twice int numberOfSteps = CreateNamespaceState.values().length; @@ -257,9 +211,7 @@ public class TestCreateNamespaceProcedure { // Start the CreateNamespace procedure && kill the executor long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); int numberOfSteps = 0; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/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 a7451bd..5c3d913 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 @@ -92,14 +92,12 @@ public class TestCreateTableProcedure extends TestTableDDLProcedureBase { // create the table long procId1 = procExec.submitProcedure( - new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce); + new CreateTableProcedure(procExec.getEnvironment(), htd, regions)); // create another with the same name ProcedurePrepareLatch latch2 = new ProcedurePrepareLatch.CompatibilityLatch(); long procId2 = procExec.submitProcedure( - new CreateTableProcedure(procExec.getEnvironment(), htd, regions, latch2), - nonceGroup + 1, - nonce + 1); + new CreateTableProcedure(procExec.getEnvironment(), htd, regions, latch2)); ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureTestingUtility.assertProcNotFailed(procExec.getResult(procId1)); @@ -109,29 +107,6 @@ public class TestCreateTableProcedure extends TestTableDDLProcedureBase { } @Test(timeout=60000) - public void testCreateTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testCreateTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - final HTableDescriptor htd = MasterProcedureTestingUtility.createHTD(tableName, "f"); - final HRegionInfo[] regions = ModifyRegionUtils.createHRegionInfos(htd, null); - - // create the table - long procId1 = procExec.submitProcedure( - new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce); - - // create another with the same name - long procId2 = procExec.submitProcedure( - new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce); - - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec.getResult(procId1)); - - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec.getResult(procId2)); - assertTrue(procId1 == procId2); - } - - @Test(timeout=60000) public void testRecoveryAndDoubleExecution() throws Exception { final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecution"); @@ -144,7 +119,7 @@ public class TestCreateTableProcedure extends TestTableDDLProcedureBase { HTableDescriptor htd = MasterProcedureTestingUtility.createHTD(tableName, "f1", "f2"); HRegionInfo[] regions = ModifyRegionUtils.createHRegionInfos(htd, splitKeys); long procId = procExec.submitProcedure( - new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce); + new CreateTableProcedure(procExec.getEnvironment(), htd, regions)); // Restart the executor and execute the step twice // NOTE: the 6 (number of CreateTableState steps) is hardcoded, @@ -181,7 +156,7 @@ public class TestCreateTableProcedure extends TestTableDDLProcedureBase { htd.setRegionReplication(3); HRegionInfo[] regions = ModifyRegionUtils.createHRegionInfos(htd, splitKeys); long procId = procExec.submitProcedure( - new CreateTableProcedure(procExec.getEnvironment(), htd, regions), nonceGroup, nonce); + new CreateTableProcedure(procExec.getEnvironment(), htd, regions)); int numberOfSteps = 0; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteColumnFamilyProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteColumnFamilyProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteColumnFamilyProcedure.java index edbaf29..625729a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteColumnFamilyProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteColumnFamilyProcedure.java @@ -53,9 +53,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // Test 1: delete the column family that exists online long procId1 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf1.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf1.getBytes())); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); @@ -66,9 +64,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // Test 2: delete the column family that exists offline UTIL.getHBaseAdmin().disableTable(tableName); long procId2 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId2); ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); @@ -85,9 +81,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // delete the column family that exists long procId1 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); // First delete should succeed @@ -98,9 +92,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // delete the column family that does not exist long procId2 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes()), - nonceGroup + 1, - nonce + 1); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId2); @@ -115,9 +107,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // Try again, this time with table disabled. UTIL.getHBaseAdmin().disableTable(tableName); long procId3 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes()), - nonceGroup + 2, - nonce + 2); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId3); // Expect fail with InvalidFamilyOperationException @@ -129,37 +119,6 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { } @Test(timeout=60000) - public void testDeleteColumnFamilyTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testDeleteColumnFamilyTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - final String cf2 = "cf2"; - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", cf2); - - // delete the column family that exists - long procId1 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes()), - nonceGroup, - nonce); - long procId2 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes()), - nonceGroup, - nonce); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - MasterProcedureTestingUtility.validateColumnFamilyDeletion(UTIL.getHBaseCluster().getMaster(), - tableName, cf2); - - // Wait the completion and expect not fail - because it is the same proc - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - - @Test(timeout=60000) public void testDeleteNonExistingColumnFamily() throws Exception { final TableName tableName = TableName.valueOf("testDeleteNonExistingColumnFamily"); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); @@ -170,9 +129,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // delete the column family that does not exist long procId1 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf3.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf3.getBytes())); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); @@ -198,9 +155,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // Start the Delete procedure && kill the executor long procId = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf4.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf4.getBytes())); // Restart the executor and execute the step twice int numberOfSteps = DeleteColumnFamilyState.values().length; @@ -224,9 +179,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // Start the Delete procedure && kill the executor long procId = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf5.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf5.getBytes())); // Restart the executor and execute the step twice int numberOfSteps = DeleteColumnFamilyState.values().length; @@ -251,9 +204,7 @@ public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { // Start the Delete procedure && kill the executor long procId = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf5.getBytes()), - nonceGroup, - nonce); + new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf5.getBytes())); int numberOfSteps = 1; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteNamespaceProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteNamespaceProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteNamespaceProcedure.java index 7480d14..666c0ab 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteNamespaceProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteNamespaceProcedure.java @@ -53,9 +53,6 @@ public class TestDeleteNamespaceProcedure { protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static long nonceGroup = HConstants.NO_NONCE; - private static long nonce = HConstants.NO_NONCE; - private static void setupConf(Configuration conf) { conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1); } @@ -78,9 +75,6 @@ public class TestDeleteNamespaceProcedure { @Before public void setup() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); - nonceGroup = - MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster()); - nonce = MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster()); } @After @@ -100,9 +94,7 @@ public class TestDeleteNamespaceProcedure { createNamespaceForTesting(namespaceName); long procId = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); + new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -118,9 +110,7 @@ public class TestDeleteNamespaceProcedure { validateNamespaceNotExist(namespaceName); long procId = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); + new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); // Expect fail with NamespaceNotFoundException @@ -137,9 +127,7 @@ public class TestDeleteNamespaceProcedure { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); long procId = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); + new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -159,9 +147,7 @@ public class TestDeleteNamespaceProcedure { MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1"); long procId = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); + new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -170,33 +156,6 @@ public class TestDeleteNamespaceProcedure { assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof ConstraintException); } - @Test(timeout=60000) - public void testDeleteSameNamespaceTwiceWithSameNonce() throws Exception { - final String namespaceName = "testDeleteSameNamespaceTwiceWithSameNonce"; - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - createNamespaceForTesting(namespaceName); - - long procId1 = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); - long procId2 = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - - validateNamespaceNotExist(namespaceName); - - // Wait the completion and expect not fail - because it is the same proc - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - @Test(timeout = 60000) public void testRecoveryAndDoubleExecution() throws Exception { final String namespaceName = "testRecoveryAndDoubleExecution"; @@ -209,9 +168,7 @@ public class TestDeleteNamespaceProcedure { // Start the DeleteNamespace procedure && kill the executor long procId = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); + new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName)); // Restart the executor and execute the step twice int numberOfSteps = DeleteNamespaceState.values().length; @@ -233,11 +190,8 @@ public class TestDeleteNamespaceProcedure { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); // Start the DeleteNamespace procedure && kill the executor - LOG.info("SUBMIT DELTET"); long procId = procExec.submitProcedure( - new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName), - nonceGroup, - nonce); + new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName)); int numberOfSteps = 0; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); @@ -257,9 +211,7 @@ public class TestDeleteNamespaceProcedure { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup + 1, - nonce + 1); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteTableProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteTableProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteTableProcedure.java index 200a617..c259bb6 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteTableProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteTableProcedure.java @@ -74,10 +74,10 @@ public class TestDeleteTableProcedure extends TestTableDDLProcedureBase { // delete the table (that exists) long procId1 = procExec.submitProcedure( - new DeleteTableProcedure(procExec.getEnvironment(), tableName), nonceGroup, nonce); + new DeleteTableProcedure(procExec.getEnvironment(), tableName)); // delete the table (that will no longer exist) long procId2 = procExec.submitProcedure( - new DeleteTableProcedure(procExec.getEnvironment(), tableName), nonceGroup + 1, nonce + 1); + new DeleteTableProcedure(procExec.getEnvironment(), tableName)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); @@ -96,36 +96,6 @@ public class TestDeleteTableProcedure extends TestTableDDLProcedureBase { } @Test(timeout=60000) - public void testDoubleDeletedTableWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testDoubleDeletedTableWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - HRegionInfo[] regions = MasterProcedureTestingUtility.createTable( - procExec, tableName, null, "f"); - UTIL.getHBaseAdmin().disableTable(tableName); - - // delete the table (that exists) - long procId1 = procExec.submitProcedure( - new DeleteTableProcedure(procExec.getEnvironment(), tableName), nonceGroup, nonce); - // delete the table (that will no longer exist) - long procId2 = procExec.submitProcedure( - new DeleteTableProcedure(procExec.getEnvironment(), tableName), nonceGroup, nonce); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.waitProcedure(procExec, procId2); - - // First delete should succeed - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - MasterProcedureTestingUtility.validateTableDeletion( - UTIL.getHBaseCluster().getMaster(), tableName); - - // Second delete should not fail, because it is the same delete - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - - @Test(timeout=60000) public void testSimpleDelete() throws Exception { final TableName tableName = TableName.valueOf("testSimpleDelete"); final byte[][] splitKeys = null; @@ -171,7 +141,7 @@ public class TestDeleteTableProcedure extends TestTableDDLProcedureBase { // Start the Delete procedure && kill the executor long procId = procExec.submitProcedure( - new DeleteTableProcedure(procExec.getEnvironment(), tableName), nonceGroup, nonce); + new DeleteTableProcedure(procExec.getEnvironment(), tableName)); // Restart the executor and execute the step twice // NOTE: the 6 (number of DeleteTableState steps) is hardcoded, http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDisableTableProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDisableTableProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDisableTableProcedure.java index e74eb26..ac61dd4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDisableTableProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDisableTableProcedure.java @@ -48,7 +48,7 @@ public class TestDisableTableProcedure extends TestTableDDLProcedureBase { // Disable the table long procId = procExec.submitProcedure( - new DisableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new DisableTableProcedure(procExec.getEnvironment(), tableName, false)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -65,7 +65,7 @@ public class TestDisableTableProcedure extends TestTableDDLProcedureBase { // Disable the table long procId1 = procExec.submitProcedure(new DisableTableProcedure( - procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + procExec.getEnvironment(), tableName, false)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); @@ -74,7 +74,7 @@ public class TestDisableTableProcedure extends TestTableDDLProcedureBase { // Disable the table again - expect failure long procId2 = procExec.submitProcedure(new DisableTableProcedure( - procExec.getEnvironment(), tableName, false), nonceGroup + 1, nonce + 1); + procExec.getEnvironment(), tableName, false)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId2); ProcedureInfo result = procExec.getResult(procId2); @@ -88,7 +88,7 @@ public class TestDisableTableProcedure extends TestTableDDLProcedureBase { final ProcedurePrepareLatch prepareLatch = new ProcedurePrepareLatch.CompatibilityLatch(); long procId3 = procExec.submitProcedure(new DisableTableProcedure( - procExec.getEnvironment(), tableName, false, prepareLatch), nonceGroup + 2, nonce + 2); + procExec.getEnvironment(), tableName, false, prepareLatch)); prepareLatch.await(); Assert.fail("Disable should throw exception through latch."); } catch (TableNotEnabledException tnee) { @@ -106,29 +106,6 @@ public class TestDisableTableProcedure extends TestTableDDLProcedureBase { tableName); } - @Test(timeout = 60000) - public void testDisableTableTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testDisableTableTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2"); - - // Disable the table - long procId1 = procExec.submitProcedure(new DisableTableProcedure( - procExec.getEnvironment(), tableName, false), nonceGroup, nonce); - long procId2 = procExec.submitProcedure(new DisableTableProcedure( - procExec.getEnvironment(), tableName, false), nonceGroup, nonce); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - MasterProcedureTestingUtility.validateTableIsDisabled(UTIL.getHBaseCluster().getMaster(), - tableName); - - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - @Test(timeout=60000) public void testRecoveryAndDoubleExecution() throws Exception { final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecution"); @@ -143,7 +120,7 @@ public class TestDisableTableProcedure extends TestTableDDLProcedureBase { // Start the Disable procedure && kill the executor long procId = procExec.submitProcedure( - new DisableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new DisableTableProcedure(procExec.getEnvironment(), tableName, false)); // Restart the executor and execute the step twice int numberOfSteps = DisableTableState.values().length; http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDispatchMergingRegionsProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDispatchMergingRegionsProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDispatchMergingRegionsProcedure.java index a7dd4a8..c011321 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDispatchMergingRegionsProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDispatchMergingRegionsProcedure.java @@ -54,8 +54,6 @@ public class TestDispatchMergingRegionsProcedure { private static final Log LOG = LogFactory.getLog(TestDispatchMergingRegionsProcedure.class); protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static long nonceGroup = HConstants.NO_NONCE; - private static long nonce = HConstants.NO_NONCE; private final static byte[] FAMILY = Bytes.toBytes("FAMILY"); final static Configuration conf = UTIL.getConfiguration(); @@ -89,9 +87,7 @@ public class TestDispatchMergingRegionsProcedure { @Before public void setup() throws Exception { resetProcExecutorTestingKillFlag(); - nonceGroup = - MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster()); - nonce = MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster()); + // Turn off balancer so it doesn't cut in and mess up our placements. UTIL.getHBaseAdmin().setBalancerRunning(false, true); // Turn off the meta scanner so it don't remove parent on us. @@ -188,33 +184,6 @@ public class TestDispatchMergingRegionsProcedure { } @Test(timeout=60000) - public void testMergeRegionsTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testMergeRegionsTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - List<HRegionInfo> tableRegions = createTable(tableName, 3); - - HRegionInfo[] regionsToMerge = new HRegionInfo[2]; - regionsToMerge[0] = tableRegions.get(0); - regionsToMerge[1] = tableRegions.get(1); - - final int initCompletedTaskCount = countOfCompletedMergeTaskCount(); - long procId1 = procExec.submitProcedure(new DispatchMergingRegionsProcedure( - procExec.getEnvironment(), tableName, regionsToMerge, true), nonceGroup, nonce); - long procId2 = procExec.submitProcedure(new DispatchMergingRegionsProcedure( - procExec.getEnvironment(), tableName, regionsToMerge, true), nonceGroup, nonce); - assertEquals(procId1, procId2); - - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - // The second proc should succeed too - because it is the same proc. - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - - assertRegionCount(tableName, 2, 1, initCompletedTaskCount); - } - - @Test(timeout=60000) public void testRecoveryAndDoubleExecution() throws Exception { final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecution"); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestEnableTableProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestEnableTableProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestEnableTableProcedure.java index 57df359..b8b91b5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestEnableTableProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestEnableTableProcedure.java @@ -49,7 +49,7 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { // Enable the table long procId = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new EnableTableProcedure(procExec.getEnvironment(), tableName, false)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -57,29 +57,6 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { tableName); } - @Test(timeout = 60000) - public void testEnableTableTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testEnableTableTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2"); - UTIL.getHBaseAdmin().disableTable(tableName); - - // Enable the table - long procId1 = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); - long procId2 = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - // The second proc should succeed too - because it is the same proc. - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - } - @Test(timeout=60000, expected=TableNotDisabledException.class) public void testEnableNonDisabledTable() throws Exception { final TableName tableName = TableName.valueOf("testEnableNonExistingTable"); @@ -89,7 +66,7 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { // Enable the table - expect failure long procId1 = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new EnableTableProcedure(procExec.getEnvironment(), tableName, false)); ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureInfo result = procExec.getResult(procId1); @@ -100,9 +77,7 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { // Enable the table with skipping table state check flag (simulate recovery scenario) long procId2 = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, true), - nonceGroup + 1, - nonce + 1); + new EnableTableProcedure(procExec.getEnvironment(), tableName, true)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId2); ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); @@ -110,9 +85,7 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { // Enable the table - expect failure from ProcedurePrepareLatch final ProcedurePrepareLatch prepareLatch = new ProcedurePrepareLatch.CompatibilityLatch(); long procId3 = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false, prepareLatch), - nonceGroup + 2, - nonce + 2); + new EnableTableProcedure(procExec.getEnvironment(), tableName, false, prepareLatch)); prepareLatch.await(); Assert.fail("Enable should throw exception through latch."); } @@ -132,7 +105,7 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { // Start the Enable procedure && kill the executor long procId = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new EnableTableProcedure(procExec.getEnvironment(), tableName, false)); // Restart the executor and execute the step twice int numberOfSteps = EnableTableState.values().length; @@ -156,7 +129,7 @@ public class TestEnableTableProcedure extends TestTableDDLProcedureBase { // Start the Enable procedure && kill the executor long procId = procExec.submitProcedure( - new EnableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new EnableTableProcedure(procExec.getEnvironment(), tableName, false)); int numberOfSteps = 1; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java index 1b434fe..a88eb62 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureEvents.java @@ -53,9 +53,6 @@ public class TestMasterProcedureEvents { protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static long nonceGroup = HConstants.NO_NONCE; - private static long nonce = HConstants.NO_NONCE; - private static void setupConf(Configuration conf) { conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1); conf.setBoolean(WALProcedureStore.USE_HSYNC_CONF_KEY, false); @@ -156,7 +153,7 @@ public class TestMasterProcedureEvents { // submit the procedure LOG.debug("submit " + proc); - long procId = procExec.submitProcedure(proc, HConstants.NO_NONCE, HConstants.NO_NONCE); + long procId = procExec.submitProcedure(proc); // wait until the event is in the queue (proc executed and got into suspended state) LOG.debug("wait procedure suspended on " + event); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMergeTableRegionsProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMergeTableRegionsProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMergeTableRegionsProcedure.java index 1915f69..a16df9a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMergeTableRegionsProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMergeTableRegionsProcedure.java @@ -163,32 +163,6 @@ public class TestMergeTableRegionsProcedure { } @Test(timeout=60000) - public void testMergeRegionsTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testMergeRegionsTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - List<HRegionInfo> tableRegions = createTable(tableName); - - HRegionInfo[] regionsToMerge = new HRegionInfo[2]; - regionsToMerge[0] = tableRegions.get(0); - regionsToMerge[1] = tableRegions.get(1); - - long procId1 = procExec.submitProcedure(new MergeTableRegionsProcedure( - procExec.getEnvironment(), regionsToMerge, true), nonceGroup, nonce); - long procId2 = procExec.submitProcedure(new MergeTableRegionsProcedure( - procExec.getEnvironment(), regionsToMerge, true), nonceGroup, nonce); - assertEquals(procId1, procId2); - - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - // The second proc should succeed too - because it is the same proc. - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - - assertRegionCount(tableName, initialRegionCount - 1); - } - - @Test(timeout=60000) public void testRecoveryAndDoubleExecution() throws Exception { final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecution"); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyColumnFamilyProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyColumnFamilyProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyColumnFamilyProcedure.java index 320460d..7758185 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyColumnFamilyProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyColumnFamilyProcedure.java @@ -53,9 +53,7 @@ public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { // Test 1: modify the column family online columnDescriptor.setBlocksize(newBlockSize); long procId1 = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor), - nonceGroup, - nonce); + new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); @@ -66,9 +64,7 @@ public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { UTIL.getHBaseAdmin().disableTable(tableName); columnDescriptor.setBlocksize(newBlockSize * 2); long procId2 = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor), - nonceGroup + 1, - nonce + 1); + new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId2); ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); @@ -91,9 +87,7 @@ public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { // Modify the column family that does not exist columnDescriptor.setBlocksize(newBlockSize); long procId1 = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor), - nonceGroup, - nonce); + new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); @@ -123,9 +117,7 @@ public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor columnDescriptor.setBlocksize(newBlockSize); long procId = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor), - nonceGroup, - nonce); + new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); // Restart the executor and execute the step twice int numberOfSteps = ModifyColumnFamilyState.values().length; @@ -153,9 +145,7 @@ public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor columnDescriptor.setBlocksize(newBlockSize); long procId = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor), - nonceGroup, - nonce); + new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); // Restart the executor and execute the step twice int numberOfSteps = ModifyColumnFamilyState.values().length; @@ -183,9 +173,7 @@ public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor columnDescriptor.setBlocksize(newBlockSize); long procId = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor), - nonceGroup, - nonce); + new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); int numberOfSteps = 1; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyNamespaceProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyNamespaceProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyNamespaceProcedure.java index bfe381a..34ae31a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyNamespaceProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyNamespaceProcedure.java @@ -49,9 +49,6 @@ public class TestModifyNamespaceProcedure { protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static long nonceGroup = HConstants.NO_NONCE; - private static long nonce = HConstants.NO_NONCE; - private static void setupConf(Configuration conf) { conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1); } @@ -74,9 +71,6 @@ public class TestModifyNamespaceProcedure { @Before public void setup() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); - nonceGroup = - MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster()); - nonce = MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster()); } @After @@ -113,9 +107,7 @@ public class TestModifyNamespaceProcedure { nsd.setConfiguration(nsKey2, nsValue2); long procId1 = procExec.submitProcedure( - new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId1); ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); @@ -143,9 +135,7 @@ public class TestModifyNamespaceProcedure { final NamespaceDescriptor nsd = NamespaceDescriptor.create(namespaceName).build(); long procId = procExec.submitProcedure( - new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); @@ -171,9 +161,7 @@ public class TestModifyNamespaceProcedure { nsd.setConfiguration(nsKey, nsValue); long procId = procExec.submitProcedure( - new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -196,9 +184,7 @@ public class TestModifyNamespaceProcedure { nsd.setConfiguration(nsKey, nsValue); long procId = procExec.submitProcedure( - new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureInfo result = procExec.getResult(procId); @@ -224,9 +210,7 @@ public class TestModifyNamespaceProcedure { // Start the Modify procedure && kill the executor long procId = procExec.submitProcedure( - new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd)); // Restart the executor and execute the step twice int numberOfSteps = ModifyNamespaceState.values().length; @@ -256,9 +240,7 @@ public class TestModifyNamespaceProcedure { // Start the Modify procedure && kill the executor long procId = procExec.submitProcedure( - new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd), - nonceGroup, - nonce); + new ModifyNamespaceProcedure(procExec.getEnvironment(), nsd)); int numberOfSteps = 0; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); @@ -277,9 +259,7 @@ public class TestModifyNamespaceProcedure { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); long procId = procExec.submitProcedure( - new CreateNamespaceProcedure(procExec.getEnvironment(), nsDescriptor), - nonceGroup + 1, - nonce + 1); + new CreateNamespaceProcedure(procExec.getEnvironment(), nsDescriptor)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyTableProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyTableProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyTableProcedure.java index 6ad7bbc..7ebb075 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyTableProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyTableProcedure.java @@ -201,7 +201,7 @@ public class TestModifyTableProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor long procId = procExec.submitProcedure( - new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce); + new ModifyTableProcedure(procExec.getEnvironment(), htd)); // Restart the executor and execute the step twice int numberOfSteps = ModifyTableState.values().length; @@ -239,7 +239,7 @@ public class TestModifyTableProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor long procId = procExec.submitProcedure( - new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce); + new ModifyTableProcedure(procExec.getEnvironment(), htd)); // Restart the executor and execute the step twice int numberOfSteps = ModifyTableState.values().length; @@ -276,7 +276,7 @@ public class TestModifyTableProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor long procId = procExec.submitProcedure( - new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce); + new ModifyTableProcedure(procExec.getEnvironment(), htd)); int numberOfSteps = 1; // failing at pre operation MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); @@ -308,7 +308,7 @@ public class TestModifyTableProcedure extends TestTableDDLProcedureBase { // Start the Modify procedure && kill the executor long procId = procExec.submitProcedure( - new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce); + new ModifyTableProcedure(procExec.getEnvironment(), htd)); // Restart the executor and rollback the step twice int numberOfSteps = 1; // failing at pre operation http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestProcedureAdmin.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestProcedureAdmin.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestProcedureAdmin.java index ae6d27f..6233254 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestProcedureAdmin.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestProcedureAdmin.java @@ -50,9 +50,6 @@ public class TestProcedureAdmin { protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private long nonceGroup = HConstants.NO_NONCE; - private long nonce = HConstants.NO_NONCE; - private static void setupConf(Configuration conf) { conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1); } @@ -77,10 +74,6 @@ public class TestProcedureAdmin { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, false); assertTrue("expected executor to be running", procExec.isRunning()); - - nonceGroup = - MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster()); - nonce = MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster()); } @After @@ -103,7 +96,7 @@ public class TestProcedureAdmin { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); // Submit an abortable procedure long procId = procExec.submitProcedure( - new DisableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new DisableTableProcedure(procExec.getEnvironment(), tableName, false)); // Wait for one step to complete ProcedureTestingUtility.waitProcedure(procExec, procId); @@ -130,7 +123,7 @@ public class TestProcedureAdmin { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); // Submit an un-abortable procedure long procId = procExec.submitProcedure( - new DeleteTableProcedure(procExec.getEnvironment(), tableName), nonceGroup, nonce); + new DeleteTableProcedure(procExec.getEnvironment(), tableName)); // Wait for a couple of steps to complete (first step "prepare" is abortable) ProcedureTestingUtility.waitProcedure(procExec, procId); for (int i = 0; i < 2; ++i) { @@ -161,7 +154,7 @@ public class TestProcedureAdmin { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); // Submit a procedure long procId = procExec.submitProcedure( - new DisableTableProcedure(procExec.getEnvironment(), tableName, true), nonceGroup, nonce); + new DisableTableProcedure(procExec.getEnvironment(), tableName, true)); // Wait for one step to complete ProcedureTestingUtility.waitProcedure(procExec, procId); @@ -202,7 +195,7 @@ public class TestProcedureAdmin { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); long procId = procExec.submitProcedure( - new DisableTableProcedure(procExec.getEnvironment(), tableName, false), nonceGroup, nonce); + new DisableTableProcedure(procExec.getEnvironment(), tableName, false)); // Wait for one step to complete ProcedureTestingUtility.waitProcedure(procExec, procId); http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestRestoreSnapshotProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestRestoreSnapshotProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestRestoreSnapshotProcedure.java index ebac6bd..066a160 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestRestoreSnapshotProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestRestoreSnapshotProcedure.java @@ -151,30 +151,6 @@ public class TestRestoreSnapshotProcedure extends TestTableDDLProcedureBase { validateSnapshotRestore(); } - @Test(timeout = 60000) - public void testRestoreSnapshotTwiceWithSameNonce() throws Exception { - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - long procId1 = procExec.submitProcedure( - new RestoreSnapshotProcedure(procExec.getEnvironment(), snapshotHTD, snapshot), - nonceGroup, - nonce); - long procId2 = procExec.submitProcedure( - new RestoreSnapshotProcedure(procExec.getEnvironment(), snapshotHTD, snapshot), - nonceGroup, - nonce); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - // The second proc should succeed too - because it is the same proc. - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - - validateSnapshotRestore(); - } - @Test(timeout=60000) public void testRestoreSnapshotToDifferentTable() throws Exception { final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); @@ -218,9 +194,7 @@ public class TestRestoreSnapshotProcedure extends TestTableDDLProcedureBase { // Start the Restore snapshot procedure && kill the executor long procId = procExec.submitProcedure( - new RestoreSnapshotProcedure(procExec.getEnvironment(), snapshotHTD, snapshot), - nonceGroup, - nonce); + new RestoreSnapshotProcedure(procExec.getEnvironment(), snapshotHTD, snapshot)); // Restart the executor and execute the step twice int numberOfSteps = RestoreSnapshotState.values().length; http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java index 55e38ba..9e75cb9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java @@ -63,9 +63,6 @@ public class TestSplitTableRegionProcedure { protected static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static long nonceGroup = HConstants.NO_NONCE; - private static long nonce = HConstants.NO_NONCE; - private static String ColumnFamilyName1 = "cf1"; private static String ColumnFamilyName2 = "cf2"; @@ -95,9 +92,6 @@ public class TestSplitTableRegionProcedure { @Before public void setup() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false); - nonceGroup = - MasterProcedureTestingUtility.generateNonceGroup(UTIL.getHBaseCluster().getMaster()); - nonce = MasterProcedureTestingUtility.generateNonce(UTIL.getHBaseCluster().getMaster()); // Turn off balancer so it doesn't cut in and mess up our placements. UTIL.getHBaseAdmin().setBalancerRunning(false, true); @@ -130,9 +124,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -155,9 +147,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -183,9 +173,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -210,9 +198,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -242,9 +228,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Wait the completion ProcedureTestingUtility.waitProcedure(procExec, procId); ProcedureTestingUtility.assertProcNotFailed(procExec, procId); @@ -267,42 +251,6 @@ public class TestSplitTableRegionProcedure { } @Test(timeout=60000) - public void testSplitTableRegionTwiceWithSameNonce() throws Exception { - final TableName tableName = TableName.valueOf("testSplitTableRegionTwiceWithSameNonce"); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - HRegionInfo [] regions = MasterProcedureTestingUtility.createTable( - procExec, tableName, null, ColumnFamilyName1, ColumnFamilyName2); - insertData(tableName); - int splitRowNum = startRowNum + rowCount / 2; - byte[] splitKey = Bytes.toBytes("" + splitRowNum); - - assertTrue("not able to find a splittable region", regions != null); - assertTrue("not able to find a splittable region", regions.length == 1); - - // Split region of the table - long procId1 = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); - // Split region of the table with the same nonce - long procId2 = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - // The second proc should succeed too - because it is the same proc. - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - assertTrue(procId1 == procId2); - - verify(tableName, splitRowNum); - } - - @Test(timeout=60000) public void testInvalidSplitKey() throws Exception { final TableName tableName = TableName.valueOf("testInvalidSplitKey"); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); @@ -317,9 +265,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table with null split key try { long procId1 = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], null), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], null)); ProcedureTestingUtility.waitProcedure(procExec, procId1); fail("unexpected procedure start with invalid split-key"); } catch (DoNotRetryIOException e) { @@ -345,9 +291,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Failing before SPLIT_TABLE_REGION_UPDATE_META we should trigger the // rollback @@ -378,9 +322,7 @@ public class TestSplitTableRegionProcedure { // Split region of the table long procId = procExec.submitProcedure( - new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey), - nonceGroup, - nonce); + new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey)); // Restart the executor and execute the step twice int numberOfSteps = SplitTableRegionState.values().length; http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestTruncateTableProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestTruncateTableProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestTruncateTableProcedure.java index 51384a7..3cc90f5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestTruncateTableProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestTruncateTableProcedure.java @@ -164,9 +164,7 @@ public class TestTruncateTableProcedure extends TestTableDDLProcedureBase { // Start the Truncate procedure && kill the executor long procId = procExec.submitProcedure( - new TruncateTableProcedure(procExec.getEnvironment(), tableName, preserveSplits), - nonceGroup, - nonce); + new TruncateTableProcedure(procExec.getEnvironment(), tableName, preserveSplits)); // Restart the executor and execute the step twice // NOTE: the 7 (number of TruncateTableState steps) is hardcoded, http://git-wip-us.apache.org/repos/asf/hbase/blob/da356069/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCoprocessorWhitelistMasterObserver.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCoprocessorWhitelistMasterObserver.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCoprocessorWhitelistMasterObserver.java index 34e4a68..5a90d59 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCoprocessorWhitelistMasterObserver.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCoprocessorWhitelistMasterObserver.java @@ -20,36 +20,33 @@ package org.apache.hadoop.hbase.security.access; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import java.io.IOException; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.hbase.client.Admin; -import org.apache.hadoop.hbase.client.Connection; -import org.apache.hadoop.hbase.client.ConnectionFactory; -import org.apache.hadoop.hbase.client.Table; +import org.apache.hadoop.hbase.CategoryBasedTimeout; import org.apache.hadoop.hbase.Coprocessor; -import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableNotEnabledException; import org.apache.hadoop.hbase.TableNotFoundException; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.ConnectionFactory; +import org.apache.hadoop.hbase.client.Table; +import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.SecurityTests; import org.apache.hadoop.hbase.util.Bytes; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.apache.hadoop.hbase.CategoryBasedTimeout; -import org.junit.rules.TestRule; import org.junit.After; import org.junit.ClassRule; +import org.junit.Test; import org.junit.experimental.categories.Category; - -import java.io.IOException; +import org.junit.rules.TestRule; /** * Performs coprocessor loads for variuos paths and malformed strings @@ -58,7 +55,6 @@ import java.io.IOException; public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { private static final Log LOG = LogFactory.getLog(TestCoprocessorWhitelistMasterObserver.class); private static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); - private static Configuration conf; private static final TableName TEST_TABLE = TableName.valueOf("testTable"); private static final byte[] TEST_FAMILY = Bytes.toBytes("fam1"); @@ -106,8 +102,7 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { // set retries low to raise exception quickly conf.setInt("hbase.client.retries.number", 1); UTIL.startMiniCluster(); - Table table = UTIL.createTable(TEST_TABLE, - new byte[][] { TEST_FAMILY }); + UTIL.createTable(TEST_TABLE, new byte[][] { TEST_FAMILY }); UTIL.waitUntilAllRegionsAssigned(TEST_TABLE); Connection connection = ConnectionFactory.createConnection(conf); Table t = connection.getTable(TEST_TABLE); @@ -139,18 +134,17 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { private static void negativeTestCase(String[] whitelistedPaths, String coprocessorPath) throws Exception { Configuration conf = UTIL.getConfiguration(); + conf.setInt("hbase.client.retries.number", 1); // load coprocessor under test conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, CoprocessorWhitelistMasterObserver.class.getName()); // set retries low to raise exception quickly - conf.setInt("hbase.client.retries.number", 1); // set a coprocessor whitelist path for test conf.setStrings( CoprocessorWhitelistMasterObserver.CP_COPROCESSOR_WHITELIST_PATHS_KEY, whitelistedPaths); UTIL.startMiniCluster(); - Table table = UTIL.createTable(TEST_TABLE, - new byte[][] { TEST_FAMILY }); + UTIL.createTable(TEST_TABLE, new byte[][] { TEST_FAMILY }); UTIL.waitUntilAllRegionsAssigned(TEST_TABLE); Connection connection = ConnectionFactory.createConnection(conf); Admin admin = connection.getAdmin(); @@ -175,7 +169,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * to show coprocessor is working as desired */ @Test - @Category(MediumTests.class) public void testSubstringNonWhitelisted() throws Exception { positiveTestCase(new String[]{"/permitted/*"}, "file:///notpermitted/couldnotpossiblyexist.jar"); @@ -189,7 +182,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * the added coprocessor not actually existing on disk */ @Test - @Category(MediumTests.class) public void testDifferentFileSystemNonWhitelisted() throws Exception { positiveTestCase(new String[]{"hdfs://foo/bar"}, "file:///notpermitted/couldnotpossiblyexist.jar"); @@ -203,7 +195,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * the added coprocessor not actually existing on disk */ @Test - @Category(MediumTests.class) public void testSchemeAndDirectorywhitelisted() throws Exception { negativeTestCase(new String[]{"/tmp","file:///permitted/*"}, "file:///permitted/couldnotpossiblyexist.jar"); @@ -217,7 +208,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * the added coprocessor not actually existing on disk */ @Test - @Category(MediumTests.class) public void testSchemeWhitelisted() throws Exception { negativeTestCase(new String[]{"file:///"}, "file:///permitted/couldnotpossiblyexist.jar"); @@ -231,7 +221,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * the added coprocessor not actually existing on disk */ @Test - @Category(MediumTests.class) public void testDFSNameWhitelistedWorks() throws Exception { negativeTestCase(new String[]{"hdfs://Your-FileSystem"}, "hdfs://Your-FileSystem/permitted/couldnotpossiblyexist.jar"); @@ -245,7 +234,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * the added coprocessor not actually existing on disk */ @Test - @Category(MediumTests.class) public void testDFSNameNotWhitelistedFails() throws Exception { positiveTestCase(new String[]{"hdfs://Your-FileSystem"}, "hdfs://My-FileSystem/permitted/couldnotpossiblyexist.jar"); @@ -259,7 +247,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * the added coprocessor not actually existing on disk */ @Test - @Category(MediumTests.class) public void testBlanketWhitelist() throws Exception { negativeTestCase(new String[]{"*"}, "hdfs:///permitted/couldnotpossiblyexist.jar"); @@ -271,7 +258,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * @result Table will not be created due to the offending coprocessor */ @Test - @Category(MediumTests.class) public void testCreationNonWhitelistedCoprocessorPath() throws Exception { Configuration conf = UTIL.getConfiguration(); // load coprocessor under test @@ -309,7 +295,6 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil { * @result Table will be created with the coprocessor */ @Test - @Category(MediumTests.class) public void testCreationClasspathCoprocessor() throws Exception { Configuration conf = UTIL.getConfiguration(); // load coprocessor under test
