diff options
author | Jordi Serra Torrens <jordi.serra-torrens@mongodb.com> | 2021-03-18 12:38:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-19 09:17:16 +0000 |
commit | 7d02a73b2cbecf175a27b6221e3bbef6b2db861d (patch) | |
tree | 200a1ff93f5fa3f2501821dc313d93c54e535ba4 | |
parent | 87e14fa4bd8df77de512cdb85b72fa89abca353f (diff) | |
download | mongo-7d02a73b2cbecf175a27b6221e3bbef6b2db861d.tar.gz |
SERVER-54629: Remove skip indexConsistencyCheck in collation_targeting_inherited.js
3 files changed, 10 insertions, 15 deletions
diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_index_operations.js b/jstests/concurrency/fsm_workloads/random_moveChunk_index_operations.js index 28dd1fff5fb..7a56bbab693 100644 --- a/jstests/concurrency/fsm_workloads/random_moveChunk_index_operations.js +++ b/jstests/concurrency/fsm_workloads/random_moveChunk_index_operations.js @@ -188,7 +188,8 @@ var $config = (function() { assertAlways.hasFields(indexList, ["indexes"]); const indexes = indexList["indexes"]; const indexKeyPatterns = indexes.map(index => getKeyPattern(index)); - return ShardedIndexUtil.containsBSON(indexKeyPatterns, expectedIndex); + return ShardedIndexUtil.containsBSONIgnoreFieldsOrder(indexKeyPatterns, + expectedIndex); }); if (!match) { print(`Could not find index ${ diff --git a/jstests/sharding/libs/sharded_index_util.js b/jstests/sharding/libs/sharded_index_util.js index a371e768ca2..1e39b5d78b1 100644 --- a/jstests/sharding/libs/sharded_index_util.js +++ b/jstests/sharding/libs/sharded_index_util.js @@ -36,11 +36,11 @@ var ShardedIndexUtil = (function() { }; /* - * Returns true if the array contains the given BSON object. + * Returns true if the array contains the given BSON object, ignoring the field order */ - let containsBSON = function(arr, targetObj) { + let containsBSONIgnoreFieldsOrder = function(arr, targetObj) { for (const obj of arr) { - if (bsonWoCompare(obj, targetObj) === 0) { + if (bsonUnorderedFieldsCompare(obj, targetObj) === 0) { return true; } } @@ -76,16 +76,16 @@ var ShardedIndexUtil = (function() { // [{"spec" : {"v" : 2, "key" : {"_id" : 1}, "name" : "_id_"}}]; let consistentIndexes = indexDocs[0].indexes; for (let i = 1; i < indexDocs.length; i++) { - consistentIndexes = - consistentIndexes.filter(index => this.containsBSON(indexDocs[i].indexes, index)); + consistentIndexes = consistentIndexes.filter( + index => this.containsBSONIgnoreFieldsOrder(indexDocs[i].indexes, index)); } // Find inconsistent indexes. For the example above: // {"rs0": [{"spec" : {"v" : 2, "key" : {"x" : 1}, "name" : "x_1"}}], "rs1" : []}; const inconsistentIndexesOnShard = {}; for (const indexDoc of indexDocs) { - const inconsistentIndexes = - indexDoc.indexes.filter(index => !this.containsBSON(consistentIndexes, index)); + const inconsistentIndexes = indexDoc.indexes.filter( + index => !this.containsBSONIgnoreFieldsOrder(consistentIndexes, index)); inconsistentIndexesOnShard[indexDoc.shard] = inconsistentIndexes; } @@ -95,7 +95,7 @@ var ShardedIndexUtil = (function() { return { assertIndexExistsOnShard, assertIndexDoesNotExistOnShard, - containsBSON, + containsBSONIgnoreFieldsOrder, getPerShardIndexes, findInconsistentIndexesAcrossShards }; diff --git a/jstests/sharding/query/collation_targeting_inherited.js b/jstests/sharding/query/collation_targeting_inherited.js index 326791f838d..6006c25a8c9 100644 --- a/jstests/sharding/query/collation_targeting_inherited.js +++ b/jstests/sharding/query/collation_targeting_inherited.js @@ -5,12 +5,6 @@ // Shard key index has collation, which is not compatible with $min/$max TestData.skipCheckOrphans = true; -// TODO SERVER-54629 Remove this skip. Index consistency check is failing due to shards reporting -// the index spec BSON object with different element order. Check whether it's okay to change the -// check at ShardedIndexUtil.findInconsistentIndexesAcrossShards to compare the index specs without -// taking into account the order. -TestData.skipCheckingIndexesConsistentAcrossCluster = true; - const caseInsensitive = { locale: "en_US", strength: 2 |