Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1878

mongorestore & mongoimport should check isMaster() WAS: mongoimport reports 'imported n objects' when connected to secondary replica member - but has actually imported nothing

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.7.2
    • Affects Version/s: 1.7.0
    • Component/s: Replication
    • None
    • Environment:
      Ubuntu 10.04 x86_64 running Mongodb 1.7.0 built from src.
    • Linux

      mongoimport reports 'imported n objects' when connected to secondary replica member - but has actually imported nothing. This is misleading. It should produce an error.

      $ mongo --port 27018 test
      > db.isMaster()
      {
      "setName" : "rep0",
      "ismaster" : false,
      "secondary" : true,
      "hosts" : [
      "192.168.2.63:27018",
      "192.168.2.63:27017"
      ],
      "arbiters" : [
      "192.168.2.63:27019"
      ],
      "primary" : "192.168.2.63:27017",
      "ok" :
      }
      > bye

      1. cat /tmp/bug.dat
        0, "xxxxx"
        1, "xxxxx"
        2, "xxxxx"
        3, "xxxxx"
        4, "xxxxx"
        5, "xxxxx"
        6, "xxxxx"
        7, "xxxxx"
        8, "xxxxx"
        9, "xxxxx"

      $ mongoimport --port 27018 -f id,val -d test -c bug \
      --type csv --file /tmp/bug.dat
      connected to: 127.0.0.1:27018
      imported 10 objects

      $ mongo --port 27018 test
      > db.getMongo().setSlaveOk()
      > show collections
      (nothing)

            Assignee:
            kristina Kristina Chodorow (Inactive)
            Reporter:
            markir Mark Kirkwood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: