[ 
https://issues.apache.org/jira/browse/RATIS-2754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Siyao Meng updated RATIS-2754:
------------------------------
    Description: 
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, 
following 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.
# Apply the log up to the commit index recovered from the log metadata 
({{raft.server.log.log-metadata.enabled}}, default true). Only these entries 
are known to be committed at startup.
# Write the last applied conf to raft-meta.conf at the same 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. Conf entries beyond the commit index get the new 
addresses in memory only.
# 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.

  was:
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 addresses (address, admin, client and data stream) of the startup peers 
replace the addresses of the peers with the same ids in every configuration set 
on the server: the persisted conf, the confs replayed from the log, the confs 
received from the leader and the confs appended by itself as the leader. 
Membership, roles, priorities and log indices are unchanged.
* The replayed log entries must be covered, otherwise a conf entry beyond 
raft-meta.conf restores the old addresses.
* raft-meta.conf is not rewritten at startup. The new addresses are persisted 
when a leader started with this option appends its startup conf entry, so a 
rolling restart of all the servers converges.
* A startup peer not in the configuration is ignored with a warning. Membership 
changes still go through setConfiguration.
* setConfiguration is unaffected for membership, roles and priorities. For a 
startup peer, a server keeps the startup addresses even if a later 
configuration (e.g. from setConfiguration) carries different addresses, with a 
warning.

Changing peer addresses then becomes: update the startup peers, enable the 
option and do a rolling restart.


> 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
>            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, 
> following 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.
> # Apply the log up to the commit index recovered from the log metadata 
> ({{raft.server.log.log-metadata.enabled}}, default true). Only these entries 
> are known to be committed at startup.
> # Write the last applied conf to raft-meta.conf at the same 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. Conf entries beyond the commit index get the new 
> addresses in memory only.
> # 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)

Reply via email to