guihecheng commented on a change in pull request #477:
URL: https://github.com/apache/ratis/pull/477#discussion_r629193702
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java
##########
@@ -104,17 +104,24 @@
configurationManager = new ConfigurationManager(initialConf);
LOG.info("{}: {}", getMemberId(), configurationManager);
+ boolean storageFound = false;
List<File> directories = RaftServerConfigKeys.storageDir(prop);
while (!directories.isEmpty()) {
// use full uuid string to create a subdirectory
File dir = chooseStorageDir(directories,
group.getGroupId().getUuid().toString());
try {
storage = new RaftStorageImpl(dir,
RaftServerConfigKeys.Log.corruptionPolicy(prop));
+ storageFound = true;
break;
- } catch (AccessDeniedException e) {
- directories.remove(dir);
+ } catch (IOException e) {
+ directories.removeIf(d -> d.getAbsolutePath().equals(dir.getParent()));
Review comment:
@szetszwo here is the BUG, in the original code, `dir` represents the
newly created directory(name = UUID) for the group under the storageDir, not
the storageDir itself, so it loops forever indeed under my test.
So here I try to remove the exact storageDir, do you have a better way to
write this line in Java?
--
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]