HADOOP-1581 HBASE: Un-openable tablename bug

Change 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.
M src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTable.java
  Rename testTable as testCreateTable.
  (testTableNameClash): Test for this issue.
M src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionInfo.java
  Change format of region names so delimiter is ',' rather than '_'.



git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@556348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2007-07-14 22:25:32 +00:00
parent cf67022394
commit 8c14bab2c4
5 changed files with 42 additions and 15 deletions

View File

@ -60,3 +60,4 @@ Trunk (unreleased changes)
36. HADOOP-1600 Update license in HBase code 36. HADOOP-1600 Update license in HBase code
37. HADOOP-1589 Exception handling in HBase is broken over client server 37. HADOOP-1589 Exception handling in HBase is broken over client server
38. HADOOP-1574 Concurrent creates of a table named 'X' all succeed 38. HADOOP-1574 Concurrent creates of a table named 'X' all succeed
39. HADOOP-1581 Un-openable tablename bug

View File

@ -40,7 +40,7 @@ public class HRegionInfo implements WritableComparable {
Text endKey; Text endKey;
boolean offLine; boolean offLine;
HTableDescriptor tableDesc; HTableDescriptor tableDesc;
public static final char DELIMITER = '_'; public static final char DELIMITER = ',';
/** Default constructor - creates empty object */ /** Default constructor - creates empty object */
public HRegionInfo() { public HRegionInfo() {
@ -66,10 +66,10 @@ public class HRegionInfo implements WritableComparable {
/** /**
* Construct HRegionInfo with explicit parameters * Construct HRegionInfo with explicit parameters
* *
* @param regionId - the regionid * @param regionId the region id
* @param tableDesc - the table descriptor * @param tableDesc the table descriptor
* @param startKey - first key in region * @param startKey first key in region
* @param endKey - end of key range * @param endKey end of key range
* @throws IllegalArgumentException * @throws IllegalArgumentException
*/ */
public HRegionInfo(long regionId, HTableDescriptor tableDesc, Text startKey, public HRegionInfo(long regionId, HTableDescriptor tableDesc, Text startKey,
@ -204,9 +204,9 @@ public class HRegionInfo implements WritableComparable {
return tableDesc; return tableDesc;
} }
////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Comparable // Comparable
////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
public int compareTo(Object o) { public int compareTo(Object o) {
HRegionInfo other = (HRegionInfo) o; HRegionInfo other = (HRegionInfo) o;

View File

@ -37,12 +37,25 @@
before running a retry of a failed get, region lookup, etc.</description> before running a retry of a failed get, region lookup, etc.</description>
</property> </property>
<property> <property>
<name>hbase.client.retries.number</name> <name>hbase.master.meta.thread.rescanfrequency</name>
<value>5</value> <value>10000</value>
<description>Maximum retries. Used as maximum for all retryable <description>How long the HMaster sleeps (in milliseconds) between scans of
operations such as fetching of the root region from root region the root and meta tables.
server, getting a cell's value, starting a row update, etc. </description>
Default: 5. </property>
<property>
<name>hbase.server.thread.wakefrequency</name>
<value>1000</value>
<description>Time to sleep in between searches for work (in milliseconds).
Used as sleep interval by service threads such as META scanner and log roller.
</description>
</property>
<property>
<name>hbase.regionserver.handler.count</name>
<value>3</value>
<description>Count of RPC Server instances spun up on RegionServers
Same property is used by the HMaster for count of master handlers.
Default is 10.
</description> </description>
</property> </property>
</configuration> </configuration>

View File

@ -18,6 +18,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase; package org.apache.hadoop.hbase;
import org.apache.hadoop.io.Text;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -28,7 +29,7 @@ public class TestTable extends HBaseClusterTestCase {
super(true); super(true);
} }
public void testTable() throws IOException { public void testCreateTable() throws IOException {
final HClient client = new HClient(conf); final HClient client = new HClient(conf);
String msg = null; String msg = null;
try { try {
@ -104,4 +105,16 @@ public class TestTable extends HBaseClusterTestCase {
assertTrue(successes.get() == 1); assertTrue(successes.get() == 1);
assertTrue(failures.get() == (count - 1)); assertTrue(failures.get() == (count - 1));
} }
/**
* Test for hadoop-1581 'HBASE: Unopenable tablename bug'.
* @throws Exception
*/
public void testTableNameClash() throws Exception {
HClient client = new HClient(conf);
client.createTable(new HTableDescriptor(getName() + "SOMEUPPERCASE"));
client.createTable(new HTableDescriptor(getName()));
// Before fix, below would fail throwing a NoServerForRegionException.
client.openTable(new Text(getName()));
}
} }

View File

@ -46,7 +46,7 @@ public class TestToString extends TestCase {
HRegionInfo hri = new HRegionInfo(-1, htd, new Text(), new Text("10")); HRegionInfo hri = new HRegionInfo(-1, htd, new Text(), new Text("10"));
System.out.println(hri.toString()); System.out.println(hri.toString());
assertEquals("HRegionInfo", assertEquals("HRegionInfo",
"regionname: hank__-1, startKey: <>, tableDesc: {" + "name: hank, " "regionname: hank,,-1, startKey: <>, tableDesc: {" + "name: hank, "
+ "families: {hankfamily:=(hankfamily:, max versions: 3, " + "families: {hankfamily:=(hankfamily:, max versions: 3, "
+ "compression: none, in memory: false, max value length: 2147483647, " + "compression: none, in memory: false, max value length: 2147483647, "
+ "bloom filter: none), hankotherfamily:=(hankotherfamily:, " + "bloom filter: none), hankotherfamily:=(hankotherfamily:, "