From 889d89a74c8b1ae6ce7a0f70a63073bbe7708e88 Mon Sep 17 00:00:00 2001 From: Ramkrishna Date: Thu, 28 Apr 2016 14:24:39 +0530 Subject: [PATCH] HBASE-15697 Excessive TestHRegion running time on branch-1 (Ram) --- .../hadoop/hbase/regionserver/TestHRegion.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java index 713c8e50dce..e48a6c27bf0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java @@ -3874,6 +3874,9 @@ public class TestHRegion { if (i != 0 && i % compactInterval == 0) { region.compact(true); + for (Store store : region.getStores()) { + store.closeAndArchiveCompactedFiles(); + } } if (i != 0 && i % flushInterval == 0) { @@ -4040,19 +4043,15 @@ public class TestHRegion { // Add a thread that flushes as fast as possible ctx.addThread(new RepeatingTestThread(ctx) { - private int flushesSinceCompact = 0; - private final int maxFlushesSinceCompact = 20; @Override public void doAnAction() throws Exception { - if (region.flush(true).isCompactionNeeded()) { - ++flushesSinceCompact; - } + region.flush(true); // Compact regularly to avoid creating too many files and exceeding // the ulimit. - if (flushesSinceCompact == maxFlushesSinceCompact) { - region.compact(false); - flushesSinceCompact = 0; + region.compact(false); + for (Store store : region.getStores()) { + store.closeAndArchiveCompactedFiles(); } } });