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

mongorestore with archive does not fail on bad CRC with --dryRun

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 100.11.0
    • Component/s: mongorestore
    • None
    • Tools and Replicator
    • 22

      Problem Statement/Rationale

      A corrupted(but valid) archive that fails a mongorestore with a CRC  mismatch  passes a `–dryRun` without CRC mismatch.

      Steps to Reproduce

      Hexedit an archive format dump such that the documents remain valid, change a character.

      14:24 $ diff -u <(xxd sampledata.archive) <(xxd sampledata.archive.b0rk )
      --- /dev/fd/63    2025-02-26 14:25:22.672492325 -0500
      +++ /dev/fd/62    2025-02-26 14:25:22.672492325 -0500
      @@ -24419381,7 +24419381,7 @@
       1749c340: 656c 6c2e 204c 6174 6520 6368 6563 6b6f  ell. Late checko
       1749c350: 7574 2077 6173 2061 2076 6572 7920 7661  ut was a very va
       1749c360: 6c75 6162 6c65 206f 7074 696f 6e20 616e  luable option an
      -1749c370: 6420 6865 6c70 6564 2067 7265 6174 6c79  d helped greatly
      +1749c370: 6420 6865 6c70 6564 2067 7265 6174 6c78  d helped greatlx
       1749c380: 2e00 0000 00ff ffff ff51 0000 0002 6462  .........Q....db
       1749c390: 000e 0000 0073 616d 706c 655f 6169 7262  .....sample_airb
       1749c3a0: 6e62 0002 636f 6c6c 6563 7469 6f6e 0013  nb..collection..
      

      Dry run a restore using the archive

       

      mongorestore --archive=sampledata.archive.b0rk --dryRun
      2025-02-26T14:26:48.397-0500    preparing collections to restore from
      2025-02-26T14:26:48.397-0500    dry run completed
      2025-02-26T14:26:48.397-0500    0 document(s) restored successfully. 0 document(s) failed to restore.
      

      Restore the archive

       

       

      14:27 $ mongorestore --archive=sampledata.archive.b0rk --drop
      2025-02-26T14:27:33.806-0500    preparing collections to restore from
      2025-02-26T14:27:33.815-0500    reading metadata for sample_training.inspections from archive 'sampledata.archive.b0rk'
      2025-02-26T14:27:33.815-0500    reading metadata for sample_mflix.sessions from archive 'sampledata.archive.b0rk'
      ... 
      ...
      ...
      2025-02-26T14:27:51.053-0500    Failed: corruption found in archive; ParserConsumer.HeaderBSON() ( CRC mismatch for namespace sample_airbnb.listingsAndReviews, 4644580959311783026!=2445464051694699444 )
      2025-02-26T14:27:51.053-0500    425367 document(s) restored successfully. 0 document(s) failed to restore.
      

       

       

      Expected Results

      The `–dryRun` should also CRC mismatch

      Actual Results

      `–dryRun` completes without error

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            jason.flax@mongodb.com Jason Flax
            Reporter:
            chris@thedellaways.com Christopher Dellaway
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: