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

Initial syncer oplog fetcher should skip first doc on retries

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Applying this small patch on 29d91ec77892f8b335bcc07ccf96e3240981ab05 reproduces the issue.

      diff --git a/jstests/replsets/initial_sync_rename_collection.js b/jstests/replsets/initial_sync_rename_collection.js
      index c428170..727ba4e 100644
      --- a/jstests/replsets/initial_sync_rename_collection.js
      +++ b/jstests/replsets/initial_sync_rename_collection.js
      @@ -71,6 +71,7 @@
               to: primary_db1[collAcrossFinal_name]
                       .getFullName()  // Collection 'renamed_across' is implicitly created.
           }));
      +    assert.commandWorked(primary.adminCommand({restartCatalog: 1}));
       
           // Disable fail point so that the secondary can finish its initial sync.
           assert.commandWorked(secondary.adminCommand(
      

      Show
      Applying this small patch on 29d91ec77892f8b335bcc07ccf96e3240981ab05 reproduces the issue. diff --git a/jstests/replsets/initial_sync_rename_collection.js b/jstests/replsets/initial_sync_rename_collection.js index c428170..727ba4e 100644 --- a/jstests/replsets/initial_sync_rename_collection.js +++ b/jstests/replsets/initial_sync_rename_collection.js @@ -71,6 +71,7 @@ to: primary_db1[collAcrossFinal_name] .getFullName() // Collection 'renamed_across' is implicitly created. })); + assert.commandWorked(primary.adminCommand({restartCatalog: 1})); // Disable fail point so that the secondary can finish its initial sync. assert.commandWorked(secondary.adminCommand(
    • Sprint:
      Repl 2019-03-25, Repl 2019-04-08, Repl 2019-04-22
    • Linked BF Score:
      59

      Description

      https://github.com/mongodb/mongo/commit/4f858c52b05ecc49d2ae19bbaf59fc0aad445b7e started enqueuing the first document the OplogFetcher returned instead of skipping it. When the OplogFetcher retries its oplog query, if it has enqueued any documents (so not if it's retrying the very first query before enqueuing anything successfully), then this will cause it to duplicate a document and hit an invariant.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              vesselina.ratcheva Vesselina Ratcheva
              Reporter:
              judah.schvimer Judah Schvimer
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: