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

Delete duplicate documents before committing the _id index during initial sync

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: 4.1.8
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • Storage NYC 2019-02-25
    • 50

      During the collection cloning phase, the _id index build should not be committed before  duplicate documents are deleted here. This is because after the index is committed, it is possible to unindex a record with the same key, but a different RecordId.

      To make this work, the following straightforward changes will also need to be made:

      • call drainBackgroundWrites and checkConstraints before committing the index build. This is because the prior call to deleteDocument performs a side write that must be drained
      • update requiresGhostCommitTimestampForWrite to return false if the member is in the STARTUP2 state. This is because lastApplied is not available in at this phase of initial sync.
      • don't pass secDups for non-_id indexes here. This is an existing bug because it's possible for the x_1 index to have duplicates, which should be ignored. Unfortunately because the number of initial sync attempts defaulted to 10, this was not evident.
      • the initial syncing node must only have 1 attempt in this test. Pass the numInitialSyncAttempts=1 setParameter when adding the node here.

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: