mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-25 09:19:32 +01:00
SERVER-91203 AutoGetters should establish capped snapshots for secondary namespaces (#23157)
GitOrigin-RevId: 8426ffda43d081c4ee4b92a9fe3f43fa13fe77c7
This commit is contained in:
parent
259f1c2412
commit
a9b3e74fc6
22
jstests/noPassthrough/lookup_profile.js
Normal file
22
jstests/noPassthrough/lookup_profile.js
Normal file
@ -0,0 +1,22 @@
|
||||
// Tests that lookups on local capped collections acquire a snapshot on the capped collection
|
||||
// correctly. Tests the scenario fixed by SERVER-91203 no longer causes a crash.
|
||||
|
||||
let rst = new ReplSetTest({nodes: {n0: {profile: "0"}}});
|
||||
rst.startSet();
|
||||
rst.initiate();
|
||||
|
||||
const dbName = "test";
|
||||
const collName = "foo";
|
||||
|
||||
let testDB = rst.getPrimary().getDB(dbName);
|
||||
let testColl = testDB.getCollection(collName);
|
||||
|
||||
testColl.insert({a: 1});
|
||||
|
||||
testDB.setProfilingLevel(2);
|
||||
|
||||
const pipeline =
|
||||
[{$lookup: {from: 'system.profile', localField: 'key', foreignField: 'key', as: 'results'}}];
|
||||
testColl.aggregate(pipeline).toArray();
|
||||
|
||||
rst.stopSet();
|
@ -601,6 +601,11 @@ ConsistentCatalogAndSnapshot getConsistentCatalogAndSnapshot(
|
||||
// openCollection is eventually called to construct a Collection object from the durable
|
||||
// catalog.
|
||||
establishCappedSnapshotIfNeeded(opCtx, catalogBeforeSnapshot, nsOrUUID);
|
||||
if (resolvedSecondaryNamespaces) {
|
||||
for (const auto& secondaryNss : *resolvedSecondaryNamespaces) {
|
||||
establishCappedSnapshotIfNeeded(opCtx, catalogBeforeSnapshot, {secondaryNss});
|
||||
}
|
||||
}
|
||||
|
||||
shard_role_details::getRecoveryUnit(opCtx)->preallocateSnapshot();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user