hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [hbase] branch master updated: HBASE-23771 [Flakey Tests] Test TestSplitTransactionOnCluster Again
Date Fri, 31 Jan 2020 16:36:08 GMT
This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a6bdc7  HBASE-23771 [Flakey Tests] Test TestSplitTransactionOnCluster Again
1a6bdc7 is described below

commit 1a6bdc7c5078d0b77c40b5ddfc6e64885fd5cc7e
Author: stack <stack@apache.org>
AuthorDate: Wed Jan 29 22:36:13 2020 -0800

    HBASE-23771 [Flakey Tests] Test TestSplitTransactionOnCluster Again
---
 .../TestSplitTransactionOnCluster.java             | 48 ++++++++++------------
 1 file changed, 22 insertions(+), 26 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
index 65bd4f5..ab67c23 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
@@ -384,29 +384,8 @@ public class TestSplitTransactionOnCluster {
       HRegion daughterRegion = daughters.get(0);
       RegionInfo daughter = daughterRegion.getRegionInfo();
       LOG.info("Daughter we are going to split: " + daughter);
-      // Compact first to ensure we have cleaned up references -- else the split will fail.
-      // May be a compaction going already so compact will return immediately; if so, wait
until
-      // compaction completes.
-      daughterRegion.compact(true);
-      HStore store = daughterRegion.getStores().get(0);
-      CompactionProgress progress = store.getCompactionProgress();
-      if (progress != null) {
-        while (progress.getProgressPct() < 1) {
-          LOG.info("Waiting {}", progress);
-          Threads.sleep(1000);
-        }
-      }
-      store.closeAndArchiveCompactedFiles();
-      for (int i = 0; i < 100; i++) {
-        if (!daughterRegion.hasReferences()) {
-          LOG.info("Break -- no references in {}", daughterRegion);
-          break;
-        }
-        Threads.sleep(100);
-      }
+      clearReferences(daughterRegion);
       LOG.info("Finished {} references={}", daughterRegion, daughterRegion.hasReferences());
-      assertFalse("Waiting for reference to be compacted", daughterRegion.hasReferences());
-      LOG.info("Daughter hri before split (has been compacted): " + daughter);
       admin.splitRegionAsync(daughter.getRegionName()).get(2, TimeUnit.MINUTES);
       // Get list of daughters
       daughters = cluster.getRegions(tableName);
@@ -439,6 +418,26 @@ public class TestSplitTransactionOnCluster {
     }
   }
 
+  private void clearReferences(HRegion region) throws IOException {
+    // Presumption.
+    assertEquals(1, region.getStores().size());
+    HStore store = region.getStores().get(0);
+    while (store.hasReferences()) {
+      // Wait on any current compaction to complete first.
+      CompactionProgress progress = store.getCompactionProgress();
+      if (progress != null && progress.getProgressPct() < 1.0f) {
+        while (progress.getProgressPct() < 1.0f) {
+          LOG.info("Waiting, progress={}", progress.getProgressPct());
+          Threads.sleep(1000);
+        }
+      } else {
+        // Run new compaction. Shoudn't be any others running.
+        region.compact(true);
+      }
+      store.closeAndArchiveCompactedFiles();
+    }
+  }
+
   @Test
   public void testSplitShouldNotThrowNPEEvenARegionHasEmptySplitFiles() throws Exception
{
     TableName userTableName = TableName.valueOf(name.getMethodName());
@@ -536,8 +535,7 @@ public class TestSplitTransactionOnCluster {
       HMaster master = abortAndWaitForMaster();
       // Now call compact on the daughters and clean up any references.
       for (HRegion daughter : daughters) {
-        daughter.compact(true);
-        daughter.getStores().get(0).closeAndArchiveCompactedFiles();
+        clearReferences(daughter);
         assertFalse(daughter.hasReferences());
       }
       // BUT calling compact on the daughters is not enough. The CatalogJanitor looks
@@ -820,8 +818,6 @@ public class TestSplitTransactionOnCluster {
   /**
    * Ensure single table region is not on same server as the single hbase:meta table
    * region.
-   * @param admin
-   * @param hri
    * @return Index of the server hosting the single table region
    * @throws UnknownRegionException
    * @throws MasterNotRunningException


Mime
View raw message