[SERVER-38748] Background indexes created through applyOps should run on the command thread Created: 21/Dec/18  Updated: 29/Oct/23  Resolved: 16/Jan/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.6.9, 4.0.5, 4.1.6
Fix Version/s: 3.6.11, 4.0.7, 4.1.7

Type: Bug Priority: Major - P3
Reporter: James Wahlin 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
Problem/Incident
is caused by SERVER-37313 FTDC collection blocked during foregr... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6
Steps To Reproduce:

The following test reproduces this issue:

(function() {
    "use strict";
 
    const dbName = "applyOpsReplicatedCreateIndexCrash";
    const collName = "coll";
 
    const rst = new ReplSetTest({nodes: 2});
    rst.startSet();
    rst.initiate();
    const db = rst.getPrimary().getDB(dbName);
    const coll = db.getCollection(collName);
 
    db.coll.drop();
    db.coll.insert({});
    db.adminCommand({
        applyOps: [{
            op: 'c', ns: coll.getFullName(), o: {
                createIndexes: coll.getName(),
                v: 2,
                background: {a: 1},
                name: 'a_1_create_v2',
                unknown: 1
            }
        }]
    });
 
    rst.stopSet();
})();

Sprint: Storage NYC 2019-01-14, Storage NYC 2019-01-28
Participants:
Linked BF Score: 6
Story Points: 5

 Description   

Fatal Assertion 50769 on invalid replicated index build, created via applyOps



 Comments   
Comment by Githook User [ 18/Feb/19 ]

Author:

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

Message: SERVER-38748 Background indexes created through applyOps should run on the command thread

(cherry picked from commit 9c49d721526ac83ada34950841ceef5b0b48c3c5)
Branch: v3.6
https://github.com/mongodb/mongo/commit/281e5d5cf9742c74448f0c8600912c6f6ca8326d

Comment by Githook User [ 18/Feb/19 ]

Author:

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

Message: SERVER-38748 Background indexes created through applyOps should run on the command thread

(cherry picked from commit 9c49d721526ac83ada34950841ceef5b0b48c3c5)
Branch: v4.0
https://github.com/mongodb/mongo/commit/1f11c8beeb5ebdbc315085c1a72f0b81cd5522d5

Comment by Githook User [ 16/Jan/19 ]

Author:

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

Message: SERVER-38748 Background indexes created through applyOps should run on the command thread
Branch: master
https://github.com/mongodb/mongo/commit/9c49d721526ac83ada34950841ceef5b0b48c3c5

Comment by Louis Williams [ 15/Jan/19 ]

This is a regression introduced by SERVER-37313. Since we no longer acquire a Global X lock for applyOps, this TempRelease never fails, and background index builds through applyOps run in a background thread. It used to be the case that the TempRelease would fail and the builder would run on the command thread, but now that it runs in a unmanaged background thread, errors cannot be caught.

Comment by Louis Williams [ 11/Jan/19 ]

Background indexes built through applyOps on primaries should build in the foreground thread, not in the background, because errors cannot be caught. This will be fixed by SERVER-37270

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