Files
mongo/jstests/sharding/chunk_migration_with_bulk_write.js
seanzimm 65b881d228 SERVER-52419 Enable feature flag for bulkWrite (#18965)
GitOrigin-RevId: fbb748674d551c1d1745955f081445c1f28bfd51
2024-02-20 19:05:27 +00:00

44 lines
1.2 KiB
JavaScript

/**
* Ensure that chunk migration correctly handles the case of a retryable bulkWrite being run
* on multiple namespaces (one having been migrated and one not).
*
* @tags: [
* requires_fcv_80
* ]
*/
import {testMoveChunkWithSession} from "jstests/sharding/move_chunk_with_session_helper.js";
const st = new ShardingTest({
mongos: 1,
shards: 2,
rs: {nodes: 3},
mongosOptions: {setParameter: {featureFlagBulkWriteCommand: true}},
});
const dbName = "test";
const collName = "foo";
assert.commandWorked(
st.s.adminCommand({enableSharding: dbName, primaryShard: st.shard0.shardName}));
var cmd = {
bulkWrite: 1,
ops: [{insert: 0, document: {_id: 1, x: 100}}, {insert: 1, document: {_id: 0, x: 101}}],
nsInfo: [{ns: "test.foo"}, {ns: "test.coll"}],
txnNumber: NumberLong(0)
};
var checkRetryResult = function(result, retryResult) {
assert.eq(result.ok, retryResult.ok);
assert.docEq(result.cursor, retryResult.cursor);
assert.eq(result.numErrors, retryResult.numErrors);
};
var checkDocuments = function(coll) {
assert.eq(1, coll.findOne({x: 100})._id);
};
testMoveChunkWithSession(
st, collName, cmd, function(coll) {}, checkRetryResult, checkDocuments, true);
st.stop();