[SERVER-37065] Report ismaster:false in isMaster command response immediately upon learning of a new term Created: 10/Sep/18  Updated: 29/Oct/23  Resolved: 11/Dec/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.6.13, 4.1.7, 4.0.11

Type: Task Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-38659 Race condition in IsMasterIsFalseDuri... Closed
related to SERVER-39473 Should not report isMaster while step... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0, v3.6
Sprint: Repl 2018-12-17
Participants:
Linked BF Score: 18

 Description   

Currently when a primary hears of a new term, it schedules work to take the global X lock and step down. Actually preventing new writes from being accepted requires changing the value of ReplicationCoordinatorImpl::_canAcceptNonLocalWrites, which requires the global X lock, so there's no way to stop accepting new writes any faster than we do currently. Filling out the response to an isMaster command, however, only requires the repl coord mutex, so we could be reporting ismaster:false as soon as we hear about a new term since at that point we know that we definitely are going to step down. This could stop new writes from being routed to us that are doomed to fail once the stepdown completes.



 Comments   
Comment by Githook User [ 31/May/19 ]

Author:

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

Message: SERVER-37065 Report ismaster:false on learning of new term

(cherry picked from commit 89a64bec9cfe221200b1a47615e8a2bf6018f874)
Branch: v3.6
https://github.com/mongodb/mongo/commit/c3009e2df624ad215697f86e6873f7bff4302e5b

Comment by Githook User [ 30/May/19 ]

Author:

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

Message: SERVER-37065 Report ismaster:false on learning of new term

(cherry picked from commit 89a64bec9cfe221200b1a47615e8a2bf6018f874)
Branch: v4.0
https://github.com/mongodb/mongo/commit/134e5a7120efba871c62e0f3cf511842ab859e3e

Comment by Githook User [ 12/Dec/18 ]

Author:

{'name': 'Siyuan Zhou', 'email': 'siyuan.zhou@mongodb.com', 'username': 'visualzhou'}

Message: SERVER-37065 Fix unit tests.
Branch: master
https://github.com/mongodb/mongo/commit/f4ed4e70a12f3f4960ab418dc3df585d8044b16f

Comment by Githook User [ 11/Dec/18 ]

Author:

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

Message: SERVER-37065 Report ismaster:false on learning of new term
Branch: master
https://github.com/mongodb/mongo/commit/89a64bec9cfe221200b1a47615e8a2bf6018f874

Comment by Spencer Brody (Inactive) [ 10/Sep/18 ]

Changing this would mean that if an old primary participated in the election of a new primary, it would be guaranteed to report ismaster:false as soon as it voted for the new primary.

Generated at Thu Feb 08 04:44:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.