Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2838

Disallow use of --oplogReplay without --drop

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • 101.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 1,322

      From TOOLS-2041:

      I think the use case of doing an --oplogReplay into a pre-existing collection is fairly dubious. The point of --oplogReplay is to provide a point-in-time restore. If there's pre-existing data, you cannot guarantee the state after the restore is consistent. You would have a mix of documents from different times. This is a problem even if there aren't any duplicate key errors.

      If we were to ignore duplicate key errors during oplog application and skip those ops, it would get even worse - it would be possible to have documents which aren't even internally consistent. Different fields will be from different times.

      So I think it's correct that duplicate key errors during --oplogReplay do cause mongomirror to fail. If you want to restore into a pre-existing collection, it's best not to use --oplogReplay. In fact, I think in a future major version update we should consider disallowing the use of --oplogReplay without --drop.

            Assignee:
            Unassigned Unassigned
            Reporter:
            tim.fogarty@mongodb.com Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: