[SERVER-60262] Fix logging of $group plan with verbose logging Created: 27/Sep/21  Updated: 27/Oct/23  Resolved: 17/Dec/21

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

Type: Task Priority: Major - P3
Reporter: Eric Cox (Inactive) Assignee: Anna Wawrzyniak
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: QE 2021-12-27
Participants:

 Description   

During implementation of $mergeObjects, we noticed that if the logging verbosity is turned up to 5 for the query logs only a partial plan is being logged.

db.sales.aggregate([{$group: {_id: "$item", mergedSales: {$mergeObjects: "$quantity"}}}])

Produces the plan in the logs,

[2] mkbson s5 s3 [item, quantity] keep [] true false
[1] scan s3 s4 none none none none [] @"948e756d-a2f5-4c5f-8ca0-4f2fb2b49c1e" true false



 Comments   
Comment by Kyle Suarez [ 17/Dec/21 ]

Per team discussion in Slack, this appears to have incidentally gone away as part of Eric's work in SERVER-61569.

Comment by Anna Wawrzyniak [ 17/Dec/21 ]

Issue no longer reproes:

 

./build/opt/install/bin/mongod --dbpath ~/dbpath --logpath ~/dbpath/mongod.log --vvvvv --fork
./build/opt/install/bin/mongo

 
MongoDB Enterprise > db.sales.insert({_id: 5, item: "foo", quantity: {a:5}})
WriteResult({ "nInserted" : 1 })
MongoDB Enterprise > db.sales.insert({_id: 6, item: "foo", quantity: {a:6}})
WriteResult({ "nInserted" : 1 })
MongoDB Enterprise > db.sales.aggregate([\{$group: {_id: "$item", mergedSales: {$mergeObjects: "$quantity"}}}])
{ "_id" : "foo", "mergedSales" :

{ "a" : 6 }

}

From dbpath/mongod.log
[2] mkbson s10 [_id = s7, mergedSales = s9] true false
[2] group [s7] [s9 = mergeObjects (s8)]
[2] filter {let [l1.0 = s8] ! exists (l1.0) || typeMatch (l1.0, 0x00000440) || isObject (l1.0) || fail ( 5911200 , only supports objects)}
[2] project [s8 = getField (s4, "quantity")]
[2] project [s7 = fillEmpty (s6, null)]
[2] project [s6 = getField (s4, "item")]
[1] scan s4 s5 none none none none [] @"f2f8ea7b-abfd-42cf-a78a-bdda76ebcc24" true false
The plan looks correct.

 

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