[SERVER-8416] Make replica set state changes take a write lock Created: 30/Jan/13  Updated: 11/Jul/16  Resolved: 13/Feb/13

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 2.2.3
Fix Version/s: 2.2.4, 2.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Kristina Chodorow (Inactive) Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-8557 Audit replica set state transitions Closed
Operating System: ALL
Participants:

 Description   

tryToGoLiveAsASecondary needs to take a write lock. Otherwise, we could become primary between lines 562 and 590 of rs_sync.cpp and then immediately become a secondary, not closing connections if anyone is syncing from us (which they may have been simply doing already through chained replication).



 Comments   
Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-13T16:26:04Z', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: SERVER-8416 Lock around replica set state changes
Branch: v2.2
https://github.com/mongodb/mongo/commit/7ccd633c1c760b0149c6ca8edbd8fd7facb38023

Comment by Kristina Chodorow (Inactive) [ 13/Feb/13 ]

To be continued on SERVER-8557.

Comment by auto [ 13/Feb/13 ]

Author:

{u'date': u'2013-02-13T16:26:04Z', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: SERVER-8416 Lock around replica set state changes
Branch: master
https://github.com/mongodb/mongo/commit/0e3f43a12e5fcdab1f0942278088608ad9f36046

Comment by Kristina Chodorow (Inactive) [ 01/Feb/13 ]

Changing this from just "stepping down" to all state changes: anywhere where we check state and then change that, we could have another thread jump in and change the current state between the check and the change. Not sure if there are many of these places, but we should check the code for them.

Generated at Thu Feb 08 03:17:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.