chunxiaozheng opened a new pull request, #901: URL: https://github.com/apache/ratis/pull/901
## What changes were proposed in this pull request? By reading the code related to updating peers, I found that the currentConf in the ConfigurationManager class maintains the current peers information, and a TreeMap object maintains the historical peers information, the TreeMap object uses the log entry index as the key. Normally, if the index of the newly added Configuration is the largest, the currentConf will be set to the latest added configuration information. Therefore, as long as modify the raft-meta.conf, follow the above rules, set the appropriate index and the latest peering information, we can solve the problem raised in RATIS-1860. Through analysis, reading the index in old raft-meta.conf and add 1 as the new index is a suitable choice. If we directly use the index in the old raft-meta.conf, an exception will be throw during Preconditions.assertTrue(found.equals(conf)).If we directly set a larger value, such as Long.MAX_Value, an exception will be throw when switch leader. In this PR, a ratis-shell cmd has been added, which will read raft-meta.conf in the specified path, get the log entry index and construct a new index(old index + 1), then use the new index and the newly passed peers to construct a new raft-meta.conf file to support normal startup when moving log entries and checkpoints to other nodes. In addition, it is also supported to directly pass an new index, which can be used directly when generating a new raft-meta.conf file. However, this method requires observing the old index. If the input index is inappropriate, it may also cause the new node to not start properly. ## What is the link to the Apache JIRA (Please create an issue in ASF JIRA before opening a pull request, and you need to set the title of the pull request which starts with the corresponding JIRA issue number. (e.g. RATIS-XXXX. Fix a typo in YYY.) Please replace this section with the link to the Apache JIRA) ## How was this patch tested? (Please explain how this patch was tested. Ex: unit tests, manual tests) (If this patch involves UI changes, please attach a screen-shot; otherwise, remove this) -- 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]
