Repository navigation
Conversation
…sting peers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open findings
The new overload introduces a boolean parameter that changes semantic behavior, which can be… · New The production change compares not onlygetAddress()but alsogetAdminAddress(),… · New This test hard-casts the storage toRaftStorageImpl, which tightly couples the test to a specific… · New Passing a literal boolean here makes the intent easy to miss and creates a 'boolean trap'. Consider… · New
What changed in this PR
Fixes setConfiguration so that changes to peer addresses (with the same peer IDs/priorities) are not incorrectly treated as “no change”, allowing updated addresses to be committed to the Raft log and persisted to raft-meta.conf.
Changes:
- Add an address-aware
hasNoChange(...)overload inRaftConfigurationImpland use it fromRaftServerImpl.setConfigurationAsync. - Update the “no change” reconfiguration test to send the actual configured peers rather than bind addresses.
- Add a new test that verifies address-only updates are committed and persist across restart.
| File | Description |
|---|---|
| ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java | Makes setConfigurationAsync treat peer-address differences as a real config change. |
| ratis-server/src/main/java/org/apache/ratis/server/impl/RaftConfigurationImpl.java | Adds optional address comparison to “no change” detection logic. |
| ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java | Adds coverage for address-only config updates and adjusts existing “no change” test input. |
🧠 Review effort: Lite
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
@smengcl , Updating address in runtime is tricky in general. When the peers do not have the correct addresses at startup, how are they supposed to talk to each others? |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@szetszwo Thanks for taking a look. The use case is the Ozone IPv6 work (HDDS-15763, design in apache/ozone#10981), which I should have mentioned earlier. An existing SCM or OM HA group may have IPv4 literal peer addresses stored in the Raft log and
Step 2 does not work today. The request returns success but nothing is written, so the IPv4 addresses stay in the stored configuration. On your question, the peers always have working addresses at startup in this procedure, because the old addresses stay reachable until the new ones are committed and the peers have been restarted. This patch is not meant to repair a group whose peers cannot reach each other. Without a leader the request cannot be committed, and the offline The patch also does not change the connections of running servers. |
If restarting is needed, could we just use raftMetaConf command (RaftMetaConfCommand)? Using setConf may have some unnecessary complication since there are two addresses for the same peer at the same time. I am not sure if the code can handle them correctly. |
@szetszwo Thanks, that is a fair concern, and I agree that changing addresses at runtime is tricky. To be clear about the scope: this patch only changes what is recorded. It does not change which addresses running servers connect to. What it does: Today a What it does not do: With gRPC, running servers keep their connections. Two addresses for the same peer: I believe this can already happen on master. A request that changes membership or priority and also has a different address for an existing peer already creates a joint configuration with both addresses, since the new configuration is built from the peers in the request. So the patch should not add a new state. It only stops skipping the case where nothing else changed. I agree If it helps, I am happy to add tests for both behaviours: running servers keep working with the new addresses recorded, and servers restarted from storage use them. And if you still think the offline approach is the safer choice, I am fine with closing this and using |


Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
A
setConfigurationrequest with the same peer IDs and priorities but different addresses is treated as "no change", so the addresses stored in the Raft log andraft-meta.confcan never be updated.RaftConfigurationImpl.hasNoChangecompares only IDs and priorities. This patch adds an overload that also compares peer addresses and uses it insetConfigurationAsync.RaftPeer.equalsis not changed.Running servers keep their existing connections. The new addresses are used after a restart.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2082
How was this patch tested?
Added
RaftReconfigurationBaseTest.testAddressChangeRequest.testNoChangeRequestnow sends the peers of the current configuration, sincecluster.getPeers()returns bind addresses that differ from the configured ones.🤖 Generated with Claude Code