[
https://issues.apache.org/jira/browse/RATIS-2754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128925#comment-18128925
]
Siyao Meng commented on RATIS-2754:
-----------------------------------
Thanks [~szetszwo] . I think step 2 (applying the log first) is not needed:
{{raft-meta.conf}} holds the last applied conf, so it can be rewritten at its
own index right away, before the RPC server starts.
The newer conf entries in the log are replayed at startup, so they already get
the new addresses in memory.
When they are applied later by the usual {{{}StateMachineUpdater{}}}, they are
written to {{raft-meta.conf}} with the new addresses too.
This avoids applying the log synchronously during startup. Until those entries
are applied, {{raft-meta.conf}} stays at the older index (with the new
addresses), which only matters if the option is disabled at the next restart.
I have updated the proposal in the Jira descrption. ptal thanks! I will go
ahead with the implementation when it sounds good.
> Add a startup option to refresh peer addresses in the Raft configuration
> ------------------------------------------------------------------------
>
> Key: RATIS-2754
> URL: https://issues.apache.org/jira/browse/RATIS-2754
> Project: Ratis
> Issue Type: Improvement
> Reporter: Siyao Meng
> Assignee: Siyao Meng
> Priority: Major
>
> Follow up of RATIS-2082. As discussed in
> [https://github.com/apache/ratis/pull/1630], setConfiguration only records an
> address only change without rebinding or reconnecting, so a startup option is
> preferred.
> h3. Problem
> Peer addresses are persisted in raft-meta.conf and in the configuration
> entries of the Raft log. When peer addresses change (e.g. migrating IPv4
> literal addresses to IPv6, or correcting a wrong address), the stale
> addresses are recovered on restart even if the server is started with the
> correct peers. The only fix today is the offline ratis-shell {{local
> raftMetaConf}} command, which drops listeners and priorities and requires
> replacing raft-meta.conf by hand on every server.
> Use case: Apache Ozone SCM HA migrating IPv4 literal Ratis peer addresses to
> IPv6 (HDDS-16136, under the Ozone IPv6 umbrella HDDS-15763). OM HA
> connections already follow its configured peers, but its stored peer
> addresses stay stale without this option.
> h3. Proposal
> Add a server config {{raft.server.startup.refresh-peer-addresses.enabled}}
> (default false). When it is enabled and a group is started with a non-empty
> list of peers, the server refreshes the stored peer addresses at startup,
> based on the sequence in [this
> comment|https://issues.apache.org/jira/browse/RATIS-2754?focusedCommentId=18127578&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-18127578]:
> # Start as usual, but do not take server or client requests yet. The RPC
> server starts only after the group is initialized.
> # Rewrite raft-meta.conf at its own index, with the addresses (address,
> admin, client and data stream) of the startup peers replacing those of the
> peers with the same ids. Membership, roles, listeners and priorities are
> kept. raft-meta.conf already holds the last applied conf, so no log entries
> need to be applied first.
> # Conf entries in the log get the new addresses in memory. When they are
> applied later, they are written to raft-meta.conf with the new addresses.
> # Start taking requests.
> Rolling restart: a peer that has not been restarted still has the old
> addresses. If it becomes the leader, its startup conf entry brings the old
> addresses back. So a restarted peer remembers the addresses it replaced at
> startup and replaces them again whenever a later conf carries them, both in
> memory and when writing raft-meta.conf. Other address changes (e.g. via
> setConfiguration) are kept. A rolling restart then converges in any order.
> A startup peer not in the configuration is ignored with a warning. Membership
> changes still go through setConfiguration.
> Changing peer addresses then becomes: update the startup peers, enable the
> option and do a rolling restart. Keep the option enabled until all the
> servers have been restarted with it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)