Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-2103

mongoexport uses deprecated snapshot query option

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: mongoexport
    • Labels:
    • Case:

      Description

      The snapshot query option was deprecated in 3.6.1.

      Still, latest mongoexport 4.1.2 uses snapshot option by default, unless --forceTableScan is specified.

              
              // don't snapshot if we've been asked not to,
              // or if we cannot because  we are querying, sorting, or if the collection is a view
              if !exp.InputOpts.ForceTableScan && len(query) == 0 && exp.InputOpts != nil && exp.InputOpts.Sort == "" && !collInfo.IsView() && !collInfo.IsSystemCollection() {
                      flags = flags | db.Snapshot
              }
      

      This behavior makes MongoDB to log a warning message once per 128 events:

          if (query.getQueryRequest().isSnapshot()) {
              RARELY {
                  warning() << "The snapshot option is deprecated. See "
                               "http://dochub.mongodb.org/core/snapshot-deprecation";
              }
      

      Since the option is deprecated, mongoexport should use the the workarounds available:

      • For MMAPv1, use hint() on the { _id: 1}

        index instead to prevent a cursor from returning a document more than once if an intervening write operation results in a move of the document.

      • For other storage engines, use hint() with { $natural : 1 }

        instead.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                backlog-server-tools Backlog - Server Tools Team
                Reporter:
                miguel.nieto Miguel Angel Nieto
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: