|
I think we need to update the test for this case when sbe is pushed down. Firstly, the local collection has three documents in it and the foreign has 1 document,
assert.commandWorked(localColl.insert([{a: 1}, {b: 1}, {a: 2}]));
|
assert.commandWorked(foreignColl.insert({a: 1}));
|
Then a simple lookup query is issued on field 'a',
localColl.aggregate(
|
[{$lookup: {from: foreignColl.getName(), as: "res", localField: "a", foreignField: "a"}}]);
|
What I'm seeing is that the test is checking the "top" adminCommand to diff the number of commands issued against the foreignCollection. With featureFlagSBELookupPushdown off the top command result shows that three commands are issued against the foreign collection. One command per local document because of the recursive nature of DSLookup,
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] XOXO newTop foreign commands =
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] { "time" : 1416, "count" : 3 }
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] XOXOX oldTop foreign commands =
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] { "time" : 0, "count" : 0 }
|
[js_test:profile_lookup] [jsTest] ----
|
However we only see one command with sbe on because we only do 1 collscan on the foreign collection,
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] XOXO newTop foreign commands =
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] { "time" : 405, "count" : 1 }
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] XOXOX oldTop foreign commands =
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup]
|
[js_test:profile_lookup] [jsTest] ----
|
[js_test:profile_lookup] [jsTest] { "time" : 0, "count" : 0 }
|
[js_test:profile_lookup] [jsTest] ----
|
My proposal is to accept this as a passing case and change the assertion if we have sbe $lookup pushdown on.
|