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

Use readConcern afterClusterTime for initsync oplog queries

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.10, 3.5.13
    • Affects Version/s: None
    • Component/s: Replication, Storage
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v3.4
    • Hide
      (function() {
          'use strict';
      
          load('jstests/replsets/rslib.js');
          const basename = 'initial_sync_visibility';
      
          jsTestLog('Bring up set');
          const rst = new ReplSetTest({name: basename, nodes: 1});
          rst.startSet();
          rst.initiate();
      
          const primary = rst.getPrimary();
          const primaryDB = primary.getDB(basename);
      
          jsTestLog('Create a collection');
          assert.writeOK(primaryDB['coll'].save({_id: "visible"}));
          jsTestLog('Make sure synced');
          rst.awaitReplication();
      
          jsTestLog('Activate WT visibility failpoint and write an invisible document');
          assert.commandWorked(primaryDB.adminCommand(
              {configureFailPoint: 'WTPausePrimaryOplogDurabilityLoop', mode: 'alwaysOn'}));
          assert.writeOK(primaryDB['coll'].save({_id: "invisible"}));
      
          jsTestLog('Bring up a new node');
          const secondary = rst.add({setParameter: 'numInitialSyncAttempts=3'});
          rst.reInitiate();
          assert.eq(primary, rst.getPrimary(), 'Primary changed after reconfig');
      
          jsTestLog('Wait for new node to start cloning');
          secondary.setSlaveOk();
          const secondaryDB = secondary.getDB(basename);
          wait(function() {
              return secondaryDB.stats().collections >= 1;
          }, 'never saw new node starting to clone, was waiting for collections in: ' + basename);
      
          jsTestLog('Disable WT visibility failpoint on primary making all visible.');
          assert.commandWorked(primaryDB.adminCommand(
              {configureFailPoint: 'WTPausePrimaryOplogDurabilityLoop', mode: 'off'}));
      
          jsTestLog('Wait for both nodes to be up-to-date');
          rst.awaitSecondaryNodes();
          rst.awaitReplication();
      
          jsTestLog('Check all OK');
          rst.checkReplicatedDataHashes();
          rst.stopSet(15);
      })();
      
      Show
      (function() { 'use strict' ; load( 'jstests/replsets/rslib.js' ); const basename = 'initial_sync_visibility' ; jsTestLog( 'Bring up set' ); const rst = new ReplSetTest({name: basename, nodes: 1}); rst.startSet(); rst.initiate(); const primary = rst.getPrimary(); const primaryDB = primary.getDB(basename); jsTestLog( 'Create a collection' ); assert .writeOK(primaryDB[ 'coll' ].save({_id: "visible" })); jsTestLog( 'Make sure synced' ); rst.awaitReplication(); jsTestLog( 'Activate WT visibility failpoint and write an invisible document' ); assert .commandWorked(primaryDB.adminCommand( {configureFailPoint: 'WTPausePrimaryOplogDurabilityLoop' , mode: 'alwaysOn' })); assert .writeOK(primaryDB[ 'coll' ].save({_id: "invisible" })); jsTestLog( 'Bring up a new node' ); const secondary = rst.add({setParameter: 'numInitialSyncAttempts=3' }); rst.reInitiate(); assert .eq(primary, rst.getPrimary(), 'Primary changed after reconfig' ); jsTestLog( 'Wait for new node to start cloning' ); secondary.setSlaveOk(); const secondaryDB = secondary.getDB(basename); wait(function() { return secondaryDB.stats().collections >= 1; }, 'never saw new node starting to clone, was waiting for collections in: ' + basename); jsTestLog( 'Disable WT visibility failpoint on primary making all visible.' ); assert .commandWorked(primaryDB.adminCommand( {configureFailPoint: 'WTPausePrimaryOplogDurabilityLoop' , mode: 'off' })); jsTestLog( 'Wait for both nodes to be up-to-date' ); rst.awaitSecondaryNodes(); rst.awaitReplication(); jsTestLog( 'Check all OK' ); rst.checkReplicatedDataHashes(); rst.stopSet(15); })();
    • Storage 2017-09-11
    • 0

      This is needed to ensure visibility of the oplog entries that are queried.

            Assignee:
            geert.bosch@mongodb.com Geert Bosch
            Reporter:
            geert.bosch@mongodb.com Geert Bosch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: