szetszwo commented on a change in pull request #479:
URL: https://github.com/apache/ratis/pull/479#discussion_r643568848
##########
File path:
ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
##########
@@ -51,6 +51,16 @@ static void setStorageDir(RaftProperties properties,
List<File> storageDir) {
setFiles(properties::setFiles, STORAGE_DIR_KEY, storageDir);
}
+ String STORAGE_SPACE_RESERVED_KEY = PREFIX + ".storage.space.reserved";
Review comment:
Let's call it ".storage.space.min" or ".storage.space.required".
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageDirectoryImpl.java
##########
@@ -150,6 +152,13 @@ StorageState analyzeStorage(boolean toLock) throws
IOException {
this.lock(); // lock storage if it exists
}
+ // check enough space
+ if (!hasEnoughSpace()) {
+ LOG.warn("There are not enough space left for directory " + rootPath
+ + "required: " + spaceReserved + " left: " + root.getFreeSpace());
+ return StorageState.NON_EXISTENT;
Review comment:
Let's add a new NO_SPACE state. Otherwise, StartupOption.FORMAT won't
work.
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageDirectoryImpl.java
##########
@@ -150,6 +152,13 @@ StorageState analyzeStorage(boolean toLock) throws
IOException {
this.lock(); // lock storage if it exists
}
+ // check enough space
+ if (!hasEnoughSpace()) {
+ LOG.warn("There are not enough space left for directory " + rootPath
+ + "required: " + spaceReserved + " left: " + root.getFreeSpace());
Review comment:
Let's use "free space" and add some comma as below
`", required: " + spaceReserved + ", free space: " + root.getFreeSpace());`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]