mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-33601 Make sharding_migrate_large_docs.js, bulk_insert.js, and prefix_shard_key.js start shards as replica sets
This commit is contained in:
parent
6f9e8edae6
commit
0187f0fed3
@ -3,8 +3,7 @@
|
||||
// @tags: [requires_sharding]
|
||||
//
|
||||
|
||||
// TODO: SERVER-33601 remove shardAsReplicaSet: false
|
||||
var st = new ShardingTest({shards: 2, mongos: 1, other: {shardAsReplicaSet: false}});
|
||||
var st = new ShardingTest({shards: 2, mongos: 1});
|
||||
|
||||
var mongos = st.s0;
|
||||
var coll = mongos.getCollection("foo.bar");
|
||||
|
@ -2,8 +2,7 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// TODO: SERVER-33601 remove shardAsReplicaSet: false
|
||||
var st = new ShardingTest({shards: 2, mongos: 2, other: {shardAsReplicaSet: false}});
|
||||
var st = new ShardingTest({shards: 2, mongos: 2});
|
||||
|
||||
var mongos = st.s;
|
||||
var staleMongos = st.s1;
|
||||
|
@ -9,8 +9,14 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// TODO: SERVER-33601 remove shardAsReplicaSet: false
|
||||
var s = new ShardingTest({shards: 2, other: {shardAsReplicaSet: false}});
|
||||
var checkDocCounts = function(expectedShardCount) {
|
||||
for (var shardName in expectedShardCount) {
|
||||
var shard = (shardName == s.shard0.shardName ? s.shard0 : s.shard1);
|
||||
assert.eq(expectedShardCount[shardName], shard.getDB('test').user.find().count());
|
||||
}
|
||||
};
|
||||
|
||||
var s = new ShardingTest({shards: 2});
|
||||
|
||||
var db = s.getDB("test");
|
||||
var admin = s.getDB("admin");
|
||||
@ -101,7 +107,7 @@ assert.commandWorked(admin.runCommand({
|
||||
_waitForDelete: true
|
||||
}));
|
||||
|
||||
var expectedShardCount = {shard0000: 0, shard0001: 0};
|
||||
var expectedShardCount = {};
|
||||
config.chunks.find({ns: 'test.user'}).forEach(function(chunkDoc) {
|
||||
var min = chunkDoc.min.num;
|
||||
var max = chunkDoc.max.num;
|
||||
@ -114,18 +120,18 @@ config.chunks.find({ns: 'test.user'}).forEach(function(chunkDoc) {
|
||||
max = 1000;
|
||||
}
|
||||
|
||||
if (!(chunkDoc.shard in expectedShardCount)) {
|
||||
expectedShardCount[chunkDoc.shard] = 0;
|
||||
}
|
||||
|
||||
if (max > 0) {
|
||||
expectedShardCount[chunkDoc.shard] += (max - min);
|
||||
}
|
||||
});
|
||||
|
||||
assert.eq(expectedShardCount['shard0000'], s.shard0.getDB('test').user.find().count());
|
||||
assert.eq(expectedShardCount['shard0001'], s.shard1.getDB('test').user.find().count());
|
||||
|
||||
checkDocCounts(expectedShardCount);
|
||||
assert.commandWorked(admin.runCommand({split: 'test.user', middle: {num: 70}}));
|
||||
|
||||
assert.eq(expectedShardCount['shard0000'], s.shard0.getDB('test').user.find().count());
|
||||
assert.eq(expectedShardCount['shard0001'], s.shard1.getDB('test').user.find().count());
|
||||
checkDocCounts(expectedShardCount);
|
||||
|
||||
//******************Part 3********************
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user