Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
None
-
None
-
None
-
None
Description
If you create a table whose name is the beginning of an already existing table name, you will not be able to open the table.
Try:
1) Create table TESTOne
2) Create table TEST
3) Open table TEST
The reason is that the the META keys augment the table name with [regionID]. So when looking up table TEST, a scanner is opened on the HMemCache Meta region with a start key of "TEST". But the HMemcacheScanner backingMaps (TreeMaps) are keyed with the augmented table names where TESTOne[regionid1] comes before TEST_[regionid2] because 'O' is lower than _ in the ASCII table. The backingMaps[i].tailMap(firstKey).keySet().iterator() line in HMemCache returns an iterator starting from TestOne_... and not Test_... like it should.
The "if(!regionInfo.tableDesc.getName().equals(tableName)) {" line in HClient will cause the method to stop searching for more regions of that table and the number of found tables for tableName will be 0. Incidentally that IF statement will report "table found" even when that is not the case.
Suggested fix for this issue.
HADOOP-1581HBASE: Un-openable tablename bugChange format of region names from TABLENAME_STARTROW_ENDROW-RANDOMID
to TABLENAME,STARTROW,ENDROW-RANDOMID. Makes it so lone table name will
sort before any region of said table.
M src/contrib/hbase/src/test/hbase-site.xml
(hbase.client.retries.number): Removed. Wasdefault value for this property.
(hbase.master.meta.thread.rescanfrequency,
hbase.server.thread.wakefrequency,
hbase.regionserver.handler.count): Add values that are less than
default so unit tests are even more responsive (and finished
quicker).
M src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestToString.java
Change test so it expects region info name that has ',' delimiters
rather than '_' delimiters.
Rename testTable as testCreateTable.
(testTableNameClash): Test for this issue.
Comment on table name sorting.
Change format of region names so delimiter is ',' rather than '_'.