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

mongorestore of oplog from archive hangs

    • Type: Icon: Investigation Investigation
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • 100.8.1
    • Affects Version/s: 4.2.15
    • Component/s: mongorestore
    • Labels:
      None
    • 772

      Problem Statement/Rationale

      What is going wrong? What action would you like the Engineering team to take?

      mongorestore of oplog from archive hangs without providing any indication of what is happening or what is wrong.

      Steps to Reproduce

      How could an engineer replicate the issue you're reporting?

      Create an archive from an oplog:

      mongodump --host <node_02_hostname> --port <port> --db local --collection oplog.rs --archive=oplog_dump.02.archive
      

      Now, try to restore into a different mongod instance.

      This just hangs:

      > mongorestore --archive=oplog_dump.02.archive --host=localhost --port=27017
      2021-11-07T15:46:38.556+0200	preparing collections to restore from
      

      Now with verbose – also hangs:

      > mongorestore --archive=oplog_dump.02.archive --host=localhost --port=27017 -v
      2021-11-07T15:52:00.901+0200	using write concern: &{majority false 0}
      2021-11-07T15:52:01.010+0200	archive prelude local.oplog.rs
      2021-11-07T15:52:01.012+0200	preparing collections to restore from
      2021-11-07T15:52:01.012+0200	found collection local.oplog.rs bson to restore to local.oplog.rs
      2021-11-07T15:52:01.012+0200	found collection metadata from local.oplog.rs to restore to local.oplog.rs
      

      After investigation, it seems that this was trying to create collection local.oplog.rs, which hung. (I tried this with restore target = single instance, and = replicaset.)

      Now with nsFrom+nsTo – now we get an error:

      > mongorestore --archive=oplog_dump.02.archive --host=localhost --port=27017 --nsFrom="local.oplog.rs" --nsTo "test.test"
      2021-11-07T15:52:40.355+0200	preparing collections to restore from
      2021-11-07T15:52:40.376+0200	reading metadata for test.test from archive 'oplog_dump.02.archive'
      2021-11-07T15:52:40.445+0200	finished restoring test.test (0 documents, 0 failures)
      2021-11-07T15:52:40.445+0200	Failed: test.test: error creating collection test.test: error running create command: (Location50001) autoIndexId:false is not allowed for collection test.test because it can be replicated
      2021-11-07T15:52:40.445+0200	0 document(s) restored successfully. 0 document(s) failed to restore.
      

      It looks like this was always trying to create the new collection with autoIndexId:false – which is not allowed for a collection that can be replicated – because the dumped collection was the oplog.

      Pre-creating the collection (without autoIndexId:false) solved this.

      Expected Results

      What do you expect to happen?

      Instead of hanging, this should have failed with a meaningful error message.

      Actual Results

      What do you observe is happening?

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Unassigned Unassigned
            Reporter:
            eric.sommer@mongodb.com Eric Sommer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: