summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2021-06-01 13:59:39 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-01 14:20:54 +0000
commitdfe4d21d6d08a91cb40eeeb3bd8fadf0cb676790 (patch)
treef81a02e106de4d79231ae729a9e5ed14571d20f5
parente44060ccfa4cec5227ca48ccb74a794696757af4 (diff)
downloadmongo-dfe4d21d6d08a91cb40eeeb3bd8fadf0cb676790.tar.gz
Revert "SERVER-54967 Remove workaround for comparing size outside of bsonBinaryEqual in checkDBHash"
This reverts commit 63c1168646ae34866befd1ec8dcfd7de53a72e29.
-rw-r--r--src/mongo/shell/data_consistency_checker.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mongo/shell/data_consistency_checker.js b/src/mongo/shell/data_consistency_checker.js
index 802fb60841b..4cdfb07dd87 100644
--- a/src/mongo/shell/data_consistency_checker.js
+++ b/src/mongo/shell/data_consistency_checker.js
@@ -328,6 +328,22 @@ var {DataConsistencyChecker} = (function() {
delete syncingInfo.idIndex.ns;
}
+ // TODO: SERVER-54967 Remove workaround for comparing size
+ let sizeDeleted = false;
+ let sourceSize = sourceInfo.options.size;
+ let syncingSize = syncingInfo.options.size;
+
+ // Compare 'size' field in 'options' field outside of bsonBinaryEqual as it
+ // could be saved as a NumberDecimal or NumberLong in versions 4.4 and
+ // before.
+ if (jsTest.options().useRandomBinVersionsWithinReplicaSet &&
+ sourceInfo.options.size == syncingInfo.options.size &&
+ sourceInfo.options.size !== syncingInfo.options.size) {
+ delete sourceInfo.options.size;
+ delete syncingInfo.options.size;
+ sizeDeleted = true;
+ }
+
if (!bsonBinaryEqual(syncingInfo, sourceInfo)) {
prettyPrint(
`the two nodes have different attributes for the collection or view ${
@@ -338,6 +354,13 @@ var {DataConsistencyChecker} = (function() {
syncingInfo.name);
success = false;
}
+
+ // Deleted sizes must be added back to prevent comparison between nodes that
+ // have not had their size removed.
+ if (sizeDeleted) {
+ sourceInfo.options.size = sourceSize;
+ syncingInfo.options.size = syncingSize;
+ }
}
});
});