[SERVER-55275] Index builder must check for interrupt between collection scan and bulk load phases Created: 17/Mar/21  Updated: 29/Oct/23  Resolved: 22/Apr/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.4.0, 4.9.0
Fix Version/s: 4.4.7, 5.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Louis Williams 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
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Execution Team 2021-05-03
Participants:
Linked BF Score: 18

 Description   

We frequently call checkForInterrupt() so that index builds can be quickly aborted. We do this on each iteration of collection scanning and bulk-loading sorted keys into the index.

If an index build is aborted between these two phases, this invariant will fail because the MultiIndexBlock has already been cleaned up by a different thead.

This scenario is normally protected by Collection X lock held by the operation aborting the index build, but the index builder will yield/restore while scanning.

I think this invariant can fail if an index build is aborted while it is yielding, and after it restores it hits the end of the collection and does not call checkForInterrupt(). We need to call checkForInterrupt() in dumpInsertsFromBulk before checking the _buildIsCleanedUp invariant.



 Comments   
Comment by Githook User [ 10/May/21 ]

Author:

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

Message: SERVER-55275 Index builder must check for interrupt between collection scan and bulk load phases

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

Comment by Githook User [ 21/Apr/21 ]

Author:

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

Message: SERVER-55275 Index builder must check for interrupt between collection scan and bulk load phases
Branch: master
https://github.com/mongodb/mongo/commit/4faefeace6228d16df918abd9c2c2d8a011f5066

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