Dear,
i have a cluster which has one mongos and three shards:shard01,shard02,shard03, every shard has three replication members, that is:
shard01: one primary ,two secondary
shard02: one primary ,two secondary
shard03: one primary ,two secondary
mongos:port 32017
from mongos, i can see the default write concern:
w:majority, wtimeout:1000
i try to insert data using my script:
conn = new Mongo(“192.168.17.160:32017”)
db = conn.getDB(“testdb01”)
db.auth(“admin”,“admin”)
var i=1
while ( i<10001 ){
printjson(“begin insert”+i)
db.table03.insert({“id”:i,“name”:“name”+i})
i=i+1
var dt=new Date()
printjson(dt)
}
i have a test:
try to kill -9 shard01`s primary mongod pid, then my insert hang between 15:34:44 and 15:34:54.
from mongod output log , i can see mongodb try to vote a new primary in the 10 seconds.
and i know the hang insert is trying to insert data into shard01 while insert data into shard02/shard03 will be successful.
my question is :why my insert does not timeout with an error because wtimeout is 1000 milliseconds.