Details
-
Improvement
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Operability
-
Low Hanging Fruit
-
All
-
None
-
Description
Looking into the code below :
private static DiskAccessMode resolveCommitLogWriteDiskAccessMode(DiskAccessMode providedDiskAccessMode) { boolean compressOrEncrypt = getCommitLogCompression() != null || (getEncryptionContext() != null && getEncryptionContext().isEnabled()); boolean directIOSupported = false; try { directIOSupported = FileUtils.getBlockSize(new File(getCommitLogLocation())) > 0; } catch (RuntimeException e) { logger.warn("Unable to determine block size for commit log directory: {}", e.getMessage()); } if (providedDiskAccessMode == DiskAccessMode.auto) { if (compressOrEncrypt) providedDiskAccessMode = DiskAccessMode.legacy; else { providedDiskAccessMode = directIOSupported && conf.disk_optimization_strategy == Config.DiskOptimizationStrategy.ssd ? DiskAccessMode.direct : DiskAccessMode.legacy; } } if (providedDiskAccessMode == DiskAccessMode.legacy) { providedDiskAccessMode = compressOrEncrypt ? DiskAccessMode.standard : DiskAccessMode.mmap; } return providedDiskAccessMode; }
We should throw exception when user set the DiskAccessMode to direct for commitlog but the directIOSupported return false after the judgement of "FileUtils.getBlockSize(new File(getCommitLogLocation())) > 0;" instead of waiting for the system to start and accepting reads and writes.