mirror of https://github.com/mongodb/mongo
SERVER-114882 increase sharding log level in merge_to_existing.js (#44819)
GitOrigin-RevId: ecab832430cd7582d91aa9e2401cc7bd1bcb8f5e
This commit is contained in:
parent
9eb9830b53
commit
0ff8470fb7
|
|
@ -2,9 +2,20 @@
|
|||
import {withEachMergeMode} from "jstests/aggregation/extras/merge_helpers.js";
|
||||
import {assertErrorCode} from "jstests/aggregation/extras/utils.js";
|
||||
import {ShardingTest} from "jstests/libs/shardingtest.js";
|
||||
import {setLogVerbosity} from "jstests/replsets/rslib.js";
|
||||
|
||||
const st = new ShardingTest({shards: 2, rs: {nodes: 1}});
|
||||
|
||||
// Get original log verbosities so we can reset them later.
|
||||
const nodes = [st.s0, st.rs0.getPrimary(), st.rs1.getPrimary()];
|
||||
let originalVerbosities = [];
|
||||
for (const node of nodes) {
|
||||
let originalVerbosity = assert.commandWorked(
|
||||
node.adminCommand({getParameter: 1, logComponentVerbosity: 1}),
|
||||
).logComponentVerbosity;
|
||||
originalVerbosities.push({"node": node, "verbosity": originalVerbosity});
|
||||
}
|
||||
|
||||
const mongosDB = st.s0.getDB("source_db");
|
||||
const sourceColl = mongosDB["source_coll"];
|
||||
const outputCollSameDb = mongosDB[jsTestName() + "_merge"];
|
||||
|
|
@ -127,11 +138,14 @@ function testMerge(sourceColl, targetColl, shardedSource, shardedTarget) {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Bump up the log component verbosity for sharding on each node to diagnose in case of failure (BF-40553).
|
||||
setLogVerbosity(nodes, {"sharding": {"verbosity": 5}});
|
||||
|
||||
//
|
||||
// Tests for $merge where the output collection is in the same database as the source
|
||||
// collection.
|
||||
//
|
||||
|
||||
// Test with unsharded source and sharded target collection.
|
||||
testMerge(sourceColl, outputCollSameDb, false, true);
|
||||
|
||||
|
|
@ -161,5 +175,11 @@ testMerge(sourceColl, outputCollDiffDb, false, true);
|
|||
|
||||
// Test with sharded source and unsharded target collection.
|
||||
testMerge(sourceColl, outputCollDiffDb, true, false);
|
||||
} finally {
|
||||
// Reset the log verbosities to the original values on all nodes.
|
||||
for (const nodeVerbosityInfo of originalVerbosities) {
|
||||
setLogVerbosity([nodeVerbosityInfo["node"]], nodeVerbosityInfo["verbosity"]);
|
||||
}
|
||||
|
||||
st.stop();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue