[SERVER-21315] Make sure to cleanup state transition on failed dist lock acquisitions on legacy config servers Created: 05/Nov/15  Updated: 25/Jan/17  Resolved: 06/Nov/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.2.0-rc2
Fix Version/s: 3.2.0-rc3

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding C (11/20/15)
Participants:
Linked BF Score: 0

 Description   

This is to avoid the race as described below:

1. Alice tries to get lock, generates a ts of TSa.
2. Alice got descheduled.
3. Bob tries to get lock, generates a ts of TSb. Note: TSb > TSa.
4. Bob successfully grabs the lock sets the state to 2 ("locked") for all 3 config server.
5. Bob is done and tries to unlock the lock.
6. Bob finished unlocking the first config server and set the state to 0 ("unlocked")
7. Alice comes back again, sees that lock state of first config server is 0, proceeds to attempt to acquire the lock by sending the update to set state to 1 ("transition to lock") to all 3 config server.
8. Alice finds out that the update did not apply successfully to all config server (this is because the update query only matches the first config, who has the state at 0).
9. Alice goes to the tournament round and compares the ts field of the lock document in all config servers.
10. Alice sees that TSb > TSa, so she backs out of the tournament round.
11. Bob proceeds on unlocking the locks in the 2 other config servers.
12. The final state of the lock document ends up with:

server1: state: 1, ts: TSa
server2: state: 0
server3: state: 0

Once it ends up with this state, this lock can never be taken back again, until Alice's process stops pinging.



 Comments   
Comment by Githook User [ 06/Nov/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-21315 Make sure to cleanup state transition on failed dist lock acquisitions on legacy config servers
Branch: master
https://github.com/mongodb/mongo/commit/c4d2fd393eec1141caf88b7d68d3b12a65ae40c1

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