[ 
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, 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.

  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 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.


> 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)

Reply via email to