diff --git a/dledger/src/main/java/io/openmessaging/storage/dledger/DLedgerConfig.java b/dledger/src/main/java/io/openmessaging/storage/dledger/DLedgerConfig.java index 0bb539b6..006b99d9 100644 --- a/dledger/src/main/java/io/openmessaging/storage/dledger/DLedgerConfig.java +++ b/dledger/src/main/java/io/openmessaging/storage/dledger/DLedgerConfig.java @@ -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; @@ -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; + } } diff --git a/dledger/src/main/java/io/openmessaging/storage/dledger/store/file/DLedgerMmapFileStore.java b/dledger/src/main/java/io/openmessaging/storage/dledger/store/file/DLedgerMmapFileStore.java index c776d157..63830143 100644 --- a/dledger/src/main/java/io/openmessaging/storage/dledger/store/file/DLedgerMmapFileStore.java +++ b/dledger/src/main/java/io/openmessaging/storage/dledger/store/file/DLedgerMmapFileStore.java @@ -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);