HBASE-6146 Disabling of Catalog tables should not be allowed (Anoop)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1347719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2012-06-07 17:25:22 +00:00
parent d2d3122865
commit bf5cd8abac
2 changed files with 17 additions and 0 deletions

View File

@ -725,6 +725,7 @@ public class HBaseAdmin implements Abortable, Closeable {
*/
public void enableTableAsync(final byte [] tableName)
throws IOException {
HTableDescriptor.isLegalTableName(tableName);
execute(new MasterCallable<Void>() {
@Override
public Void call() throws ServiceException {
@ -795,6 +796,7 @@ public class HBaseAdmin implements Abortable, Closeable {
* @since 0.90.0
*/
public void disableTableAsync(final byte [] tableName) throws IOException {
HTableDescriptor.isLegalTableName(tableName);
execute(new MasterCallable<Void>() {
@Override
public Void call() throws ServiceException {

View File

@ -1588,6 +1588,21 @@ public class TestAdmin {
" HBase was not available");
}
@Test
public void testDisableCatalogTable() throws Exception {
try {
this.admin.disableTable(".META.");
fail("Expected to throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
}
// Before the fix for HBASE-6146, the below table creation was failing as the META table
// actually getting disabled by the disableTable() call.
HTableDescriptor htd = new HTableDescriptor("testDisableCatalogTable".getBytes());
HColumnDescriptor hcd = new HColumnDescriptor("cf1".getBytes());
htd.addFamily(hcd);
TEST_UTIL.getHBaseAdmin().createTable(htd);
}
@org.junit.Rule
public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();