### Eclipse Workspace Patch 1.0 #P hbase Index: src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java (revision 1352502) +++ src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java (working copy) @@ -374,6 +374,10 @@ "> at 0. User-space table names can only start with 'word " + "characters': i.e. [a-zA-Z_0-9]: " + Bytes.toString(tableName)); } + if (isACLTable(tableName)) { + throw new IllegalArgumentException("Illegal table name. It is a reservered" + + " table :" + Bytes.toString(tableName)); + } for (int i = 0; i < tableName.length; i++) { if (Character.isLetterOrDigit(tableName[i]) || tableName[i] == '_' || tableName[i] == '-' || tableName[i] == '.') { @@ -385,6 +389,10 @@ } return tableName; } + + private static boolean isACLTable(final byte [] tableName) { + return Bytes.equals(tableName, HConstants.ACL_TABLE_NAME) ; + } /** * Getter for accessing the metadata associated with the key Index: src/main/java/org/apache/hadoop/hbase/HConstants.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HConstants.java (revision 1352502) +++ src/main/java/org/apache/hadoop/hbase/HConstants.java (working copy) @@ -289,6 +289,9 @@ /** The META table's name. */ public static final byte [] META_TABLE_NAME = Bytes.toBytes(".META."); + /** The ACL table's name. */ + public static final byte [] ACL_TABLE_NAME = Bytes.toBytes("_acl_"); + /** delimiter used between portions of a region name */ public static final int META_ROW_DELIMITER = ','; Index: src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java (revision 1352502) +++ src/test/java/org/apache/hadoop/hbase/TestHTableDescriptor.java (working copy) @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver; import org.junit.Test; @@ -62,5 +63,17 @@ desc.remove(key); assertEquals(null, desc.getValue(key)); } + + /** + * Test isLegalTableName API with _acl_ table name, it should throw IllegalArgumentException. + * @throws Exception + */ + @Test + public void testShouldCheckForACLTbl() throws Exception { + try { + HTableDescriptor.isLegalTableName ( HConstants.ACL_TABLE_NAME); + fail("Should throw IAException if the table name is _acl_"); + } catch (IllegalArgumentException exc){} + } }