From 243e6cc5293dc1e2a4dfd3af4ee29087c84184c8 Mon Sep 17 00:00:00 2001 From: tedyu Date: Tue, 2 Feb 2016 09:42:15 -0800 Subject: [PATCH] HBASE-15192 TestRegionMergeTransactionOnCluster#testCleanMergeReference is flaky --- .../apache/hadoop/hbase/master/CatalogJanitor.java | 1 + .../TestRegionMergeTransactionOnCluster.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java index ef2a0054924..d02e5ae05d3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java @@ -214,6 +214,7 @@ public class CatalogJanitor extends ScheduledChore { int scan() throws IOException { try { if (!alreadyRunning.compareAndSet(false, true)) { + LOG.debug("CatalogJanitor already running"); return 0; } Triple, Map> scanTriple = diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java index 44b24cefcb7..e3f6cc27e2c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java @@ -268,8 +268,8 @@ public class TestRegionMergeTransactionOnCluster { cleaner.chore(); Thread.sleep(1000); } - int newcount1 = 0; while (System.currentTimeMillis() < timeout) { + int newcount1 = 0; for(HColumnDescriptor colFamily : columnFamilies) { newcount1 += hrfs.getStoreFiles(colFamily.getName()).size(); } @@ -280,10 +280,15 @@ public class TestRegionMergeTransactionOnCluster { } // run CatalogJanitor to clean merge references in hbase:meta and archive the // files of merging regions - int cleaned = admin.runCatalogScan(); + int cleaned = 0; + while (cleaned == 0) { + cleaned = admin.runCatalogScan(); + LOG.debug("catalog janitor returned " + cleaned); + Thread.sleep(50); + } + assertFalse(regionAdir.toString(), fs.exists(regionAdir)); + assertFalse(regionBdir.toString(), fs.exists(regionBdir)); assertTrue(cleaned > 0); - assertFalse(fs.exists(regionAdir)); - assertFalse(fs.exists(regionBdir)); mergedRegionResult = MetaTableAccessor.getRegionResult( master.getConnection(), mergedRegionInfo.getRegionName());