diff options
Diffstat (limited to 'jstests/libs/check_orphans_are_deleted_helpers.js')
-rw-r--r-- | jstests/libs/check_orphans_are_deleted_helpers.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/jstests/libs/check_orphans_are_deleted_helpers.js b/jstests/libs/check_orphans_are_deleted_helpers.js index 71a24a1a375..ce1597ee83a 100644 --- a/jstests/libs/check_orphans_are_deleted_helpers.js +++ b/jstests/libs/check_orphans_are_deleted_helpers.js @@ -1,7 +1,5 @@ 'use strict'; -load("jstests/sharding/libs/find_chunks_util.js"); - var CheckOrphansAreDeletedHelpers = (function() { function runCheck(mongosConn, shardConn, shardId) { const configDB = shardConn.getDB('config'); @@ -69,19 +67,17 @@ var CheckOrphansAreDeletedHelpers = (function() { }); const coll = shardConn.getDB(dbName)[collName]; - findChunksUtil.findChunksByNs(mongosConn.getDB('config'), ns, {shard: {$ne: shardId}}) - .forEach(chunkDoc => { - // Use $min/$max so this will also work with hashed and compound shard keys. - const orphans = coll.find({}) - .hint(collDoc.key) - .min(chunkDoc.min) - .max(chunkDoc.max) - .toArray(); - assert.eq(0, - orphans.length, - 'found orphans @ ' + shardId + ' within chunk: ' + tojson(chunkDoc) + - ', orphans: ' + tojson(orphans)); - }); + const chunksQuery = (collDoc.timestamp) ? {uuid: collDoc.uuid, shard: {$ne: shardId}} + : {ns: ns, shard: {$ne: shardId}}; + mongosConn.getDB('config').chunks.find(chunksQuery).forEach(chunkDoc => { + // Use $min/$max so this will also work with hashed and compound shard keys. + const orphans = + coll.find({}).hint(collDoc.key).min(chunkDoc.min).max(chunkDoc.max).toArray(); + assert.eq(0, + orphans.length, + 'found orphans @ ' + shardId + ' within chunk: ' + tojson(chunkDoc) + + ', orphans: ' + tojson(orphans)); + }); }); } |