[SERVER-46989] Index builds should hold RSTL to prevent replication state changes after deciding to commit or abort Created: 19/Mar/20  Updated: 29/Oct/23  Resolved: 17/Apr/20

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.4.0-rc2, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Suganthi Mani Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-47605 Single-phase index builds should only... Closed
Duplicate
is duplicated by SERVER-44722 3 way deadlock can happen between hyb... Closed
is duplicated by SERVER-46704 Two phase index build can violate loc... Closed
is duplicated by SERVER-44045 allow secondary index builds to start... Closed
Related
related to SERVER-69677 Add warning to index build unexpected... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Execution Team 2020-04-20, Execution Team 2020-05-04
Participants:
Linked BF Score: 48

 Description   

IndexBuildsCoordinatorMongod::_waitForNextIndexBuildAction() holds RSTL only for the while loop scope to perform primary check. Because of that, the primary check is  no longer valid after this point. This can lead stepped down node(secondary) trying to commit or abort without getting commit/abortIndex oplog entry for 2 phase index builds. In turn, it results in this invariant failure.

 



 Comments   
Comment by Githook User [ 20/Apr/20 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-46989 Index builds should hold RSTL to prevent replication state changes after deciding to commit or abort.

This also elminates deadlocks caused by an index builder holding an RSTL
IX lock while waiting for a collection X lock or holding a collection X
lock and waiting for an RSTL IX lock.

(cherry picked from commit fca4421ffab68ae0b62c36a7505e6045428ce2e5)
Branch: v4.4
https://github.com/mongodb/mongo/commit/4d1d90ebd4809c252a103399a0d5a9db06c9317c

Comment by Githook User [ 17/Apr/20 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-46989 Index builds should hold RSTL to prevent replication state changes after deciding to commit or abort.

This also elminates deadlocks caused by an index builder holding an RSTL
IX lock while waiting for a collection X lock or holding a collection X
lock and waiting for an RSTL IX lock.
Branch: master
https://github.com/mongodb/mongo/commit/fca4421ffab68ae0b62c36a7505e6045428ce2e5

Comment by Louis Williams [ 15/Apr/20 ]

Code review: https://mongodbcr.appspot.com/584760001/

Comment by Suganthi Mani [ 19/Mar/20 ]

I feel, we should also address this SERVER-44045 and SERVER-44722 when tackling this problem.

Generated at Thu Feb 08 05:12:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.