-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.9.0
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
ALL
-
Query 2021-01-11, Query 2021-01-25
scannedObjects in queryExecutor are incorrectly populated for $unionWith operation.
Current implementation only takes into account the local collection scanned objects and not the objects scanned by $unionWith.
Consider this scenario:
> db.firstCol.insert({field: 1})
> db.firstCol.insert({field: 2})
> db.secondCol.insert({field: 1})
> db.firstCol.aggregate([{ $unionWith: { coll: "secondCol"}}])
Output:
{ "_id" : ObjectId("5fe2f6ad334ad45eff855838"), "field" : 1 } { "_id" : ObjectId("5fe2f6b1334ad45eff855839"), "field" : 2 } { "_id" : ObjectId("5fe2f6cb334ad45eff85583a"), "field" : 1 }
queryExecutor stats
>db.serverStatus().metrics.queryExecutor { "scanned" : NumberLong(0), "scannedObjects" : NumberLong(2), "collectionScans" : { "nonTailable" : NumberLong(2), "total" : NumberLong(2) } }
We can see scannedObjects is coming out to be 2, but in reality it should be 3.
We need to fix this, as part of this ticket.
Refer to ticket for similar issue: SERVER-47640
- is related to
-
SERVER-53771 $facet should report its summary stats
- Closed
-
SERVER-47640 $lookup should increment the serverStatus metrics.queryExecutor counters
- Closed