From 3a0d6ee6a2b6f82c5775380b7184501916338331 Mon Sep 17 00:00:00 2001 From: Max Hirschhorn Date: Sun, 8 May 2016 14:16:24 -0400 Subject: SERVER-22726 Store path-level multikey information in the KVCatalog. --- src/mongo/db/catalog/collection_catalog_entry.h | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/catalog/collection_catalog_entry.h') diff --git a/src/mongo/db/catalog/collection_catalog_entry.h b/src/mongo/db/catalog/collection_catalog_entry.h index a31843b3cce..dd6a1f506f1 100644 --- a/src/mongo/db/catalog/collection_catalog_entry.h +++ b/src/mongo/db/catalog/collection_catalog_entry.h @@ -32,6 +32,7 @@ #include "mongo/base/string_data.h" #include "mongo/db/catalog/collection_options.h" +#include "mongo/db/index/multikey_paths.h" #include "mongo/db/namespace_string.h" #include "mongo/db/record_id.h" @@ -63,11 +64,33 @@ public: virtual BSONObj getIndexSpec(OperationContext* txn, StringData idxName) const = 0; - virtual bool isIndexMultikey(OperationContext* txn, StringData indexName) const = 0; + /** + * Returns true if the index identified by 'indexName' is multikey, and returns false otherwise. + * + * If the 'multikeyPaths' pointer is non-null, then it must point to an empty vector. If this + * index supports tracking path-level multikey information, then this function sets + * 'multikeyPaths' as the path components that cause this index to be multikey. + * + * In particular, if this function returns false and the index supports tracking path-level + * multikey information, then 'multikeyPaths' is initialized as a vector with size equal to the + * number of elements in the index key pattern of empty sets. + */ + virtual bool isIndexMultikey(OperationContext* txn, + StringData indexName, + MultikeyPaths* multikeyPaths) const = 0; + /** + * Sets the index identified by 'indexName' to be multikey. + * + * If 'multikeyPaths' is non-empty, then it must be a vector with size equal to the number of + * elements in the index key pattern. Additionally, at least one path component of the indexed + * fields must cause this index to be multikey. + * + * This function returns true if the index metadata has changed, and returns false otherwise. + */ virtual bool setIndexIsMultikey(OperationContext* txn, StringData indexName, - bool multikey = true) = 0; + const MultikeyPaths& multikeyPaths) = 0; virtual RecordId getIndexHead(OperationContext* txn, StringData indexName) const = 0; -- cgit v1.2.1