HBASE-12454 Setting didPerformCompaction early in HRegion#compact
This commit is contained in:
parent
f3a38dcf16
commit
16decdc19a
|
@ -1566,8 +1566,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
doRegionCompactionPrep();
|
doRegionCompactionPrep();
|
||||||
try {
|
try {
|
||||||
status.setStatus("Compacting store " + store);
|
status.setStatus("Compacting store " + store);
|
||||||
didPerformCompaction = true;
|
|
||||||
store.compact(compaction);
|
store.compact(compaction);
|
||||||
|
didPerformCompaction = true;
|
||||||
} catch (InterruptedIOException iioe) {
|
} catch (InterruptedIOException iioe) {
|
||||||
String msg = "compaction interrupted";
|
String msg = "compaction interrupted";
|
||||||
LOG.info(msg, iioe);
|
LOG.info(msg, iioe);
|
||||||
|
|
|
@ -1544,7 +1544,9 @@ public class HStore implements Store {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancelRequestedCompaction(CompactionContext compaction) {
|
public void cancelRequestedCompaction(CompactionContext compaction) {
|
||||||
finishCompactionRequest(compaction.getRequest());
|
if (compaction != null) {
|
||||||
|
finishCompactionRequest(compaction.getRequest());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishCompactionRequest(CompactionRequest cr) {
|
private void finishCompactionRequest(CompactionRequest cr) {
|
||||||
|
|
|
@ -160,6 +160,9 @@ public class TestCompaction {
|
||||||
}).when(spyR).doRegionCompactionPrep();
|
}).when(spyR).doRegionCompactionPrep();
|
||||||
|
|
||||||
// force a minor compaction, but not before requesting a stop
|
// force a minor compaction, but not before requesting a stop
|
||||||
|
|
||||||
|
// Accounting: Normally compaction requests go through HStore#requestCompaction
|
||||||
|
r.reportCompactionRequestStart(false);
|
||||||
spyR.compactStores();
|
spyR.compactStores();
|
||||||
|
|
||||||
// ensure that the compaction stopped, all old files are intact,
|
// ensure that the compaction stopped, all old files are intact,
|
||||||
|
|
Loading…
Reference in New Issue