Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #321] Make delete interval configuable #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public class DLedgerConfig {

private int metricsPromExporterPort = 5557;
private String metricsPromExporterHost = "";
private int deleteFilesInterval = 100;

public String getDefaultPath() {
return storeBaseDir + File.separator + "dledger-" + selfId;
Expand Down Expand Up @@ -635,4 +636,12 @@ public int getMetricsPromExporterPort() {
public String getMetricsPromExporterHost() {
return metricsPromExporterHost;
}

public int getDeleteFilesInterval() {
return deleteFilesInterval;
}

public void setDeleteFilesInterval(int deleteFilesInterval) {
this.deleteFilesInterval = deleteFilesInterval;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,9 @@ public void doWork() {
boolean forceClean = isNeedForceClean();
boolean enableForceClean = dLedgerConfig.isEnableDiskForceClean();
int intervalForcibly = 120 * 1000;
int deleteFilesInterval = dLedgerConfig.getDeleteFilesInterval();
if (timeUp || checkExpired) {
int count = getDataFileList().deleteExpiredFileByTime(fileReservedTimeMs, 100, intervalForcibly, forceClean && enableForceClean);
int count = getDataFileList().deleteExpiredFileByTime(fileReservedTimeMs, deleteFilesInterval, intervalForcibly, forceClean && enableForceClean);
if (count > 0 || (forceClean && enableForceClean) || isDiskFull) {
logger.info("Clean space count={} timeUp={} checkExpired={} forceClean={} enableForceClean={} diskFull={} storeBaseRatio={} dataRatio={}",
count, timeUp, checkExpired, forceClean, enableForceClean, isDiskFull, storeBaseRatio, dataRatio);
Expand Down