瀏覽代碼

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@556348 13f79535-47bb-0310-9956-ffa450edef68

Michael Stack 18 年之前
父節點
當前提交
34d355bbe9

+ 1 - 0
src/contrib/hbase/CHANGES.txt

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

+ 7 - 7
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionInfo.java

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

+ 19 - 6
src/contrib/hbase/src/test/hbase-site.xml

@@ -37,12 +37,25 @@
     before running a retry of a failed get, region lookup, etc.</description>
   </property>
   <property>
-    <name>hbase.client.retries.number</name>
-    <value>5</value>
-    <description>Maximum retries.  Used as maximum for all retryable
-    operations such as fetching of the root region from root region
-    server, getting a cell's value, starting a row update, etc.
-    Default: 5.
+    <name>hbase.master.meta.thread.rescanfrequency</name>
+    <value>10000</value>
+    <description>How long the HMaster sleeps (in milliseconds) between scans of
+    the root and meta tables.
+    </description>
+  </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>
   </property>
 </configuration>

+ 14 - 1
src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTable.java

@@ -18,6 +18,7 @@
  * limitations under the License.
  */
 package org.apache.hadoop.hbase;
+import org.apache.hadoop.io.Text;
 
 import java.io.IOException;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -28,7 +29,7 @@ public class TestTable extends HBaseClusterTestCase {
     super(true);
   }
 
-  public void testTable() throws IOException {
+  public void testCreateTable() throws IOException {
     final HClient client = new HClient(conf);
     String msg = null;
     try {
@@ -104,4 +105,16 @@ public class TestTable extends HBaseClusterTestCase {
     assertTrue(successes.get() == 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()));
+  }
 }

+ 1 - 1
src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestToString.java

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