-
Notifications
You must be signed in to change notification settings - Fork 323
Closed
Description
The variable DLedgerMmapFileStore#isDiskFull
should be decorated with the volatile,
because it will be written by the thread CleanSpaceService
, and it will be read by other threads when append DLedgerEntry
, as shown below:
class CleanSpaceService extends ShutdownAbleThread {
double storeBaseRatio = DLedgerUtils.getDiskPartitionSpaceUsedPercent(dLedgerConfig.getStoreBaseDir());
double dataRatio = DLedgerUtils.getDiskPartitionSpaceUsedPercent(dLedgerConfig.getDataStorePath());
public CleanSpaceService(String name, Logger logger) {
super(name, logger);
}
@Override public void doWork() {
try {
storeBaseRatio = DLedgerUtils.getDiskPartitionSpaceUsedPercent(dLedgerConfig.getStoreBaseDir());
dataRatio = DLedgerUtils.getDiskPartitionSpaceUsedPercent(dLedgerConfig.getDataStorePath());
long hourOfMs = 3600L * 1000L;
long fileReservedTimeMs = dLedgerConfig.getFileReservedHours() * hourOfMs;
if (fileReservedTimeMs < hourOfMs) {
logger.warn("The fileReservedTimeMs={} is smaller than hourOfMs={}", fileReservedTimeMs, hourOfMs);
fileReservedTimeMs = hourOfMs;
}
//If the disk is full, should prevent more data to get in
DLedgerMmapFileStore.this.isDiskFull = isNeedForbiddenWrite();
// ....
}
}
}
Metadata
Metadata
Assignees
Labels
No labels