HorizonNet commented on a change in pull request #1719:
URL: https://github.com/apache/hbase/pull/1719#discussion_r426833566



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaFixer.java
##########
@@ -308,6 +314,75 @@ public void testOverlapWithSmallMergeCount() throws 
Exception {
     }
   }
 
+  /**
+   * This test covers the case that one of merged parent regions is a merged 
child region that
+   * has not been GCed but there is no reference files anymore. In this case, 
it will kick off
+   * a GC procedure, but no merge will happen.
+   */
+  @Test
+  public void testMergeWithMergedChildRegion() throws Exception {
+    TableName tn = TableName.valueOf(this.name.getMethodName());
+    Table t = TEST_UTIL.createMultiRegionTable(tn, HConstants.CATALOG_FAMILY);
+    List<RegionInfo> ris = 
MetaTableAccessor.getTableRegions(TEST_UTIL.getConnection(), tn);
+    assertTrue(ris.size() > 5);
+    HMaster services = TEST_UTIL.getHBaseCluster().getMaster();
+    CatalogJanitor cj = services.getCatalogJanitor();
+    cj.scan();
+    CatalogJanitor.Report report = cj.getLastReport();
+    assertTrue(report.isEmpty());
+    RegionInfo overlapRegion = makeOverlap(services, ris.get(1), ris.get(2));
+    Threads.sleep(10000);
+
+    cj.scan();
+    report = cj.getLastReport();
+    assertEquals(2, report.getOverlaps().size());
+
+    // Mark it as a merged child region.
+    RegionInfo fakedParentRegion = RegionInfoBuilder.newBuilder(tn).
+      setStartKey(overlapRegion.getStartKey()).
+      build();
+
+    Table meta = MetaTableAccessor.getMetaHTable(TEST_UTIL.getConnection());
+    long time = HConstants.LATEST_TIMESTAMP;

Review comment:
       I think you can add directly to `putOfMerged` as its value is only used 
once.

##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaFixer.java
##########
@@ -308,6 +314,75 @@ public void testOverlapWithSmallMergeCount() throws 
Exception {
     }
   }
 
+  /**
+   * This test covers the case that one of merged parent regions is a merged 
child region that
+   * has not been GCed but there is no reference files anymore. In this case, 
it will kick off
+   * a GC procedure, but no merge will happen.
+   */
+  @Test
+  public void testMergeWithMergedChildRegion() throws Exception {
+    TableName tn = TableName.valueOf(this.name.getMethodName());
+    Table t = TEST_UTIL.createMultiRegionTable(tn, HConstants.CATALOG_FAMILY);
+    List<RegionInfo> ris = 
MetaTableAccessor.getTableRegions(TEST_UTIL.getConnection(), tn);
+    assertTrue(ris.size() > 5);
+    HMaster services = TEST_UTIL.getHBaseCluster().getMaster();
+    CatalogJanitor cj = services.getCatalogJanitor();
+    cj.scan();
+    CatalogJanitor.Report report = cj.getLastReport();
+    assertTrue(report.isEmpty());
+    RegionInfo overlapRegion = makeOverlap(services, ris.get(1), ris.get(2));
+    Threads.sleep(10000);

Review comment:
       Can this one be set to lower value?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to