fix: promote oldest-version replica instead of highest for document replication (#22520) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #22644
Open
waterWang wants to merge 1 commit into
Conversation
…eplication (opensearch-project#22520) Document replication primary failover promotes the highest-version active replica, which is incompatible with the node_version allocation decider. This change promotes the oldest-version replica instead, matching what segment replication already does. Fixes opensearch-project#22520
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Contributor
|
❌ Gradle check result for 615e8a1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #22520
Problem
During a rolling upgrade, when a primary shard fails over, document replication promotes the highest-version in-sync replica (
activeReplicaWithHighestVersion). This is in direct tension with thenode_versionallocation decider, which enforces that a replica can only be allocated to a node whose version is >= its primary's version.After failover:
node_versiondeciderUNASSIGNED(cluster YELLOW) during rolling upgrade, even across patch boundaries with no segment-format changeFix
Change document replication to promote the oldest-version in-sync replica, matching what segment replication already does (
activeReplicaWithOldestVersion). The original reason for promoting highest-version (sequence number compatibility from 2017, inherited from Elasticsearch) is no longer relevant — sequence numbers are universal in every supported version.Change
server/src/main/java/org/opensearch/cluster/routing/RoutingNodes.java:unassignPrimaryAndPromoteActiveReplicaIfExists(), replacedactiveReplicaWithHighestVersionwithactiveReplicaWithOldestVersionfor document replicationTesting
FailedShardsRoutingTestscovers theactiveReplicaWithHighestVersionpath — the test should be updated to verifyactiveReplicaWithOldestVersionfor document replication2.19.0 → 2.19.4), primary failover should not leave replicasUNASSIGNED