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-28 22:40:01 +0000
commit95f52d2d562113fa99a75dd987811118d0cbef8c (patch)
tree4c90bebae1723ba4d05c325ba8988473b464c693
parente8b559035c85335898643bcbc7bfb4f375d72b0b (diff)
downloadmongo-95f52d2d562113fa99a75dd987811118d0cbef8c.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 38c52bbf741..fde68c2c949 100644
--- a/src/mongo/db/catalog/index_consistency.cpp
+++ b/src/mongo/db/catalog/index_consistency.cpp
@@ -87,12 +87,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) {
@@ -407,6 +421,6 @@ BSONObj IndexConsistency::_generateInfo(const IndexInfo& indexInfo,
uint32_t IndexConsistency::_hashKeyString(const KeyString::Value& ks,
uint32_t indexNameHash) const {
- return ks.hash(indexNameHash) % kNumHashBuckets;
+ return ks.hash(indexNameHash);
}
} // namespace mongo