Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
2.4.0-rc1
-
None
-
ALL
Description
test:
var options = {
|
mongosOptions : {binVersion:MongoRunner.versionIterator(["2.4h","2.4h"]),
|
logpath:"/tmp/stest"},
|
configOptions:{binVersion:"2.4h", logpath:"/tmp/stest-config"},
|
shardOptions:{binVersion:"2.4h", logpath:"/tmp/sttest-shards"},
|
rsOptions:{binVersion:MongoRunner.versionIterator(["2.4h","2.4h"]), logpath:"/tmp/sttest-rs", nopreallocj:""},
|
separateConfig:true,
|
sync:true,
|
rs:true
|
}
|
|
|
var st = new ShardingTest({shards:2, mongos:2, other:options})
|
shards = st.s0.getDB("config").shards.find().toArray();
|
|
|
coll = st.s0.getDB("foo").bar
|
admin = st.s0.getDB("admin")
|
var confdb = st.s0.getDB("config")
|
coll.createIndex({_id:"hashed"})
|
printjson(admin.runCommand({ enableSharding : coll.getDB() + "" }));
|
printjson(admin.runCommand({ shardCollection : coll + "", key : { _id : "hashed" } }));
|
|
|
for(var i=1;i<1000;i++){
|
coll.insert({_id:i})
|
}
|
|
|
var m2 = MongoRunner.runMongos({binVersion:"2.2.0", configdb:st._configDB, port:MongoRunner.nextOpenPort()})
|
|
|
var x1 = st.s0.getDB("foo").bar.findOne({_id:3})
|
var x2 = m2.getDB("foo").bar.findOne({_id:3})
|
assert.eq(x1, x2)
|
in .explain().shards you can see that for the 2.2, the query is being routed to the wrong shard.
Attachments
Issue Links
- is documented by
-
DOCS-9022 mongos 2.2 can route to incorrect shard because it doesn't know about hashed shard keys
-
- Closed
-
- is duplicated by
-
SERVER-9776 Block migrations on hashed shardkeys where MongoD is not 2.4
-
- Closed
-