In the function stopReplicationAndEnforceNewPrimaryToCatchUp() still has the problem listed in SERVER-59796.
We need to make sure that the secondaries are actually caught up (which may be impossible, since the primary's PrimaryOnlyService may write at any point meaning the secondaries won't be caught up), or we need to make the "candidate secondary", the secondary that is passed in to the function to be made the new primary, ahead of the other secondary so that it wins the election.
One way I can think of performing the latter idea is to stop replication on the other secondaries and not on the candidate secondary. We can then perform a write on the primary and make sure that it has reached the candidate secondary. This will ensure that the candidate secondary is more up-to-date than any other secondary, and then it can win the election.
- is related to
-
SERVER-59796 Wait for replication before stopping replication on secondaries in catchup.js
- Closed