-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
CurOp has an _opDescription field that contains the request BSON. This BSON is included in slow query logs, the profiler, and ScopedDebugInfo logs after a stack trace (via CommandDiagnosticPrinter).
For insert, update, and delete commands on mongos, this op description field does not include some parts of the request, like the sub-operations. The impact is that we are missing some helpful information in places like the slow query/ScopedDebugInfo log lines:
On mongod, after running command
{delete: "foo", deletes: [{q: {a: 5, b: 5}, limit: 1}]},
we see two log lines:
{... "msg":"Slow query","attr":{"type":"remove", ... "command":{"q": {"a":5,"b":5},"limit":1},"planSummary":"IXSCAN { a: 1 }", ...} {... "msg":"Slow query","attr":{"type":"command", ..."ns":"test.$cmd", ..."command":{"delete":"foo","lsid":{"id":{"$uuid":"54c32ee4-2886-462a-b979-f2d5a3f867d6"}},"$db":"test"},...
The first log line comes from the sub-operation of the delete command, since each sub-op gets its own CurOp. We also see a log line for the top-level delete command which notably does not contain the sub-operations in the "command" field.
On mongos, the same command only results in the second log line, which means the mongos logs never include the sub-operation text.