Make mongorestore warn when restoring archive from a different server version

XMLWordPrintableJSON

    • 2
    • Tools and Replicator
    • 0.25
    • Needed
    • Hide
      I’m not sure if we want to document this, honestly. But it might be useful to use this change to reinforce in the docs that cross-version dump/restore are unsupported.

      Note that this warning DOES NOT appear for the default (i.e., directory-based) backup format. Only --archive restorations will give this warning.
      Show
      I’m not sure if we want to document this, honestly. But it might be useful to use this change to reinforce in the docs that cross-version dump/restore are unsupported. Note that this warning DOES NOT appear for the default (i.e., directory-based) backup format. Only --archive restorations will give this warning.

      Summary

      The archive format includes a header that identifies the server version:

      type Header struct {
      	ConcurrentCollections int32  `bson:"concurrent_collections"`
      	FormatVersion         string `bson:"version"`
      	ServerVersion         string `bson:"server_version"`
      	ToolVersion           string `bson:"tool_version"`
      }
      

      mongorestore should, when restoring from the archive format, check this version and, if it differs from its own server version, warn appropriately about the lack of support and danger to data integrity.

      What about non-archive backups?

      The directory format, unfortunately, does not include details about the server version, so there’s no win to achieve there without a change to mongodump.

      How does this relate to TOOLS-3510?

      TOOLS-3510 envisions a stronger stance on data integrity, which requires more code changes and possibly a major version change.

      This ticket is a “quick win” that we can do in a few minutes. It won’t disrupt anyone’s workflow, but it’ll hopefully dissuade at least some users from “self-harm”.

            Assignee:
            Unassigned
            Reporter:
            Felipe Gasper
            James Zhang, Shyam Subramaniyam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: