You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/07/14 11:10:12 UTC

[GitHub] [incubator-ratis] runzhiwang commented on a change in pull request #148: RATIS-924: rename raft group dir on disk when remove group is invoked

runzhiwang commented on a change in pull request #148:
URL: https://github.com/apache/incubator-ratis/pull/148#discussion_r454279636



##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -258,6 +262,44 @@ RaftGroup getGroup() {
     return RaftGroup.valueOf(getMemberId().getGroupId(), getRaftConf().getPeers());
   }
 
+  /**
+   * This removes the group from the server.
+   * If the flag is set to false, the directory is renamed to a random uuid
+   * along with {@value GROUP_REMOVE_DETAILS_FILE} which holds the information
+   * about its original group.
+   * If the flag is true, the group is permanently deleted.
+   * @param deleteDirectory
+   */
+  public void groupRemove(boolean deleteDirectory) {
+    final RaftStorageDirectory dir = state.getStorage().getStorageDir();
+
+    /* Do not delete the directory here irrespective of the flag.
+    Shutdown is triggered inorder to avoid any locked files. */
+    shutdown(false);
+
+    /* The group is renamed to a random uuid and a properties file is stored. */
+    if (!deleteDirectory) {

Review comment:
       I think we can create a directory to contain all removed groups, and the removed group in the directory should keep their name.




----------------------------------------------------------------
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:
users@infra.apache.org