Adding a flag to enable or disable Ack Compaction
Currently defaults to enabled for 5.14.0 and above
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-04-12 13:30:10 +00:00
parent e69c2cbad6
commit cbad8babe5
2 changed files with 38 additions and 1 deletions

View File

@ -669,6 +669,24 @@ public class KahaDBPersistenceAdapter extends LockableServiceSupport implements
this.letter.setCompactAcksIgnoresStoreGrowth(compactAcksIgnoresStoreGrowth);
}
/**
* Returns whether Ack compaction is enabled
*
* @return enableAckCompaction
*/
public boolean isEnableAckCompaction() {
return letter.isEnableAckCompaction();
}
/**
* Configure if the Ack compaction task should be enabled to run
*
* @param enableAckCompaction
*/
public void setEnableAckCompaction(boolean enableAckCompaction) {
letter.setEnableAckCompaction(enableAckCompaction);
}
public KahaDBStore getStore() {
return letter;
}

View File

@ -274,6 +274,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
private boolean enableIndexPageCaching = true;
ReentrantReadWriteLock checkpointLock = new ReentrantReadWriteLock();
private boolean enableAckCompaction = true;
private int compactAcksAfterNoGC = 10;
private boolean compactAcksIgnoresStoreGrowth = false;
private int checkPointCyclesWithNoGC;
@ -1817,7 +1818,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
if (ackMessageFileMapMod) {
checkpointUpdate(tx, false);
}
} else {
} else if (isEnableAckCompaction()) {
if (++checkPointCyclesWithNoGC >= getCompactAcksAfterNoGC()) {
// First check length of journal to make sure it makes sense to even try.
//
@ -3671,4 +3672,22 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
public void setCompactAcksIgnoresStoreGrowth(boolean compactAcksIgnoresStoreGrowth) {
this.compactAcksIgnoresStoreGrowth = compactAcksIgnoresStoreGrowth;
}
/**
* Returns whether Ack compaction is enabled
*
* @return enableAckCompaction
*/
public boolean isEnableAckCompaction() {
return enableAckCompaction;
}
/**
* Configure if the Ack compaction task should be enabled to run
*
* @param enableAckCompaction
*/
public void setEnableAckCompaction(boolean enableAckCompaction) {
this.enableAckCompaction = enableAckCompaction;
}
}