[SERVER-1878] mongorestore & mongoimport should check isMaster() WAS: mongoimport reports 'imported n objects' when connected to secondary replica member - but has actually imported nothing Created: 30/Sep/10  Updated: 12/Jul/16  Resolved: 08/Oct/10

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 1.7.0
Fix Version/s: 1.7.2

Type: Bug Priority: Minor - P4
Reporter: Mark Kirkwood Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 10.04 x86_64 running Mongodb 1.7.0 built from src.


Operating System: Linux
Participants:

 Description   

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)



 Comments   
Comment by auto [ 08/Oct/10 ]

Author:

{'login': 'kchodorow', 'name': 'Kristina Chodorow', 'email': 'kristina@10gen.com'}

Message: check imports are going to a master SERVER-1878
http://github.com/mongodb/mongo/commit/0bb165f589ce8b813df149f309e080e200497911

Generated at Thu Feb 08 02:58:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.