-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.8.2
-
Component/s: Sharding
-
None
-
ALL
After running the moveprimary command via mongos, other mongos instances that communicate with the same mongod instances may not be aware of the move. In other words, they may still send updates to the old mongod after the move is complete.
Steps to reproduce:
Assume there are
- two mongod instances running on ports 27101 and 27102
- two mongos instances running on ports 27017 and 27018
- one config server instance running on port 27019
1) Open a mongo shell to each of the two mongos instances (db=test).
2) Call db.stats() on each shell.
3) On the first mongos, move the test database to the other shard.
4) Call db.stats() on each shell. Note that the second mongos returns the wrong primary.
SHELL 1:
...>mongo localhost:27017
MongoDB shell version: 1.8.2
connecting to: localhost:27017/test
> db.stats()
{
"raw" : {
"localhost:27101" :
},
"objects" : 0,
"avgObjSize" : NaN,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"ok" : 1
}
SHELL 2:
...>mongo localhost:27018
MongoDB shell version: 1.8.2
connecting to: localhost:27018/test
> db.stats()
{
"raw" : {
"localhost:27101" :
},
"objects" : 0,
"avgObjSize" : NaN,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"ok" : 1
}
SHELL 1:
> db.adminCommand(
)
{ "primary " : "shard0001:localhost:27102", "ok" : 1 }> db.stats()
{
"raw" : {
"localhost:27102" :
},
"objects" : 0,
"avgObjSize" : NaN,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"ok" : 1
}
> db.test.insert({_id:"bob", value: 1});
SHELL 2:
> db.stats()
{
"raw" : {
"localhost:27101" :
},
"objects" : 0,
"avgObjSize" : NaN,
"dataSize" : 0,
"storageSize" : 0,
"numExtents" : 0,
"indexes" : 0,
"indexSize" : 0,
"fileSize" : 0,
"ok" : 1
}
> db.test.insert({_id:"bob", value: 2});
Note that if you restart the second mongos at this point, the document {_id:"bob", value: 2} is lost forever, as it was persisted on the wrong mongod.
- duplicates
-
SERVER-3562 moveprimary moves all databases, including sharded collections
- Closed