Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-58744

applyOps on capped collections can violate the multi-timestamp constraint

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.3, 5.1.0-rc0
    • Affects Version/s: 5.0.1
    • Component/s: Storage
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v5.0
    • Hide
      /**
       * 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();
      }());
      
      
      Show
      /** * 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(); }());
    • Execution Team 2021-07-26

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

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: