http://git-wip-us.apache.org/repos/asf/hbase/blob/a1bc20ab/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestAddColumnFamilyProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestAddColumnFamilyProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestAddColumnFamilyProcedure.java deleted file mode 100644 index 01de512..0000000 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestAddColumnFamilyProcedure.java +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hbase.master.procedure; - -import static org.junit.Assert.assertTrue; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.hbase.CategoryBasedTimeout; -import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.InvalidFamilyOperationException; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.procedure2.Procedure; -import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; -import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility; -import org.apache.hadoop.hbase.testclassification.MasterTests; -import org.apache.hadoop.hbase.testclassification.MediumTests; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; -import org.junit.rules.TestRule; - -@Category({MasterTests.class, MediumTests.class}) -public class TestAddColumnFamilyProcedure extends TestTableDDLProcedureBase { - private static final Log LOG = LogFactory.getLog(TestAddColumnFamilyProcedure.class); - @Rule public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()). - withLookingForStuckThread(true).build(); - - @Rule public TestName name = new TestName(); - - @Test(timeout = 60000) - public void testAddColumnFamily() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf1 = "cf1"; - final String cf2 = "cf2"; - final HColumnDescriptor columnDescriptor1 = new HColumnDescriptor(cf1); - final HColumnDescriptor columnDescriptor2 = new HColumnDescriptor(cf2); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f3"); - - // Test 1: Add a column family online - long procId1 = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor1)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - - MasterProcedureTestingUtility.validateColumnFamilyAddition(getMaster(), tableName, cf1); - - // Test 2: Add a column family offline - UTIL.getAdmin().disableTable(tableName); - long procId2 = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor2)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - MasterProcedureTestingUtility.validateColumnFamilyAddition(getMaster(), tableName, cf2); - } - - @Test(timeout=60000) - public void testAddSameColumnFamilyTwice() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf2 = "cf2"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf2); - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1"); - - // add the column family - long procId1 = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - MasterProcedureTestingUtility.validateColumnFamilyAddition(getMaster(), tableName, cf2); - - // add the column family that exists - long procId2 = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId2); - - // Second add should fail with InvalidFamilyOperationException - Procedure<?> result = procExec.getResult(procId2); - assertTrue(result.isFailed()); - LOG.debug("Add failed with exception: " + result.getException()); - assertTrue( - ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException); - - // Do the same add the existing column family - this time offline - UTIL.getAdmin().disableTable(tableName); - long procId3 = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId3); - - // Second add should fail with InvalidFamilyOperationException - result = procExec.getResult(procId3); - assertTrue(result.isFailed()); - LOG.debug("Add failed with exception: " + result.getException()); - assertTrue( - ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException); - } - - @Test(timeout = 60000) - public void testRecoveryAndDoubleExecutionOffline() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf4 = "cf4"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf4); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", "f3"); - UTIL.getAdmin().disableTable(tableName); - - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the AddColumnFamily procedure && kill the executor - long procId = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - - // Restart the executor and execute the step twice - MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); - - MasterProcedureTestingUtility.validateColumnFamilyAddition(getMaster(), tableName, cf4); - } - - @Test(timeout = 60000) - public void testRecoveryAndDoubleExecutionOnline() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf5 = "cf5"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf5); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", "f3"); - - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the AddColumnFamily procedure && kill the executor - long procId = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - - // Restart the executor and execute the step twice - MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); - - MasterProcedureTestingUtility.validateColumnFamilyAddition(getMaster(), tableName, cf5); - } - - @Test(timeout = 60000) - public void testRollbackAndDoubleExecution() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf6 = "cf6"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf6); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2"); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the AddColumnFamily procedure && kill the executor - long procId = procExec.submitProcedure( - new AddColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - - int numberOfSteps = 0; // failing at "pre operations" - MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); - - MasterProcedureTestingUtility.validateColumnFamilyDeletion(getMaster(), tableName, cf6); - } -}
http://git-wip-us.apache.org/repos/asf/hbase/blob/a1bc20ab/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 deleted file mode 100644 index 9747da6..0000000 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestDeleteColumnFamilyProcedure.java +++ /dev/null @@ -1,211 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hbase.master.procedure; - -import static org.junit.Assert.assertTrue; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.hbase.CategoryBasedTimeout; -import org.apache.hadoop.hbase.InvalidFamilyOperationException; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.RegionInfo; -import org.apache.hadoop.hbase.procedure2.Procedure; -import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; -import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility; -import org.apache.hadoop.hbase.testclassification.MasterTests; -import org.apache.hadoop.hbase.testclassification.MediumTests; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; -import org.junit.rules.TestRule; - -@Category({MasterTests.class, MediumTests.class}) -public class TestDeleteColumnFamilyProcedure extends TestTableDDLProcedureBase { - private static final Log LOG = LogFactory.getLog(TestDeleteColumnFamilyProcedure.class); - @Rule public final TestRule timeout = CategoryBasedTimeout.builder().withTimeout(this.getClass()). - withLookingForStuckThread(true).build(); - @Rule public TestName name = new TestName(); - - @Test(timeout = 60000) - public void testDeleteColumnFamily() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - final String cf1 = "cf1"; - final String cf2 = "cf2"; - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, cf1, cf2, "f3"); - - // Test 1: delete the column family that exists online - long procId1 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf1.getBytes())); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - - MasterProcedureTestingUtility.validateColumnFamilyDeletion(getMaster(), tableName, cf1); - - // Test 2: delete the column family that exists offline - UTIL.getAdmin().disableTable(tableName); - long procId2 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - } - - @Test(timeout=60000) - public void testDeleteColumnFamilyTwice() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - 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())); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - // First delete should succeed - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - - MasterProcedureTestingUtility.validateColumnFamilyDeletion(getMaster(), tableName, cf2); - - // delete the column family that does not exist - long procId2 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); - - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId2); - - // Second delete should fail with InvalidFamilyOperationException - Procedure<?> result = procExec.getResult(procId2); - assertTrue(result.isFailed()); - LOG.debug("Delete online failed with exception: " + result.getException()); - assertTrue( - ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException); - - // Try again, this time with table disabled. - UTIL.getAdmin().disableTable(tableName); - long procId3 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf2.getBytes())); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId3); - // Expect fail with InvalidFamilyOperationException - result = procExec.getResult(procId2); - assertTrue(result.isFailed()); - LOG.debug("Delete offline failed with exception: " + result.getException()); - assertTrue( - ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException); - } - - @Test(timeout=60000) - public void testDeleteNonExistingColumnFamily() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - final String cf3 = "cf3"; - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2"); - - // delete the column family that does not exist - long procId1 = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf3.getBytes())); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - - Procedure<?> result = procExec.getResult(procId1); - assertTrue(result.isFailed()); - LOG.debug("Delete failed with exception: " + result.getException()); - assertTrue( - ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException); - } - - @Test(timeout=60000) - public void testRecoveryAndDoubleExecutionOffline() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf4 = "cf4"; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", "f3", cf4); - UTIL.getAdmin().disableTable(tableName); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the Delete procedure && kill the executor - long procId = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf4.getBytes())); - - // Restart the executor and execute the step twice - MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); - - MasterProcedureTestingUtility.validateColumnFamilyDeletion(getMaster(), tableName, cf4); - } - - @Test(timeout = 60000) - public void testRecoveryAndDoubleExecutionOnline() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf5 = "cf5"; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", "f3", cf5); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the Delete procedure && kill the executor - long procId = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf5.getBytes())); - - // Restart the executor and execute the step twice - MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); - - MasterProcedureTestingUtility.validateColumnFamilyDeletion(getMaster(), tableName, cf5); - } - - @Test(timeout = 60000) - public void testRollbackAndDoubleExecution() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf5 = "cf5"; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - RegionInfo[] regions = MasterProcedureTestingUtility.createTable( - procExec, tableName, null, "f1", "f2", "f3", cf5); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the Delete procedure && kill the executor - long procId = procExec.submitProcedure( - new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf5.getBytes())); - - int numberOfSteps = 0; // failing at pre operation - MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); - - MasterProcedureTestingUtility.validateTableCreation( - getMaster(), tableName, regions, "f1", "f2", "f3", cf5); - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/a1bc20ab/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 deleted file mode 100644 index 934f5b2..0000000 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestModifyColumnFamilyProcedure.java +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hbase.master.procedure; - -import static org.junit.Assert.assertTrue; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.InvalidFamilyOperationException; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.procedure2.Procedure; -import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; -import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility; -import org.apache.hadoop.hbase.testclassification.MasterTests; -import org.apache.hadoop.hbase.testclassification.MediumTests; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.rules.TestName; - -@Category({MasterTests.class, MediumTests.class}) -public class TestModifyColumnFamilyProcedure extends TestTableDDLProcedureBase { - private static final Log LOG = LogFactory.getLog(TestModifyColumnFamilyProcedure.class); - - @Rule - public TestName name = new TestName(); - - @Test(timeout = 60000) - public void testModifyColumnFamily() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf1 = "cf1"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf1); - int oldBlockSize = columnDescriptor.getBlocksize(); - int newBlockSize = 3 * oldBlockSize; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, cf1, "f2"); - - // Test 1: modify the column family online - columnDescriptor.setBlocksize(newBlockSize); - long procId1 = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId1); - MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster() - .getMaster(), tableName, cf1, columnDescriptor); - - // Test 2: modify the column family offline - UTIL.getAdmin().disableTable(tableName); - columnDescriptor.setBlocksize(newBlockSize * 2); - long procId2 = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId2); - ProcedureTestingUtility.assertProcNotFailed(procExec, procId2); - MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster() - .getMaster(), tableName, cf1, columnDescriptor); - } - - @Test(timeout=60000) - public void testModifyNonExistingColumnFamily() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf2 = "cf2"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf2); - int oldBlockSize = columnDescriptor.getBlocksize(); - int newBlockSize = 2 * oldBlockSize; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1"); - - // Modify the column family that does not exist - columnDescriptor.setBlocksize(newBlockSize); - long procId1 = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - // Wait the completion - ProcedureTestingUtility.waitProcedure(procExec, procId1); - - Procedure<?> result = procExec.getResult(procId1); - assertTrue(result.isFailed()); - LOG.debug("Modify failed with exception: " + result.getException()); - assertTrue( - ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException); - } - - @Test(timeout=60000) - public void testRecoveryAndDoubleExecutionOffline() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf3 = "cf3"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf3); - int oldBlockSize = columnDescriptor.getBlocksize(); - int newBlockSize = 4 * oldBlockSize; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", cf3); - UTIL.getAdmin().disableTable(tableName); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the Modify procedure && kill the executor - columnDescriptor.setBlocksize(newBlockSize); - long procId = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - - // Restart the executor and execute the step twice - MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); - - MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster() - .getMaster(), tableName, cf3, columnDescriptor); - } - - @Test(timeout = 60000) - public void testRecoveryAndDoubleExecutionOnline() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf4 = "cf4"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf4); - int oldBlockSize = columnDescriptor.getBlocksize(); - int newBlockSize = 4 * oldBlockSize; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", cf4); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the Modify procedure && kill the executor - columnDescriptor.setBlocksize(newBlockSize); - long procId = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - - // Restart the executor and execute the step twice - MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId); - - MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster() - .getMaster(), tableName, cf4, columnDescriptor); - } - - @Test(timeout = 60000) - public void testRollbackAndDoubleExecution() throws Exception { - final TableName tableName = TableName.valueOf(name.getMethodName()); - final String cf3 = "cf3"; - final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf3); - int oldBlockSize = columnDescriptor.getBlocksize(); - int newBlockSize = 4 * oldBlockSize; - - final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); - - // create the table - MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", cf3); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); - - // Start the Modify procedure && kill the executor - columnDescriptor.setBlocksize(newBlockSize); - long procId = procExec.submitProcedure( - new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor)); - - int numberOfSteps = 0; // failing at pre operation - MasterProcedureTestingUtility.testRollbackAndDoubleExecution(procExec, procId, numberOfSteps); - } -} http://git-wip-us.apache.org/repos/asf/hbase/blob/a1bc20ab/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java index 296b760..276487a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java @@ -447,57 +447,6 @@ public class TestAccessController extends SecureTestUtil { } @Test (timeout=180000) - public void testAddColumn() throws Exception { - final HColumnDescriptor hcd = new HColumnDescriptor("fam_new"); - AccessTestAction action = new AccessTestAction() { - @Override - public Object run() throws Exception { - ACCESS_CONTROLLER.preAddColumnFamily(ObserverContextImpl.createAndPrepare(CP_ENV), TEST_TABLE, - hcd); - return null; - } - }; - - verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_CREATE, USER_OWNER, USER_GROUP_CREATE, - USER_GROUP_ADMIN); - verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE); - } - - @Test (timeout=180000) - public void testModifyColumn() throws Exception { - final HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY); - hcd.setMaxVersions(10); - AccessTestAction action = new AccessTestAction() { - @Override - public Object run() throws Exception { - ACCESS_CONTROLLER.preModifyColumnFamily(ObserverContextImpl.createAndPrepare(CP_ENV), - TEST_TABLE, hcd); - return null; - } - }; - - verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_CREATE, USER_OWNER, USER_ADMIN_CF, - USER_GROUP_CREATE, USER_GROUP_ADMIN); - verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE); - } - - @Test (timeout=180000) - public void testDeleteColumn() throws Exception { - AccessTestAction action = new AccessTestAction() { - @Override - public Object run() throws Exception { - ACCESS_CONTROLLER.preDeleteColumnFamily(ObserverContextImpl.createAndPrepare(CP_ENV), - TEST_TABLE, TEST_FAMILY); - return null; - } - }; - - verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_CREATE, USER_OWNER, USER_ADMIN_CF, - USER_GROUP_CREATE, USER_GROUP_ADMIN); - verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE); - } - - @Test (timeout=180000) public void testTableDisable() throws Exception { AccessTestAction disableTable = new AccessTestAction() { @Override http://git-wip-us.apache.org/repos/asf/hbase/blob/a1bc20ab/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java index bdbd11b..724641f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java @@ -522,38 +522,6 @@ public class TestWithDisabledAuthorization extends SecureTestUtil { } }, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE); - // preAddColumnFamily - verifyAllowed(new AccessTestAction() { - @Override - public Object run() throws Exception { - HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY2); - ACCESS_CONTROLLER.preAddColumnFamily(ObserverContextImpl.createAndPrepare(CP_ENV), - TEST_TABLE.getTableName(), hcd); - return null; - } - }, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE); - - // preModifyColumnFamily - verifyAllowed(new AccessTestAction() { - @Override - public Object run() throws Exception { - HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY2); - ACCESS_CONTROLLER.preModifyColumnFamily(ObserverContextImpl.createAndPrepare(CP_ENV), - TEST_TABLE.getTableName(), hcd); - return null; - } - }, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE); - - // preDeleteColumnFamily - verifyAllowed(new AccessTestAction() { - @Override - public Object run() throws Exception { - ACCESS_CONTROLLER.preDeleteColumnFamily(ObserverContextImpl.createAndPrepare(CP_ENV), - TEST_TABLE.getTableName(), TEST_FAMILY2); - return null; - } - }, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE); - // preEnableTable verifyAllowed(new AccessTestAction() { @Override