[SERVER-48524] Acquire config.system.indexBuilds lock earlier and with collection lock Created: 01/Jun/20  Updated: 29/Oct/23  Resolved: 17/Jun/21

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: newgrad
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to SERVER-79176 Index build _completeExternalAbort sh... Closed
is related to SERVER-48062 Index build abort can race with stepdown Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2021-05-17, Execution Team 2021-06-14, Execution Team 2021-06-28
Participants:
Linked BF Score: 136

 Description   

We push down "config.system.indexBuilds" lock acquisition to a low-level helper. This means that in the index build abort critical section, if our operation has been interrupted, the lock acquisition to remove the index build entry can fail.

The current solution to prevent a crash is an UninterruptibleLockGuard, which is not ideal. Though we will not try to take an X lock, which could be problematic, we should just make the caller responsible for lock acquisition.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 17/Jun/21 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48524 indexbuildentryhelpers::removeIndexBuildEntry() requires callers to obtain collection lock on config.system.indexBuilds

This improves index build semantics for aborts in the context of stepdowns and interrupts.
Branch: master
https://github.com/mongodb/mongo/commit/df5735431344335eeb8197a8e073aa6967d40a12

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48524 indexbuildentryhelpers::removeIndexBuildEntry() uses DBHelpers::findById() instead of findOne()

This allows us to locate the index build in config.system.indexBuilds() using the id index directly instead
of going through the query planner, which is still subject to interrupts.
Branch: master
https://github.com/mongodb/mongo/commit/db7a7a0f167e97ac43415265f0f4bcec07dd2ca6

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48524 indexbuildentryhelpers::removeIndexBuildEntry() accepts CollectionPtr
Branch: SERVER-34632
https://github.com/mongodb/mongo/commit/4f929f5bcbd13f2dbd347b27c2b3ee0e8abfa417

Comment by Githook User [ 15/Jun/21 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48524 indexbuildentryhelpers::removeIndexBuildEntry() accepts CollectionPtr
Branch: master
https://github.com/mongodb/mongo/commit/4f929f5bcbd13f2dbd347b27c2b3ee0e8abfa417

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