[SERVER-47097] Add isPrimary to ReplSetMetadata and use it for sync source selection Created: 24/Mar/20  Updated: 29/Oct/23  Resolved: 30/Mar/20

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.4.0-rc0, 4.7.0

Type: New Feature Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
depends on SERVER-46120 Error if a batch doesn't have metadat... Closed
Related
related to SERVER-47125 Require ReplSetMetadata.isPrimary, re... Closed
is related to SERVER-44939 Allow data replication across config ... Closed
is related to SERVER-46667 Avoid invariant from invalid candidat... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4
Sprint: Repl 2020-04-06
Participants:

 Description   

Consider a secondary Node 0 syncing from a member, Node 1.

When Node 0 executes TopologyCoordinator::shouldChangeSyncSource, it checks whether Node 1 thinks the primary has changed. Node 0 uses unsafe logic for this purpose: it checks the OplogQueryMetadata.currentPrimaryIndex it received from Node 1, but Node 0 doesn't know if it has the same config as Node 1 or not, so it doesn't know what member currentPrimaryIndex refers to.

Fortunately, all that Node 0 needs to know when it executes TopologyCoordinator::shouldChangeSyncSource is whether Node 1 itself is the primary. Add an isPrimary field to ReplSetMetadata, and deprecate currentPrimaryIndex.

Before closing this ticket, open another ticket to remove OplogQueryMetadata.currentPrimaryIndex in the next release.

(Discovered during the SERVER-46667 investigation.)



 Comments   
Comment by Githook User [ 30/Mar/20 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: SERVER-47097 Use ReplSetMetadata.isPrimary to choose sync source

(cherry picked from commit d8acf3c44e41fd4423caf8a337264a6dac86b8c5)
Branch: v4.4
https://github.com/mongodb/mongo/commit/c62aa3073e223cc6ec6720aa5fc0c546741f54ce

Comment by Githook User [ 30/Mar/20 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: SERVER-47097 Add ReplSetMetadata.isPrimary

(cherry picked from commit 0ebbedb45382c922d4873c2689d67fd80a735e5c)
Branch: v4.4
https://github.com/mongodb/mongo/commit/669902f9254de6fc377f86febe9bdebdf05539a5

Comment by Githook User [ 30/Mar/20 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: SERVER-47097 Use ReplSetMetadata.isPrimary to choose sync source
Branch: master
https://github.com/mongodb/mongo/commit/d8acf3c44e41fd4423caf8a337264a6dac86b8c5

Comment by Githook User [ 27/Mar/20 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: SERVER-47097 Add ReplSetMetadata.isPrimary
Branch: master
https://github.com/mongodb/mongo/commit/0ebbedb45382c922d4873c2689d67fd80a735e5c

Generated at Thu Feb 08 05:13:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.