Skip to content

Commit

Permalink
The variable DLedgerMmapFileStore#isDiskFull should be decorated with…
Browse files Browse the repository at this point in the history
… the volatile. (#104)

* [ISSUE #103] fix: The variable DLedgerMmapFileStore#isDiskFull should be decorated with the volatile

* fix: Avoid double counting elapsed time.
  • Loading branch information
XiaoyiPeng committed Feb 18, 2022
1 parent f958c2a commit 337ffaf
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class DLedgerMmapFileStore extends DLedgerStore {
private ThreadLocal<ByteBuffer> localIndexBuffer;
private FlushDataService flushDataService;
private CleanSpaceService cleanSpaceService;
private boolean isDiskFull = false;
private volatile boolean isDiskFull = false;

private long lastCheckPointTimeMs = System.currentTimeMillis();

Expand Down Expand Up @@ -632,8 +632,9 @@ public FlushDataService(String name, Logger logger) {
long start = System.currentTimeMillis();
DLedgerMmapFileStore.this.dataFileList.flush(0);
DLedgerMmapFileStore.this.indexFileList.flush(0);
if (DLedgerUtils.elapsed(start) > 500) {
logger.info("Flush data cost={} ms", DLedgerUtils.elapsed(start));
long elapsed;
if ((elapsed = DLedgerUtils.elapsed(start)) > 500) {
logger.info("Flush data cost={} ms", elapsed);
}

if (DLedgerUtils.elapsed(lastCheckPointTimeMs) > dLedgerConfig.getCheckPointInterval()) {
Expand Down

0 comments on commit 337ffaf

Please sign in to comment.