diff options
author | Benety Goh <benety@mongodb.com> | 2023-03-08 13:55:25 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-03-16 21:46:12 +0000 |
commit | 38bf4fb1db89f7753c29cdddc817b4fba2d11e53 (patch) | |
tree | 1ab0520feea2ee679d0ac36a5b6d84d15f5ff234 | |
parent | 877bb0f2a62f2641925504997b019c3c80a63d6c (diff) | |
download | mongo-38bf4fb1db89f7753c29cdddc817b4fba2d11e53.tar.gz |
SERVER-74642 KeyStringIndexConsistency::addDocKey() accepts ValidateResults
(cherry picked from commit 6174b2264ea9f184347b757045416181ebfe7d09)
-rw-r--r-- | src/mongo/db/catalog/index_consistency.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_consistency.h | 3 | ||||
-rw-r--r-- | src/mongo/db/catalog/validate_results.h | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/index_consistency.cpp b/src/mongo/db/catalog/index_consistency.cpp index 24e2cc1063f..1f3b2b7b2ef 100644 --- a/src/mongo/db/catalog/index_consistency.cpp +++ b/src/mongo/db/catalog/index_consistency.cpp @@ -377,7 +377,8 @@ void KeyStringIndexConsistency::addDocumentMultikeyPaths(IndexInfo* indexInfo, void KeyStringIndexConsistency::addDocKey(OperationContext* opCtx, const KeyString::Value& ks, IndexInfo* indexInfo, - const RecordId& recordId) { + const RecordId& recordId, + ValidateResults* results) { auto rawHash = ks.hash(indexInfo->indexNameHash); auto hashLower = rawHash % kNumHashBuckets; auto hashUpper = (rawHash / kNumHashBuckets) % kNumHashBuckets; @@ -426,7 +427,7 @@ void KeyStringIndexConsistency::addDocKey(OperationContext* opCtx, // Prints the collection document's and index entry's metadata. _validateState->getCollection()->getRecordStore()->printRecordMetadata( - opCtx, recordId, /*recordTimestamps=*/nullptr); + opCtx, recordId, &(results->recordTimestamps)); indexInfo->accessMethod->asSortedData()->getSortedDataInterface()->printIndexEntryMetadata( opCtx, ks); } @@ -504,7 +505,7 @@ void KeyStringIndexConsistency::addIndexKey(OperationContext* opCtx, // Prints the collection document's and index entry's metadata. _validateState->getCollection()->getRecordStore()->printRecordMetadata( - opCtx, recordId, /*recordTimestamps=*/nullptr); + opCtx, recordId, &(results->recordTimestamps)); indexInfo->accessMethod->asSortedData() ->getSortedDataInterface() ->printIndexEntryMetadata(opCtx, ks); @@ -1013,7 +1014,7 @@ void KeyStringIndexConsistency::traverseRecord(OperationContext* opCtx, for (const auto& keyString : *documentKeySet) { _totalIndexKeys++; - this->addDocKey(opCtx, keyString, &indexInfo, recordId); + this->addDocKey(opCtx, keyString, &indexInfo, recordId, results); } } diff --git a/src/mongo/db/catalog/index_consistency.h b/src/mongo/db/catalog/index_consistency.h index 0fe2dc1818b..634c8de7631 100644 --- a/src/mongo/db/catalog/index_consistency.h +++ b/src/mongo/db/catalog/index_consistency.h @@ -250,7 +250,8 @@ private: void addDocKey(OperationContext* opCtx, const KeyString::Value& ks, IndexInfo* indexInfo, - const RecordId& recordId); + const RecordId& recordId, + ValidateResults* results); /** * During the first phase of validation, given the index entry's KeyString, decrement the diff --git a/src/mongo/db/catalog/validate_results.h b/src/mongo/db/catalog/validate_results.h index baa6d78ad42..1c3e274d6cc 100644 --- a/src/mongo/db/catalog/validate_results.h +++ b/src/mongo/db/catalog/validate_results.h @@ -30,6 +30,7 @@ #pragma once #include <map> +#include <set> #include <string> #include <vector> @@ -60,6 +61,9 @@ struct ValidateResults { std::vector<BSONObj> extraIndexEntries; std::vector<BSONObj> missingIndexEntries; std::vector<RecordId> corruptRecords; + // Timestamps (startTs, startDurable, stopTs, stopDurableTs) related to records + // with validation errors. See WiredTigerRecordStore::printRecordMetadata(). + std::set<Timestamp> recordTimestamps; long long numRemovedCorruptRecords = 0; long long numRemovedExtraIndexEntries = 0; long long numInsertedMissingIndexEntries = 0; |