2021-01-27 14:29:58 -08:00
|
|
|
// Test that certain basic commands preserve write concern errors.
|
2021-05-19 20:10:31 +00:00
|
|
|
// @tags: [
|
|
|
|
|
// ]
|
2021-01-27 14:29:58 -08:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
load("jstests/sharding/libs/failpoint_helpers.js");
|
|
|
|
|
|
2021-07-01 13:58:31 +00:00
|
|
|
let st = new ShardingTest({shards: 2});
|
2021-01-27 14:29:58 -08:00
|
|
|
|
2021-02-02 19:43:32 -08:00
|
|
|
// Test drop collection
|
2021-01-27 14:29:58 -08:00
|
|
|
{
|
|
|
|
|
let db = st.s.getDB("test");
|
2021-02-02 19:43:32 -08:00
|
|
|
// _shardsvrDropCollectionParticipant required for PM-1965
|
2021-01-27 14:29:58 -08:00
|
|
|
failCommandsWithWriteConcernError(st.rs0, ["drop", "_shardsvrDropCollectionParticipant"]);
|
|
|
|
|
assert.commandWorked(db.collection.insert({"a": 1}));
|
|
|
|
|
assert.commandFailedWithCode(db.runCommand({drop: "collection"}), 12345);
|
2021-02-02 19:43:32 -08:00
|
|
|
turnOffFailCommand(st.rs0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test drop database
|
|
|
|
|
{
|
|
|
|
|
let db = st.s.getDB("test");
|
|
|
|
|
// _shardsvrDropDatabaseParticipant required for PM-1965
|
2021-07-27 10:46:44 +00:00
|
|
|
failCommandsWithWriteConcernError(st.rs1, ["dropDatabase", "_shardsvrDropDatabaseParticipant"]);
|
2021-02-02 19:43:32 -08:00
|
|
|
assert.commandWorked(db.collection.insert({"a": 1}));
|
2021-07-27 10:46:44 +00:00
|
|
|
st.ensurePrimaryShard("test", st.shard0.shardName);
|
2021-02-02 19:43:32 -08:00
|
|
|
assert.commandFailedWithCode(db.runCommand({"dropDatabase": 1}), 12345);
|
2021-07-27 10:46:44 +00:00
|
|
|
turnOffFailCommand(st.rs1);
|
2021-01-27 14:29:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
st.stop();
|
2021-07-01 13:58:31 +00:00
|
|
|
})();
|