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

Initial syncer oplog fetcher should skip first doc on retries

    • Fully Compatible
    • ALL
    • 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(
    • Repl 2019-03-25, Repl 2019-04-08, Repl 2019-04-22
    • 59

      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.

            Assignee:
            vesselina.ratcheva@mongodb.com Vesselina Ratcheva (Inactive)
            Reporter:
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: