summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhong Zhang <danielzhangyh@gmail.com>2022-01-20 21:22:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-26 00:50:09 +0000
commitc958e02c91532fcc18af48e40ccde656fd843c45 (patch)
treeb3fc83535fc408b353062fd9e2146c73cb3cfe99
parente3889b9bfa6907129e762070d5a8ee5874a3a2e2 (diff)
downloadmongo-c958e02c91532fcc18af48e40ccde656fd843c45.tar.gz
SERVER-62085 Use more bits for hashedMultikeyMetadataPaths in validation
(cherry picked from commit f095726498ae61d9ed3d919638625d81ed785eb4)
-rw-r--r--src/mongo/db/catalog/index_consistency.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/index_consistency.cpp b/src/mongo/db/catalog/index_consistency.cpp
index 61bf5fc216d..ea4880b35f7 100644
--- a/src/mongo/db/catalog/index_consistency.cpp
+++ b/src/mongo/db/catalog/index_consistency.cpp
@@ -104,12 +104,26 @@ IndexConsistency::IndexConsistency(OperationContext* opCtx,
}
void IndexConsistency::addMultikeyMetadataPath(const KeyString::Value& ks, IndexInfo* indexInfo) {
- indexInfo->hashedMultikeyMetadataPaths.emplace(_hashKeyString(ks, indexInfo->indexNameHash));
+ auto hash = _hashKeyString(ks, indexInfo->indexNameHash);
+ if (MONGO_unlikely(_validateState->extraLoggingForTest())) {
+ LOGV2(6208500,
+ "[validate](multikeyMetadataPath) Adding with the hash",
+ "hash"_attr = hash,
+ "keyString"_attr = ks.toString());
+ }
+ indexInfo->hashedMultikeyMetadataPaths.emplace(hash);
}
void IndexConsistency::removeMultikeyMetadataPath(const KeyString::Value& ks,
IndexInfo* indexInfo) {
- indexInfo->hashedMultikeyMetadataPaths.erase(_hashKeyString(ks, indexInfo->indexNameHash));
+ auto hash = _hashKeyString(ks, indexInfo->indexNameHash);
+ if (MONGO_unlikely(_validateState->extraLoggingForTest())) {
+ LOGV2(6208501,
+ "[validate](multikeyMetadataPath) Removing with the hash",
+ "hash"_attr = hash,
+ "keyString"_attr = ks.toString());
+ }
+ indexInfo->hashedMultikeyMetadataPaths.erase(hash);
}
size_t IndexConsistency::getMultikeyMetadataPathCount(IndexInfo* indexInfo) {
@@ -534,6 +548,6 @@ BSONObj IndexConsistency::_generateInfo(const std::string& indexName,
uint32_t IndexConsistency::_hashKeyString(const KeyString::Value& ks,
uint32_t indexNameHash) const {
- return ks.hash(indexNameHash) % kNumHashBuckets;
+ return ks.hash(indexNameHash);
}
} // namespace mongo