[SERVER-41036] Make ReadWriteAbility::_canAcceptNonLocalWrites AtomicWord<bool> to prevent torn reads. Created: 07/May/19  Updated: 29/Oct/23  Resolved: 09/May/19

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.4.22, 3.6.14, 4.1.12, 4.0.11

Type: Task Priority: Major - P3
Reporter: Suganthi Mani Assignee: Vesselina Ratcheva (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-40700 Deadlock between read prepare conflic... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0, v3.6, v3.4
Sprint: Repl 2019-05-20
Participants:

 Description   

Currently, we are accessing _canAcceptNonLocalWrites in an unsafe manner by NOT taking any RSTL lock.  This can lead to torn read/ undefined behavior if concurrently a step up/step down thread is modifying the value.

And, they all are best effort checks. So, it's ok to just make reading _canAcceptNonLocalWrites thread safe.



 Comments   
Comment by Githook User [ 10/Jul/19 ]

Author:

{'name': 'Vesselina Ratcheva', 'username': 'vessy-mongodb', 'email': 'vesselina.ratcheva@10gen.com'}

Message: SERVER-41036 Make ReadWriteAbility::_canAcceptNonLocalWrites an AtomicWord<bool>

(cherry picked from commit 21746d3302f37a9d5716c2f249b99d7f0e273344)
Branch: v3.4
https://github.com/mongodb/mongo/commit/79d6588c61d60627e015cab590026dc08b0f1c50

Comment by Githook User [ 10/Jul/19 ]

Author:

{'name': 'Vesselina Ratcheva', 'email': 'vesselina.ratcheva@10gen.com', 'username': 'vessy-mongodb'}

Message: SERVER-41036 Make ReadWriteAbility::_canAcceptNonLocalWrites an AtomicWord<bool>

(cherry picked from commit 21746d3302f37a9d5716c2f249b99d7f0e273344)
Branch: v3.6
https://github.com/mongodb/mongo/commit/c3477b307f27c3a7be957c5475eeebdc51140c10

Comment by Githook User [ 10/Jul/19 ]

Author:

{'name': 'Vesselina Ratcheva', 'email': 'vesselina.ratcheva@10gen.com', 'username': 'vessy-mongodb'}

Message: SERVER-41036 Make ReadWriteAbility::_canAcceptNonLocalWrites an AtomicWord<bool>

(cherry-picked from commit 21746d3302f37a9d5716c2f249b99d7f0e273344)
Branch: v4.0
https://github.com/mongodb/mongo/commit/c91ee22877d56754df99563673bed49e59c6007c

Comment by Githook User [ 09/May/19 ]

Author:

{'name': 'Vesselina Ratcheva', 'username': 'vessy-mongodb', 'email': 'vesselina.ratcheva@10gen.com'}

Message: SERVER-41036 Make ReadWriteAbility::_canAcceptNonLocalWrites an AtomicWord<bool>
Branch: master
https://github.com/mongodb/mongo/commit/21746d3302f37a9d5716c2f249b99d7f0e273344

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