diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-04-09 17:05:00 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-04-10 16:29:38 -0400 |
commit | 8e6804d268895c01678a1a3d2feb57a82cafec62 (patch) | |
tree | ae85091e56240546aae3c92160fef1f8d64fcc6b /jstests | |
parent | cb236301e4016469c9b5c2802050e7bda08c33b9 (diff) | |
download | mongo-8e6804d268895c01678a1a3d2feb57a82cafec62.tar.gz |
SERVER-17723 Sharding catalog cache
This change builds a sharding catalog cache on top of the CatalogManager
abstraction and use this in place of the direct network calls to the
config server.
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/drop_configdb.js | 17 | ||||
-rw-r--r-- | jstests/sharding/moveprimary_ignore_sharded.js | 7 | ||||
-rw-r--r-- | jstests/sharding/read_does_not_create_namespaces.js | 12 | ||||
-rw-r--r-- | jstests/slow2/sharding_jscore_passthrough.js | 1 |
4 files changed, 26 insertions, 11 deletions
diff --git a/jstests/sharding/drop_configdb.js b/jstests/sharding/drop_configdb.js index f445fafb34e..9fbccff0ee6 100644 --- a/jstests/sharding/drop_configdb.js +++ b/jstests/sharding/drop_configdb.js @@ -7,20 +7,17 @@ var config = st._configServers[0].getDB('config'); // Try to drop config db via configsvr print ( "1: Try to drop config database via configsvr" ) -config.dropDatabase() - -print ( "2: Ensure it wasn't dropped" ) -assert.eq( 1, config.databases.find({ _id : "admin", partitioned : false, primary : "config"}).toArray().length ) - +assert.eq(0, config.dropDatabase().ok); +assert.eq("Cannot drop 'config' database if mongod started with --configsvr", + config.dropDatabase().errmsg); // Try to drop config db via mongos - var config = mongos.getDB( "config" ) print ( "1: Try to drop config database via mongos" ) -config.dropDatabase() +assert.eq(0, config.dropDatabase().ok); -print ( "2: Ensure it wasn't dropped" ) -assert.eq( 1, config.databases.find({ _id : "admin", partitioned : false, primary : "config"}).toArray().length ) +// 20 = ErrorCodes::IllegalOperation +assert.eq(20, config.dropDatabase().code); -st.stop();
\ No newline at end of file +st.stop(); diff --git a/jstests/sharding/moveprimary_ignore_sharded.js b/jstests/sharding/moveprimary_ignore_sharded.js index c73f73427c6..c5fda358840 100644 --- a/jstests/sharding/moveprimary_ignore_sharded.js +++ b/jstests/sharding/moveprimary_ignore_sharded.js @@ -49,7 +49,7 @@ st.printShardingStatus(); jsTest.log( "Running movePrimary for foo through mongosA ..." ) // MongosA should already know about all the collection states -printjson( adminA.runCommand({ movePrimary : "foo", to : fooOtherShard._id }) ) +printjson( adminA.runCommand({ movePrimary : "foo", to : fooOtherShard._id }) ); // All collections still correctly sharded / unsharded assert.neq( null, mongosA.getCollection("foo.coll0").findOne() ); @@ -76,6 +76,11 @@ assert.eq( 1, realCollectionCount( new Mongo( fooOtherShard.host ).getDB( "foo" jsTest.log( "Running movePrimary for bar through mongosB ..." ); printjson( adminB.runCommand({ movePrimary : "bar", to : barOtherShard._id }) ); +// We need to flush the cluster config on mongosA, so it can discover that database 'bar' got +// moved. Otherwise since the collections are not sharded, we have no way of discovering this. +// See SERVER-8059. +adminA.runCommand({ flushRouterConfig : 1 }); + // All collections still correctly sharded / unsharded assert.neq( null, mongosA.getCollection("bar.coll0").findOne() ); assert.neq( null, mongosA.getCollection("bar.coll1").findOne() ); diff --git a/jstests/sharding/read_does_not_create_namespaces.js b/jstests/sharding/read_does_not_create_namespaces.js new file mode 100644 index 00000000000..d07280fc0d3 --- /dev/null +++ b/jstests/sharding/read_does_not_create_namespaces.js @@ -0,0 +1,12 @@ +// This test ensures that just attempting to read from a non-existent database or collection won't
+// cause entries to be created in the catalog.
+var shardingTest = new ShardingTest('read_does_not_create_namespaces', 1);
+var db = shardingTest.getDB('NonExistentDB');
+
+assert.isnull(db.nonExistentColl.findOne({}));
+
+// Neither the database nor the collection should have been created
+assert.isnull(shardingTest.getDB('config').databases.findOne({ _id: 'NonExistentDB' }));
+assert.eq(-1, shardingTest.shard0.getDBNames().indexOf('NonExistentDB'));
+
+shardingTest.stop();
\ No newline at end of file diff --git a/jstests/slow2/sharding_jscore_passthrough.js b/jstests/slow2/sharding_jscore_passthrough.js index 3d257e5f0ef..209cd3dd504 100644 --- a/jstests/slow2/sharding_jscore_passthrough.js +++ b/jstests/slow2/sharding_jscore_passthrough.js @@ -72,6 +72,7 @@ files.forEach(function(x) { 'profile\\d*|' + 'dbhash|' + 'dbhash2|' + + 'explain_missing_database|' + 'median|' + 'evalb|' + 'evald|' + |