HBASE-15192 TestRegionMergeTransactionOnCluster#testCleanMergeReference is flaky

This commit is contained in:
tedyu 2016-02-02 09:42:15 -08:00
parent fc5e698c0a
commit 243e6cc529
2 changed files with 10 additions and 4 deletions

View File

@ -214,6 +214,7 @@ public class CatalogJanitor extends ScheduledChore {
int scan() throws IOException { int scan() throws IOException {
try { try {
if (!alreadyRunning.compareAndSet(false, true)) { if (!alreadyRunning.compareAndSet(false, true)) {
LOG.debug("CatalogJanitor already running");
return 0; return 0;
} }
Triple<Integer, Map<HRegionInfo, Result>, Map<HRegionInfo, Result>> scanTriple = Triple<Integer, Map<HRegionInfo, Result>, Map<HRegionInfo, Result>> scanTriple =

View File

@ -268,8 +268,8 @@ public class TestRegionMergeTransactionOnCluster {
cleaner.chore(); cleaner.chore();
Thread.sleep(1000); Thread.sleep(1000);
} }
int newcount1 = 0;
while (System.currentTimeMillis() < timeout) { while (System.currentTimeMillis() < timeout) {
int newcount1 = 0;
for(HColumnDescriptor colFamily : columnFamilies) { for(HColumnDescriptor colFamily : columnFamilies) {
newcount1 += hrfs.getStoreFiles(colFamily.getName()).size(); 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 // run CatalogJanitor to clean merge references in hbase:meta and archive the
// files of merging regions // 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); assertTrue(cleaned > 0);
assertFalse(fs.exists(regionAdir));
assertFalse(fs.exists(regionBdir));
mergedRegionResult = MetaTableAccessor.getRegionResult( mergedRegionResult = MetaTableAccessor.getRegionResult(
master.getConnection(), mergedRegionInfo.getRegionName()); master.getConnection(), mergedRegionInfo.getRegionName());