From 4f93a472ca190e820e589c442b4e2d1f2c84fafa Mon Sep 17 00:00:00 2001 From: Jordi Serra Torrens Date: Wed, 11 Oct 2023 15:25:37 +0000 Subject: [PATCH] Repro SERVER-82085 --- jstests/sharding/repro-server-82085.js | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 jstests/sharding/repro-server-82085.js diff --git a/jstests/sharding/repro-server-82085.js b/jstests/sharding/repro-server-82085.js new file mode 100644 index 00000000000..d390dd4b050 --- /dev/null +++ b/jstests/sharding/repro-server-82085.js @@ -0,0 +1,50 @@ +/* + * Repro BF-30357. + */ + +import {configureFailPoint} from "jstests/libs/fail_point_util.js"; +import {funWithArgs} from "jstests/libs/parallel_shell_helpers.js"; + +const st = new ShardingTest({shards: 1}); + +const testDB = st.s.getDB('test'); +const inputColl = testDB['input']; +const outputColl = testDB['output']; +assert.commandWorked(inputColl.insert({x: 1, timeField: ISODate()})); + +let fp = + configureFailPoint(st.rs0.getPrimary(), 'blockBeforeInternalRenameAndBeforeTakingDDLLocks'); + +// Start $out +const awaitShell = startParallelShell(() => { + // TODO: This should fail with ErrorCodes.IllegalOperation (thrown by the rename due to the + // destination collection being sharded). It now fails with NamespaceExists which is throw later + // (after the rename) when $out attempts to create the timeseries view. + assert.throws(() => {db.getSiblingDB('test')['input'].aggregate([{ + $out: { + db: 'test', + coll: 'output', + timeseries: {timeField: 'timeField', metaField: 'metaField'} + } + }])}); +}, st.s.port); + +// Wait for it to hang on 'blockBeforeInternalRenameAndBeforeTakingDDLLocks failpoint. +fp.wait(); + +// Shard outNs. +st.s.adminCommand({shardCollection: 'test.output', key: {x: 1}}); + +// Unblock $out +fp.off(); + +awaitShell(); + +// Check that output collection still works. +assert.commandWorked(outputColl.insert({x: 1})); +assert.eq(1, outputColl.find({x: 1}).itcount()); + +// THere should be no buckets collection for 'output'. +assert.eq(0, testDB.getCollectionInfos({name: "test.system.buckets.output"})); + +st.stop(); -- 2.34.1