lokeshj1703 commented on code in PR #667:
URL: https://github.com/apache/ratis/pull/667#discussion_r915645955


##########
ratis-server/src/main/java/org/apache/ratis/server/storage/RaftStorageImpl.java:
##########
@@ -38,30 +37,35 @@ public class RaftStorageImpl implements RaftStorage {
 
   // TODO support multiple storage directories
   private final RaftStorageDirectoryImpl storageDir;
-  private final StorageState state;
+  private final StartupOption startupOption;
   private final CorruptionPolicy logCorruptionPolicy;
+  private volatile StorageState state = StorageState.UNINITIALIZED;
   private volatile RaftStorageMetadataFileImpl metaFile;
 
   RaftStorageImpl(File dir, CorruptionPolicy logCorruptionPolicy, 
StartupOption option,
-      long storageFeeSpaceMin) throws IOException {
+      long storageFeeSpaceMin) {
     this.storageDir = new RaftStorageDirectoryImpl(dir, storageFeeSpaceMin);
-    if (option == StartupOption.FORMAT) {
+    this.logCorruptionPolicy = 
Optional.ofNullable(logCorruptionPolicy).orElseGet(CorruptionPolicy::getDefault);
+    this.startupOption = option;
+  }
+
+  @Override
+  public void initialize() throws IOException {

Review Comment:
   We can probably introduce a try catch block here and unlock the storageDir 
in case of an exception.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to