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

rollback (or replay during recovery) of emptycapped leads to invariant

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Replication
    • ALL
    • Hide
      (function() {
          'use strict';   
          load("jstests/replsets/libs/rollback_test.js");   
      
          const dbName = "emptycapped_rollback";
          const collName = "coll";
          const doc1 = {x: 1};
          const doc2 = {x: 2};
          const doc3 = {x: 3};  
      
          const rollbackTest = new RollbackTest();
          let primary = rollbackTest.getPrimary();
          let testDB = primary.getDB(dbName);
          primary.setLogLevel(2, "storage.recovery");    
      
          assert.commandWorked(testDB.createCollection(collName, {capped: true, size: 512 * 512, writeConcern: {w: "majority"}}));
          assert.commandWorked(testDB[collName].insert(doc1, {writeConcern: {w: "majority"}}));   
      
          // Restart the nodes so that they're not marked to always update sizes and so the first node is reelected.
          TestData.rollbackShutdowns = true;
          rollbackTest.restartNode(0, 15);
          rollbackTest.restartNode(1, 15);
          primary = rollbackTest.getPrimary();
          testDB = primary.getDB(dbName);    
      
          assert.commandWorked(primary.adminCommand({configureFailPoint: "disableSnapshotting", mode: "alwaysOn"}));
          assert.commandWorked(testDB.runCommand({emptycapped: collName}));
          assert.commandWorked(testDB[collName].insert(doc2));    
      
          rollbackTest.transitionToRollbackOperations();
          rollbackTest.transitionToSyncSourceOperationsBeforeRollback();
          rollbackTest.transitionToSyncSourceOperationsDuringRollback();
          rollbackTest.transitionToSteadyStateOperations();
          rollbackTest.stop();
      }()); 

       

      Show
      (function() { 'use strict'; load("jstests/replsets/libs/rollback_test.js"); const dbName = "emptycapped_rollback"; const collName = "coll"; const doc1 = {x: 1}; const doc2 = {x: 2}; const doc3 = {x: 3}; const rollbackTest = new RollbackTest(); let primary = rollbackTest.getPrimary(); let testDB = primary.getDB(dbName); primary.setLogLevel(2, "storage.recovery"); assert.commandWorked(testDB.createCollection(collName, {capped: true, size: 512 * 512, writeConcern: {w: "majority"}})); assert.commandWorked(testDB[collName].insert(doc1, {writeConcern: {w: "majority"}})); // Restart the nodes so that they're not marked to always update sizes and so the first node is reelected. TestData.rollbackShutdowns = true; rollbackTest.restartNode(0, 15); rollbackTest.restartNode(1, 15); primary = rollbackTest.getPrimary(); testDB = primary.getDB(dbName); assert.commandWorked(primary.adminCommand({configureFailPoint: "disableSnapshotting", mode: "alwaysOn"})); assert.commandWorked(testDB.runCommand({emptycapped: collName})); assert.commandWorked(testDB[collName].insert(doc2)); rollbackTest.transitionToRollbackOperations(); rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); rollbackTest.transitionToSyncSourceOperationsDuringRollback(); rollbackTest.transitionToSteadyStateOperations(); rollbackTest.stop(); }());  

      emptycapped is a test command, so this is low priority, and I do not think any other code can hit this. If an emptycapped command is replayed during replication recovery on a collection that wasn't marked for size adjustment, then it will invariant here.

       

      This is both a problem for replication recovery at startup and for recovery after rollback.

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: