소스 검색

HADOOP-2083 TestTableIndex failed in patch build #970 and #956

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@591039 13f79535-47bb-0310-9956-ffa450edef68
Michael Stack 18 년 전
부모
커밋
b0eba5ac0a
2개의 변경된 파일14개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 0
      src/contrib/hbase/CHANGES.txt
  2. 13 6
      src/contrib/hbase/src/test/org/apache/hadoop/hbase/MultiRegionTable.java

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

@@ -17,6 +17,7 @@ Trunk (unreleased changes)
    HADOOP-2056 A table with row keys containing colon fails to split regions
    HADOOP-2079 HADOOP-2056 Fix generated HLog, HRegion names
    HADOOP-2124 Use of `hostname` does not work on Cygwin in some cases
+   HADOOP-2083 TestTableIndex failed in #970 and #956
 
   IMPROVEMENTS
     HADOOP-2401 Add convenience put method that takes writable

+ 13 - 6
src/contrib/hbase/src/test/org/apache/hadoop/hbase/MultiRegionTable.java

@@ -75,19 +75,27 @@ public class MultiRegionTable extends HBaseTestCase {
     HTable meta = new HTable(conf, HConstants.META_TABLE_NAME);
     int count = count(meta, tableName);
     HTable t = new HTable(conf, new Text(tableName));
+    // We created the table.  Get the parent region here now.  One will
+    // have been created though nought in it.
+    HRegionInfo parent =
+      t.getRegionLocation(HConstants.EMPTY_START_ROW).getRegionInfo();
+    LOG.info("Parent region " + parent.toString());
+    // Now add content.
     addContent(new HTableIncommon(t), columnName);
     LOG.info("Finished content loading");
     
     // All is running in the one JVM so I should be able to get the single
-    // region instance and bring on a split.
-    // Presumption is that there is only one regionserver.
+    // region instance and bring on a split. Presumption is that there is only
+    // one regionserver.   Of not, the split may already have happened by the
+    // time we got here.  If so, then the region found when we go searching
+    // with EMPTY_START_ROW will be one of the unsplittable daughters.
     HRegionInfo hri = null;
     HRegion r = null;
     for (int i = 0; i < 30; i++) {
       hri = t.getRegionLocation(HConstants.EMPTY_START_ROW).getRegionInfo();
       LOG.info("Region location: " + hri);
       r = cluster.getRegionThreads().get(0).getRegionServer().
-          onlineRegions.get(hri.getRegionName());
+        onlineRegions.get(hri.getRegionName());
       if (r != null) {
         break;
       }
@@ -121,9 +129,8 @@ public class MultiRegionTable extends HBaseTestCase {
     // Get info on the parent from the meta table.  Pass in 'hri'. Its the
     // region we have been dealing with up to this. Its the parent of the
     // region split.
-    Map<Text, byte []> data = getSplitParentInfo(meta, hri);
-    HRegionInfo parent =
-      Writables.getHRegionInfoOrNull(data.get(HConstants.COL_REGIONINFO));
+    Map<Text, byte []> data = getSplitParentInfo(meta, parent);
+    parent  = Writables.getHRegionInfoOrNull(data.get(HConstants.COL_REGIONINFO));
     LOG.info("Found parent region: " + parent);
     assertTrue(parent.isOffline());
     assertTrue(parent.isSplit());