HBASE-15697 Excessive TestHRegion running time on branch-1 (Ram)

This commit is contained in:
Ramkrishna 2016-04-28 14:24:39 +05:30
parent 9343ef438f
commit 889d89a74c
1 changed files with 7 additions and 8 deletions

View File

@ -3874,6 +3874,9 @@ public class TestHRegion {
if (i != 0 && i % compactInterval == 0) { if (i != 0 && i % compactInterval == 0) {
region.compact(true); region.compact(true);
for (Store store : region.getStores()) {
store.closeAndArchiveCompactedFiles();
}
} }
if (i != 0 && i % flushInterval == 0) { if (i != 0 && i % flushInterval == 0) {
@ -4040,19 +4043,15 @@ public class TestHRegion {
// Add a thread that flushes as fast as possible // Add a thread that flushes as fast as possible
ctx.addThread(new RepeatingTestThread(ctx) { ctx.addThread(new RepeatingTestThread(ctx) {
private int flushesSinceCompact = 0;
private final int maxFlushesSinceCompact = 20;
@Override @Override
public void doAnAction() throws Exception { public void doAnAction() throws Exception {
if (region.flush(true).isCompactionNeeded()) { region.flush(true);
++flushesSinceCompact;
}
// Compact regularly to avoid creating too many files and exceeding // Compact regularly to avoid creating too many files and exceeding
// the ulimit. // the ulimit.
if (flushesSinceCompact == maxFlushesSinceCompact) {
region.compact(false); region.compact(false);
flushesSinceCompact = 0; for (Store store : region.getStores()) {
store.closeAndArchiveCompactedFiles();
} }
} }
}); });