SERVER-119613 Remove recordIdsReplicated: true from createCollection in the tests (#48013)
GitOrigin-RevId: 741b36a802b49ab6a39c63091b916246b8cec2d2
This commit is contained in:
committed by
MongoDB Bot
parent
ce84319de0
commit
d34291ee98
@@ -19,8 +19,7 @@ db[collName].drop();
|
||||
db[cappedCollName].drop();
|
||||
db[createdAsCappedCollName].drop();
|
||||
|
||||
jsTestLog("Creating collection with recordIdsReplicated:true...");
|
||||
assert.commandWorked(db.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(db.runCommand({create: collName}));
|
||||
assert.commandWorked(db[collName].createIndex({a: 1}));
|
||||
|
||||
jsTestLog("Cloning as capped should work with replicatedRecordIds and preserve the option.");
|
||||
@@ -42,9 +41,7 @@ indexes = db[collName].getIndexes();
|
||||
assert.eq(indexes.length, 1, indexes);
|
||||
|
||||
jsTestLog("Creating collection with capped:true and recordIdsReplicated:true should be allowed.");
|
||||
assert.commandWorked(
|
||||
db.runCommand({create: createdAsCappedCollName, capped: true, size: 2000, recordIdsReplicated: true}),
|
||||
);
|
||||
assert.commandWorked(db.runCommand({create: createdAsCappedCollName, capped: true, size: 2000}));
|
||||
collectionOptions = db[createdAsCappedCollName].exists();
|
||||
assert(collectionOptions.options.capped, collectionOptions);
|
||||
assert(collectionOptions.options.recordIdsReplicated, collectionOptions);
|
||||
|
||||
@@ -32,7 +32,7 @@ assert(
|
||||
|
||||
// Create a collection with the param set.
|
||||
jsTestLog("Creating collection " + coll.getFullName());
|
||||
assert.commandWorked(db.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(db.runCommand({create: collName}));
|
||||
jsTestLog("Created collection " + coll.getFullName());
|
||||
|
||||
// Check collections options in listCollections output.
|
||||
|
||||
@@ -87,7 +87,7 @@ export function testPreservingRecordIdsDuringInitialSync(initSyncMethod, beforeC
|
||||
|
||||
// Insert documents where some have a $recordId field within them. The recordId provided
|
||||
// here is just a field and is separate from the true recordId used when inserting.
|
||||
assert.commandWorked(primDB.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(primDB.runCommand({create: collName}));
|
||||
assert.commandWorked(
|
||||
primDB[collName].insertMany([
|
||||
{_id: 1, a: 1}, // recordId: 1
|
||||
@@ -129,7 +129,7 @@ export function testPreservingRecordIdsDuringInitialSync(initSyncMethod, beforeC
|
||||
// Case 2: Add a new node and while initial sync is ongoing, insert more documents on
|
||||
// to the primary after collection copying to test oplog application during initial sync.
|
||||
primDB[collName].drop();
|
||||
assert.commandWorked(primDB.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(primDB.runCommand({create: collName}));
|
||||
assert.commandWorked(primDB[collName].insertMany([{_id: 1}, {_id: 2}]));
|
||||
assert.commandWorked(primDB[collName].remove({_id: 2}));
|
||||
|
||||
@@ -179,7 +179,7 @@ export function testPreservingRecordIdsDuringInitialSync(initSyncMethod, beforeC
|
||||
// During collection copy, all the documents will have been copied over already. However
|
||||
// oplog application will try to re-insert them.
|
||||
primDB[collName].drop();
|
||||
assert.commandWorked(primDB.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(primDB.runCommand({create: collName}));
|
||||
assert.commandWorked(primDB[collName].insertMany([{_id: 1}, {_id: 2}]));
|
||||
assert.commandWorked(primDB[collName].remove({_id: 2}));
|
||||
|
||||
@@ -226,7 +226,7 @@ export function testPreservingRecordIdsDuringInitialSync(initSyncMethod, beforeC
|
||||
jsTestLog("Beginning case 4.");
|
||||
// Case 3: Add a new node that has to collection copy a few 16 MB documents.
|
||||
primDB[collName].drop();
|
||||
assert.commandWorked(primDB.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(primDB.runCommand({create: collName}));
|
||||
// Insert a few 16 MB documents.
|
||||
for (let i = 0; i < 5; i++) {
|
||||
assert.commandWorked(primDB[collName].insert({_id: -100 + i, a: "a".repeat(16 * 1024 * 1024 - 26)}));
|
||||
|
||||
@@ -467,7 +467,7 @@ const testCases = [
|
||||
// TODO (SERVER-68173): Enable featureFlagRecordIdsReplicated.
|
||||
shouldSkip: (conn) => !FeatureFlagUtil.isEnabled(conn, "RecordIdsReplicated"),
|
||||
createCollection: (conn, dbName, collName) => {
|
||||
assert.commandWorked(conn.getDB(dbName).runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(conn.getDB(dbName).runCommand({create: collName}));
|
||||
return dbName + "." + collName;
|
||||
},
|
||||
insertDocuments: (conn, dbName, collName) => {
|
||||
|
||||
@@ -120,7 +120,7 @@ function testRenameReplRidBehavior(srcDB, dstDB, dropTarget) {
|
||||
|
||||
function testRenameNoDropTarget(srcDB, dstDB) {
|
||||
makeSrcAndDstNames();
|
||||
const src = assertDropAndRecreateCollection(srcDB, srcCollName, {recordIdsReplicated: true});
|
||||
const src = assertDropAndRecreateCollection(srcDB, srcCollName, {});
|
||||
const dst = dstDB[dstCollName];
|
||||
assertDropCollection(dstDB, dstCollName);
|
||||
|
||||
@@ -130,7 +130,7 @@ function testRenameNoDropTarget(srcDB, dstDB) {
|
||||
|
||||
function testRenameDropTargetTrue(srcDB, dstDB, dstCollOptions) {
|
||||
makeSrcAndDstNames();
|
||||
const src = assertDropAndRecreateCollection(srcDB, srcCollName, {recordIdsReplicated: true});
|
||||
const src = assertDropAndRecreateCollection(srcDB, srcCollName, {});
|
||||
const dst = assertDropAndRecreateCollection(dstDB, dstCollName, dstCollOptions);
|
||||
assert.commandWorked(dst.insert([{_id: new Date(), name: "cool"}]));
|
||||
|
||||
@@ -140,7 +140,7 @@ function testRenameDropTargetTrue(srcDB, dstDB, dstCollOptions) {
|
||||
|
||||
function testRenameWithIndexesAndPostInsert(srcDB, dstDB) {
|
||||
makeSrcAndDstNames();
|
||||
const src = assertDropAndRecreateCollection(srcDB, srcCollName, {recordIdsReplicated: true});
|
||||
const src = assertDropAndRecreateCollection(srcDB, srcCollName, {});
|
||||
const dst = dstDB[dstCollName];
|
||||
assertDropCollection(dstDB, dstCollName);
|
||||
|
||||
@@ -157,8 +157,8 @@ function testRenameWithIndexesAndPostInsert(srcDB, dstDB) {
|
||||
testRenameNoDropTarget(dbA, dbA);
|
||||
testRenameNoDropTarget(dbA, dbB);
|
||||
|
||||
testRenameDropTargetTrue(dbA, dbA, {recordIdsReplicated: true});
|
||||
testRenameDropTargetTrue(dbA, dbB, {recordIdsReplicated: true});
|
||||
testRenameDropTargetTrue(dbA, dbA, {});
|
||||
testRenameDropTargetTrue(dbA, dbB, {});
|
||||
testRenameDropTargetTrue(dbA, dbA, {clusteredIndex: {key: {_id: 1}, unique: true}});
|
||||
testRenameDropTargetTrue(dbA, dbB, {clusteredIndex: {key: {_id: 1}, unique: true}});
|
||||
testRenameDropTargetTrue(dbA, dbA, {clusteredIndex: {key: {_id: 1}, unique: true}, expireAfterSeconds: 1});
|
||||
|
||||
@@ -26,7 +26,7 @@ const primDB = primary.getDB(dbName);
|
||||
|
||||
// Insert documents where some have a $recordId field within them. The recordId provided
|
||||
// here is just a field and is separate from the true recordId used when inserting.
|
||||
assert.commandWorked(primDB.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(primDB.runCommand({create: collName}));
|
||||
assert.commandWorked(
|
||||
primDB[collName].insertMany([
|
||||
{_id: 1, a: 1}, // recordId: 1
|
||||
|
||||
@@ -35,7 +35,7 @@ const primDB = primary.getDB(dbName);
|
||||
// secondary became the primary.
|
||||
const ops = [];
|
||||
ops.push({op: "i", ns: dbName + "." + collName, o: {_id: 1}, o2: {_id: 1}, rid: NumberLong(3)});
|
||||
assert.commandWorked(primDB.runCommand({create: collName, recordIdsReplicated: true}));
|
||||
assert.commandWorked(primDB.runCommand({create: collName}));
|
||||
assert.commandWorked(primDB.runCommand({applyOps: ops}));
|
||||
|
||||
// Now make the secondary step up.
|
||||
|
||||
@@ -54,7 +54,7 @@ const validateRidInOplogs = function (oplogQuery, expectedRid) {
|
||||
let docA = {"a": 1};
|
||||
|
||||
// Create a collection with the param set. The recordId should show up in the oplog.
|
||||
primDB.runCommand({create: replRidCollName, recordIdsReplicated: true});
|
||||
primDB.runCommand({create: replRidCollName});
|
||||
const docAInsertOpTime = assert.commandWorked(primDB.runCommand({insert: replRidCollName, documents: [docA]})).opTime;
|
||||
replSet.awaitReplication();
|
||||
const docAReplRid = getRidForDoc(primDB, replRidCollName, docA);
|
||||
|
||||
@@ -20,7 +20,7 @@ const collName = "replRecIdCollForCollMod";
|
||||
|
||||
// Create a collection with the param set.
|
||||
const testDB = primary.getDB("test");
|
||||
testDB.runCommand({create: collName, recordIdsReplicated: true});
|
||||
testDB.runCommand({create: collName});
|
||||
const coll = testDB.getCollection(collName);
|
||||
assert.commandWorked(coll.insert({_id: 1}));
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ const replRidCollName = "replRecIdColl";
|
||||
|
||||
let primDB = primary.getDB(dbName);
|
||||
|
||||
// Create a collection with the param `recordsIdsReplicated` param set.
|
||||
primDB.runCommand({create: replRidCollName, recordIdsReplicated: true});
|
||||
primDB.runCommand({create: replRidCollName});
|
||||
|
||||
jsTestLog("Blocking replication to secondary.");
|
||||
stopReplicationOnSecondaries(rst);
|
||||
|
||||
@@ -54,8 +54,7 @@ let primary = rst.getPrimary();
|
||||
let primDB = primary.getDB(dbName);
|
||||
const secondary = rst.getSecondary();
|
||||
|
||||
jsTestLog("Create collection with recordsIdsReplicated param set");
|
||||
primDB.runCommand({create: replRidCollName, recordIdsReplicated: true});
|
||||
primDB.runCommand({create: replRidCollName});
|
||||
|
||||
assert.commandWorked(primDB.runCommand({insert: replRidCollName, documents: [{"_id": 1}], writeConcern: {w: 2}}));
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ function runMoveChunkReplicaRecordIDsTest(collName, keyDoc, useBounds, splitChun
|
||||
const coll = testDB[collName];
|
||||
const ns = coll.getFullName();
|
||||
|
||||
assert.commandWorked(coll.getDB().createCollection(coll.getName(), {recordIdsReplicated: true}));
|
||||
assert.commandWorked(coll.getDB().createCollection(coll.getName()));
|
||||
const keyPattern = isHashed ? {_id: "hashed"} : keyDoc;
|
||||
assert.commandWorked(coll.createIndex(keyPattern));
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const testDB = mongos.getDB(dbName);
|
||||
const coll = testDB[collName];
|
||||
|
||||
assert.commandWorked(testDB.adminCommand({enableSharding: dbName, primaryShard: shard0.shardName}));
|
||||
assert.commandWorked(testDB.createCollection(collName, {recordIdsReplicated: true}));
|
||||
assert.commandWorked(testDB.createCollection(collName));
|
||||
|
||||
let collInfo = coll.exists();
|
||||
assert(collInfo.options.recordIdsReplicated, tojson(collInfo));
|
||||
|
||||
@@ -52,7 +52,7 @@ function runMoveRangeReplicaRecordIDsTest(collName, keyDoc) {
|
||||
const coll = testDB[collName];
|
||||
const ns = coll.getFullName();
|
||||
|
||||
assert.commandWorked(coll.getDB().createCollection(coll.getName(), {recordIdsReplicated: true}));
|
||||
assert.commandWorked(coll.getDB().createCollection(coll.getName()));
|
||||
const keyPattern = isHashed ? {_id: "hashed"} : keyDoc;
|
||||
assert.commandWorked(coll.createIndex(keyPattern));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user