summaryrefslogtreecommitdiff
path: root/jstests/sharding/drop_collection.js
diff options
context:
space:
mode:
authorAntonio Fuschetto <antonio.fuschetto@mongodb.com>2021-06-16 10:17:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-09 07:36:42 +0000
commit33aaa656979089a8d6530d1ae3ff15335b13508a (patch)
tree87f79df58362931f24c448c99198eb7cc643bffe /jstests/sharding/drop_collection.js
parentd66a3f9835c7e944fcc71213eb5b737ef831f328 (diff)
downloadmongo-33aaa656979089a8d6530d1ae3ff15335b13508a.tar.gz
SERVER-34632 config.chunks change to config.cache.chunks creates a collection long name after upgrade
Diffstat (limited to 'jstests/sharding/drop_collection.js')
-rw-r--r--jstests/sharding/drop_collection.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/sharding/drop_collection.js b/jstests/sharding/drop_collection.js
index eb252ef04a7..4261d9bc727 100644
--- a/jstests/sharding/drop_collection.js
+++ b/jstests/sharding/drop_collection.js
@@ -5,6 +5,7 @@
(function() {
"use strict";
+load("jstests/libs/uuid_util.js");
load("jstests/sharding/libs/find_chunks_util.js");
var st = new ShardingTest({shards: 2});
@@ -342,13 +343,19 @@ jsTest.log("Test that dropping a sharded collection, the cached metadata on shar
assert.commandWorked(coll.insert({_id: 10}));
assert.commandWorked(coll.insert({_id: -10}));
+ // Get the chunks cache collection name
+ const configCollDoc = st.s0.getDB('config').collections.findOne({_id: coll.getFullName()});
+ const chunksCollName = 'cache.chunks.' +
+ (configCollDoc.hasOwnProperty('timestamp') ? extractUUIDFromObject(configCollDoc.uuid)
+ : coll.getFullName());
+
// Drop the collection
assert.commandWorked(db.runCommand({drop: coll.getName()}));
// Verify that the cached metadata on shards is cleaned up
for (let configDb of [st.shard0.getDB('config'), st.shard1.getDB('config')]) {
assert.eq(configDb['cache.collections'].countDocuments({_id: coll.getFullName()}), 0);
- assert(!configDb['cache.chunks.' + coll.getFullName()].exists());
+ assert(!configDb[chunksCollName].exists());
}
}