[SERVER-31572] Update faulty invariant in TopologyCoordinatorImpl::completeTransitionToPrimary Created: 13/Oct/17 Updated: 30/Oct/23 Resolved: 24/Oct/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | 3.6.0-rc2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Spencer Brody (Inactive) | Assignee: | Spencer Brody (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Sprint: | Repl 2017-10-23, Repl 2017-11-13 | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 0 | ||||||||||||
| Description |
|
When exiting drain mode, we check that we are in the proper state to complete our transition to primary after taking the global X lock. After that check, we release the repl coord mutex, write our on election oplog entry, reacquire the repl coord mutex, then complete our transition to primary. In TopologyCoordinatorImpl::completeTransitionToPrimary, we invariant that we still are in in leaderElect mode or in a stepdown attempt. We can also, however, be the leader mode for an unconditional stepdown, as we might have heard of a higher term while we had the repl coord mutex unlocked. In this case the proper thing to do is complete our transition to primary (since we've already logged the transition to primary oplog entry), then immediately step down. |
| Comments |
| Comment by Githook User [ 24/Oct/17 ] |
|
Author: {'email': 'spencer@mongodb.com', 'name': 'Spencer T Brody', 'username': 'stbrody'}Message: |
| Comment by Spencer Brody (Inactive) [ 13/Oct/17 ] |
|
It might also be possible, and perhaps even desirable, to instead fail to complete the transition to primary. We'll have logged our first onTransitionToPrimary oplog entry without ever actually reporting isMaster:true, which is a little odd, but probably preferable to a brief window where we could take more writes that are only going to be immediately rolled back. |