[SERVER-58744] applyOps on capped collections can violate the multi-timestamp constraint Created: 22/Jul/21  Updated: 29/Oct/23  Resolved: 23/Jul/21

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 5.0.1
Fix Version/s: 5.0.3, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Gregory Wlodarek Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Steps To Reproduce:

/**
 * Tests the applyOps command on a capped collection that needs capped deletes.
 *
 * @tags: [requires_capped, requires_replication]
 */
(function() {
"use strict";
 
const rst = new ReplSetTest({nodes: 3});
rst.startSet();
rst.initiate();
 
const dbName = "test";
const collName = "apply_ops_capped_collection";
 
const primary = rst.getPrimary();
const db = primary.getDB(dbName);
 
assert.commandWorked(db.runCommand({create: collName, capped: true, size: 1024 * 1024, max: 10}));
 
function nss(dbName, collName) {
    return `${dbName}.${collName}`;
}
 
let ops = [];
for (let i = 0; i < 20; i++) {
    ops.push({op: "i", ns: nss(dbName, collName), ts: Timestamp(i, 0), o: {_id: i}});
}
 
assert.commandWorked(db.runCommand({applyOps: ops}));
 
rst.stopSet();
}());

Sprint: Execution Team 2021-07-26
Participants:

 Description   

An applyOps command on a capped collection that needs capped deletes violates the multi-timestamp constraint today.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 09/Aug/21 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-58744 applyOps on capped collections can violate the multi-timestamp constraint

(cherry picked from commit 4b9d7175b46a802e180b575aecf3292434fff8f4)
Branch: v5.0
https://github.com/mongodb/mongo/commit/a2a49320659c312b5d6d157a5b7e52308f1f8eec

Comment by Githook User [ 22/Jul/21 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-58744 applyOps on capped collections can violate the multi-timestamp constraint
Branch: master
https://github.com/mongodb/mongo/commit/4b9d7175b46a802e180b575aecf3292434fff8f4

Comment by Bruce Lucas (Inactive) [ 22/Jul/21 ]

For searchability, one manifestation of this issue is the following assertion failure when using mongomirror:

{"t":{"$date":"2021-07-13T23:23:52.097+00:00"},"s":"F",  "c":"STORAGE",  "id":4877100, "ctx":"conn149","msg":"Multi timestamp constraint violated. Transactions setting multiple timestamps must set the first timestamp prior to any writes.","attr":{"numTimestampsUsed":2,"lastSetTimestamp":{"$timestamp":{"t":1626218632,"i":3}}}}
{"t":{"$date":"2021-07-13T23:23:52.097+00:00"},"s":"F",  "c":"-",        "id":23089,   "ctx":"conn149","msg":"Fatal assertion","attr":{"msgid":4877100,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp","line":405}}

 

Generated at Thu Feb 08 05:45:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.