SERVER-117126 Use backport required for subpipeline_system_variables.js and fix some typos (#46370)

GitOrigin-RevId: 77854772868a4e2546d5019505b08c855d162ce6
This commit is contained in:
Ivan Fefer 2026-01-15 12:26:30 +01:00 committed by MongoDB Bot
parent 455ef73a1f
commit ba18125f51
3 changed files with 16 additions and 11 deletions

View File

@ -113,6 +113,8 @@ last-continuous:
ticket: SERVER-115594
- test_file: jstests/sharding/updateOne_without_shard_key/bulk_write_without_shard_key_errors_only.js
ticket: SERVER-113344
- test_file: jstests/aggregation/variables/subpipeline_system_variables.js
ticket: SERVER-114384
suites: null
last-lts:
all:
@ -728,4 +730,6 @@ last-lts:
ticket: SERVER-115594
- test_file: jstests/sharding/updateOne_without_shard_key/bulk_write_without_shard_key_errors_only.js
ticket: SERVER-113344
- test_file: jstests/aggregation/variables/subpipeline_system_variables.js
ticket: SERVER-114384
suites: null

View File

@ -1,7 +1,6 @@
/**
* Tests that $$NOW and $$CLUSTER_TIME have the same value in subpipelines as in the parent pipeline.
* @tags: [
* requires_fcv_83,
* do_not_wrap_aggregations_in_facets,
* assumes_unsharded_collection,
* ]
@ -11,10 +10,11 @@ import {FixtureHelpers} from "jstests/libs/fixture_helpers.js";
import {Thread} from "jstests/libs/parallelTester.js";
db.dropDatabase();
db.test.insertOne({a: 1});
const coll = db[jsTestName()];
assert.commandWorked(coll.insertOne({a: 1}));
function testSystemTimeVariable(pipeline) {
const docs = db.test.aggregate(pipeline).toArray();
const docs = coll.aggregate(pipeline).toArray();
for (const doc of docs) {
const variableMainPipeline = doc["variableMainPipeline"];
const variableSubPipeline = doc["variableSubPipeline"];
@ -30,7 +30,7 @@ function generateTestPipelineLookup(variableName) {
return [
{
$lookup: {
from: "test",
from: jsTestName(),
pipeline: [{$project: {_id: 0, variableSubPipeline: `$$${variableName}`}}],
as: "out",
},
@ -50,7 +50,7 @@ function generateTestPipelineUnionWith(variableName) {
{$match: {a: 0}},
{
$unionWith: {
coll: "test",
coll: jsTestName(),
pipeline: [{$project: {_id: 0, variableSubPipeline: `$$${variableName}`}}],
},
},
@ -67,13 +67,13 @@ function generateTestMultipleSubPipelines(variableName) {
{$match: {a: 0}},
{
$unionWith: {
coll: "test",
coll: jsTestName(),
pipeline: [{$project: {_id: 0, variableMainPipeline: `$$${variableName}`}}],
},
},
{
$lookup: {
from: "test",
from: jsTestName(),
pipeline: [{$project: {_id: 0, variableSubPipeline: `$$${variableName}`}}],
as: "out",
},
@ -100,13 +100,14 @@ const isStandalone = FixtureHelpers.isStandalone(db);
// Run parallel shell to continuously tick cluster time.
const latch = new CountDownLatch(1);
const updateThread = new Thread((latch) => {
db.background_update.drop();
const background_update_coll = db[jsTestName() + "background_update"];
background_update_coll.drop();
let count = 0;
while (true) {
db.background_update.insertOne({_id: count});
background_update_coll.insertOne({_id: count});
count++;
for (let id = 0; id < count; ++id) {
db.background_update.updateOne({_id: id}, {$inc: {u: 1}});
background_update_coll.updateOne({_id: id}, {$inc: {u: 1}});
}
if (latch.getCount() === 0) {
break;

View File

@ -293,7 +293,7 @@ private:
absl::flat_hash_map<Id, ValueAndState> _definitions;
// Contains variables that should be constant throughout the whole query execution. We create
// copies of Varialbes object for sub-pipelines (e.g $lookup). std::shared_ptr allows us to keep
// copies of Variables object for sub-pipelines (e.g $lookup). std::shared_ptr allows us to keep
// these values the same across all copies.
std::shared_ptr<absl::flat_hash_map<Id, ValueAndState>> _queryConstantDefinitions;
};