diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-10-01 22:29:40 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-01 22:29:40 +0000 |
commit | 32615d54bab1284b28443d493ef5f32a2cdeaf20 (patch) | |
tree | 4543f5e109a47f059c03c15295d8c9c81efecd92 /src/mongo/db/catalog/index_consistency.h | |
parent | 8be05f0607113b2406d6d6c4fc5c0f998b012812 (diff) | |
download | mongo-32615d54bab1284b28443d493ef5f32a2cdeaf20.tar.gz |
SERVER-42974 Validate should work with KeyString instead of BSON where possible
Diffstat (limited to 'src/mongo/db/catalog/index_consistency.h')
-rw-r--r-- | src/mongo/db/catalog/index_consistency.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/mongo/db/catalog/index_consistency.h b/src/mongo/db/catalog/index_consistency.h index 8ef836793b5..78556234b94 100644 --- a/src/mongo/db/catalog/index_consistency.h +++ b/src/mongo/db/catalog/index_consistency.h @@ -53,8 +53,6 @@ struct IndexInfo { const uint32_t indexNameHash; // More efficient representation of the ordering of the descriptor's key pattern. const Ordering ord; - // For conveniently building KeyStrings in a preallocated buffer. - std::unique_ptr<KeyString::Builder> ks; // The number of index entries belonging to the index. int64_t numKeys = 0; // The number of records that have a key in their document that referenced back to the this @@ -85,10 +83,9 @@ public: * inconsistent hash buckets during the first phase of validation. */ void addDocKey(OperationContext* opCtx, - const KeyString::Builder& ks, + const KeyString::Value& ks, IndexInfo* indexInfo, - RecordId recordId, - const BSONObj& indexKey); + RecordId recordId); /** * During the first phase of validation, given the index entry's KeyString, decrement the @@ -96,10 +93,7 @@ public: * For the second phase of validation, try to match the index entry keys that hashed to * inconsistent hash buckets during the first phase of validation to document keys. */ - void addIndexKey(const KeyString::Builder& ks, - IndexInfo* indexInfo, - RecordId recordId, - const BSONObj& indexKey); + void addIndexKey(const KeyString::Value& ks, IndexInfo* indexInfo, RecordId recordId); /** * To validate $** multikey metadata paths, we first scan the collection and add a hash of all @@ -107,8 +101,8 @@ public: * entries and remove any path encountered. As we expect the index to contain a super-set of * the collection paths, a non-empty set represents an invalid index. */ - void addMultikeyMetadataPath(const KeyString::Builder& ks, IndexInfo* indexInfo); - void removeMultikeyMetadataPath(const KeyString::Builder& ks, IndexInfo* indexInfo); + void addMultikeyMetadataPath(const KeyString::Value& ks, IndexInfo* indexInfo); + void removeMultikeyMetadataPath(const KeyString::Value& ks, IndexInfo* indexInfo); size_t getMultikeyMetadataPathCount(IndexInfo* indexInfo); /** @@ -195,7 +189,7 @@ private: /** * Returns a hashed value from the given KeyString and index namespace. */ - uint32_t _hashKeyString(const KeyString::Builder& ks, uint32_t indexNameHash) const; + uint32_t _hashKeyString(const KeyString::Value& ks, uint32_t indexNameHash) const; }; // IndexConsistency } // namespace mongo |