HBASE-3538 Column families allow to have slashes in name

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1080870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-03-12 06:34:26 +00:00
parent 2501de1c3f
commit c96566d022
3 changed files with 17 additions and 1 deletions

View File

@ -65,6 +65,7 @@ Release 0.91.0 - Unreleased
HBASE-3612 HBaseAdmin::isTableAvailable returns true when the table does
not exit
HBASE-3626 Update instructions in thrift demo files (Moaz Reyad via Stack)
HBASE-3538 Column families allow to have slashes in name (Ian Knome via Stack)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -284,7 +284,7 @@ public class HColumnDescriptor implements WritableComparable<HColumnDescriptor>
"period: " + Bytes.toString(b));
}
for (int i = 0; i < b.length; i++) {
if (Character.isISOControl(b[i]) || b[i] == ':') {
if (Character.isISOControl(b[i]) || b[i] == ':' || b[i] == '\\' || b[i] == '/') {
throw new IllegalArgumentException("Illegal character <" + b[i] +
">. Family names cannot contain control characters or colons: " +
Bytes.toString(b));

View File

@ -148,6 +148,16 @@ public class TestAdmin {
assertEquals(htd.compareTo(confirmedHtd), 0);
}
@Test
public void testHColumnValidName() {
boolean exceptionThrown = false;
try {
HColumnDescriptor fam1 = new HColumnDescriptor("\\test\\abc");
} catch(IllegalArgumentException iae) {
exceptionThrown = true;
assertTrue(exceptionThrown);
}
}
/**
* Verify schema modification takes.
* @throws IOException
@ -622,6 +632,11 @@ public class TestAdmin {
this.admin.createTable(new HTableDescriptor());
}
@Test (expected=IllegalArgumentException.class)
public void testInvalidHColumnDescriptor() throws IOException {
HColumnDescriptor hcd = new HColumnDescriptor("/cfamily/name");
}
@Test
public void testEnableDisableAddColumnDeleteColumn() throws Exception {
byte [] tableName = Bytes.toBytes("testMasterAdmin");