[SERVER-36759] Overhaul currentOp output for createIndexes Created: 20/Aug/18  Updated: 06/Dec/22  Resolved: 27/Jun/19

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Dianna Hohensee (Inactive) Assignee: Backlog - Storage Execution Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-34830 currentOp of replicated createIndexes... Closed
duplicates SERVER-39085 move secondary oplog application logi... Closed
Related
related to SERVER-36015 Remove references to system.namespace... Closed
related to SERVER-39218 Simultaneous index builds improvement... Closed
is related to SERVER-39085 move secondary oplog application logi... Closed
is related to SERVER-39974 Move MultiIndexBlock::_updateCurOpOpD... Closed
Assigned Teams:
Storage Execution
Participants:

 Description   

The output for createIndexes used to look like this before removing MMAPv1:

 
    "inprog" : [
        {
            "host" : "delphi:28022",
            "desc" : "repl index builder 1",
            "active" : true,
            "currentOpTime" : "2018-08-20T08:31:38.210-0400",
            "opid" : 225,
            "secs_running" : NumberLong(0),
            "microsecs_running" : NumberLong(13816),
            "op" : "none",
            "ns" : "test.system.indexes",
            "command" : {
                "v" : 2,
                "key" : {
                "x" : 1
                },
                "name" : "x_1",
                "background" : true,
                "ns" : "test.index_bigkeys_downgrade_during_index_build"
            },
            "numYields" : 0,
            "locks" : {
                "Global" : "w",
                "Database" : "W"
            },
            "waitingForLock" : false,
            "lockStats" : {
                "Global" : {
                "acquireCount" : {
                "w" : NumberLong(1)
                }
                },
                "Database" : {
                "acquireCount" : {
                "W" : NumberLong(1)
                }
                }
            }
        }
    ],
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1534768298, 2),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    },
    "operationTime" : Timestamp(1534768298, 1)
}

It is basically only intelligible because of the ns field value of "<db>.system.indexes", and that's only to engineers, not users.
After SERVER-36015, it looks like this:

{
    "inprog" : [
        {
            "host" : "delphi:28022",
            "desc" : "repl index builder 1",
            "active" : true,
            "currentOpTime" : "2018-08-20T10:29:38.499-0400",
            "opid" : 223,
            "op" : "none",
            "ns" : "",
            "command" : {
                "v" : 2,
                "key" : {
                    "x" : 1
                },
                "name" : "x_1",
                "background" : true,
                "ns" : "test.index_bigkeys_downgrade_during_index_build"
            },
            "msg" : "Index Build (background) Index Build (background): 0/10 0%",
            "progress" : {
                "done" : 0,
                "total" : 10
            },
            "numYields" : 0,
            "locks" : {
                "Global" : "w",
                "Database" : "w",
                "Collection" : "w"
            },
            "waitingForLock" : false,
            "lockStats" : {
                "Global" : {
                    "acquireCount" : {
                        "w" : NumberLong(1)
                    }
                },
                "Database" : {
                    "acquireCount" : {
                        "w" : NumberLong(1),
                        "W" : NumberLong(1)
                    }
                },
                "Collection" : {
                    "acquireCount" : {
                        "w" : NumberLong(1)
                    }
                }
            }
        }
    ],
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1534775378, 2),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    },
    "operationTime" : Timestamp(1534775378, 1)
}

This entry should say "createIndexes" somewhere. The code starting point to investigate how currentOp puts this entry together – and thus where to put the code to improve it – is here: I tracked that code starting from here, but I didn't go any further.



 Comments   
Comment by Benety Goh [ 27/Jun/19 ]

We added "createIndexes" to currentOp output in SERVER-39085. Closing as duplicate.

Comment by Benety Goh [ 27/Jun/19 ]

The command name was added to the db.currentOp() output in this commit from SERVER-39085:

https://github.com/mongodb/mongo/commit/495e1b44df0e29cde8711d1d72bf8a0ccc2f8607

In SERVER-39974, we moved the currentOp logic from MultiIndexBlock to the IndexBuildsCoordinator.

Today, the currentOp output on a secondary looks like this:

{
        "type" : "op",
        "host" : "myhost.local:20021",
        "desc" : "IndexBuildsCoordinatorMongod-0",
        "active" : true,
",
        "opid" : 191,
        "secs_running" : NumberLong(0),
        "microsecs_running" : NumberLong(30012),
        "op" : "command",
        "ns" : "",
        "command" : {
                "createIndexes" : "test",
                "indexes" : [
                        {
                                "v" : 2,
                                "key" : {
                                        "a" : 1
                                },
                                "name" : "a_1",
                                "background" : true,
                                "ns" : "test.test"
                        }
                ]
        }, 
    ...
}

 

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