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

mongoexport default to slaveOk on a sharded cluster (but should not)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.0-rc1
    • Affects Version/s: None
    • Component/s: mongoexport
    • Labels:
    • Server Tools A (10/09/15), Server Tools B (11/02/15)

      From the help on mongoexport:

        -k [ --slaveOk ] arg (=1)             use secondaries for export if
                                              available, default true

      On a sharded cluster this can lead to tragedy:

      • It would be possible for the same document to appear twice (repeated _id) or even many times (orphans) which could break a subsequent import.
      • Some documents can be missing entirely, even ones that have been present for years and never modified (an in-progress migration can cause this).

      The default should not allow reading from secondaries. If we are concerned about a change in behavior without notice then make the -k parameter required when connected to a mongos (as opposed to optional).

      It is better to fail totally and noisily than to fail partially but silently.

            gabriel.russell@mongodb.com Gabriel Russell (Inactive)
            andrew.ryder@mongodb.com Andrew Ryder (Inactive)
            1 Vote for this issue
            4 Start watching this issue