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

Oplog application mode must be set to kRecovering when applying oplog entries after rollbackViaRefetch

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.5.1
    • Component/s: Replication
    • None
    • Replication
    • ALL
    • Hide
      // Run with resmoke parameters: --majorityReadConcern=off --suites=replica_sets
      (function() {
      'use strict';
      
      load("jstests/replsets/libs/rollback_test.js");
      
      let dbName = "rollback_constraint";
      let collName = "sourceColl";
      
      let doc1 = {_id: 0};
      
      let CommonOps = (node) => {
          // Insert an initial dummy document.
          assert.commandWorked(node.getDB(dbName)[collName].insert({}));
      };
      
      let RollbackOps = (node) => {
          // Let the doc be refetched
          assert.commandWorked(node.getDB(dbName)[collName].insert(doc1));
      };
      
      let SyncSourceOps = (node) => {
          // Insert same doc on different branch so it will be refetched and applied on rollback node.
          assert.commandWorked(node.getDB(dbName)[collName].insert(doc1));
      };
      
      // Set up Rollback Test.
      let rollbackTest = new RollbackTest();
      CommonOps(rollbackTest.getPrimary());
      
      let rollbackNode = rollbackTest.transitionToRollbackOperations();
      RollbackOps(rollbackNode);
      
      let syncSourceNode = rollbackTest.transitionToSyncSourceOperationsBeforeRollback();
      SyncSourceOps(syncSourceNode);
      
      // Wait for rollback to finish.
      rollbackTest.transitionToSyncSourceOperationsDuringRollback();
      rollbackTest.transitionToSteadyStateOperations();
      
      // Check the replica set.
      rollbackTest.stop();
      }());
      
      Show
      // Run with resmoke parameters: --majorityReadConcern=off --suites=replica_sets ( function () { 'use strict' ; load( "jstests/replsets/libs/rollback_test.js" ); let dbName = "rollback_constraint" ; let collName = "sourceColl" ; let doc1 = {_id: 0}; let CommonOps = (node) => { // Insert an initial dummy document. assert.commandWorked(node.getDB(dbName)[collName].insert({})); }; let RollbackOps = (node) => { // Let the doc be refetched assert.commandWorked(node.getDB(dbName)[collName].insert(doc1)); }; let SyncSourceOps = (node) => { // Insert same doc on different branch so it will be refetched and applied on rollback node. assert.commandWorked(node.getDB(dbName)[collName].insert(doc1)); }; // Set up Rollback Test. let rollbackTest = new RollbackTest(); CommonOps(rollbackTest.getPrimary()); let rollbackNode = rollbackTest.transitionToRollbackOperations(); RollbackOps(rollbackNode); let syncSourceNode = rollbackTest.transitionToSyncSourceOperationsBeforeRollback(); SyncSourceOps(syncSourceNode); // Wait for rollback to finish. rollbackTest.transitionToSyncSourceOperationsDuringRollback(); rollbackTest.transitionToSteadyStateOperations(); // Check the replica set. rollbackTest.stop(); }());
    • Repl 2024-06-10
    • 50

      When we come out of rollbackViaRefetch, we may remain in RECOVERING state until we have applied oplog entries up to our minValid optime. Our current state post rollback may not be consistent with the oplog, so we must relax constraints during oplog application. Currently, the OplogApplier used for oplog application in BackgroundSync always runs in application mode kSecondary. We need to make sure it uses mode kRecovering when applying ops during RECOVERING post rollback since now we enforce constraints whenever we are applying in mode kSecondary (SERVER-21700).

            Assignee:
            kishore.devireddy@mongodb.com Kishore Devireddy
            Reporter:
            william.schultz@mongodb.com William Schultz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: