![]() |
Storage Engine API
|
how many: 1 per Collection. More...
#include <index_catalog.h>
how many: 1 per Collection.
lifecycle: attached to a Collection.
Classes | |
class | Impl |
class | IndexIterator |
struct | TUHook |
Public Member Functions | |
~IndexCatalog ()=default | |
IndexCatalog (Collection *const collection, const int maxNumIndexesAllowed) | |
IndexCatalog (IndexCatalog &&)=delete | |
IndexCatalog & | operator= (IndexCatalog &&)=delete |
Status | init (OperationContext *const opCtx) |
bool | ok () const |
bool | haveAnyIndexes () const |
int | numIndexesTotal (OperationContext *const opCtx) const |
int | numIndexesReady (OperationContext *const opCtx) const |
int | numIndexesInProgress (OperationContext *const opCtx) const |
bool | haveIdIndex (OperationContext *const opCtx) const |
this is in "alive" until the Collection goes away in which case everything from this tree has to go away. More... | |
BSONObj | getDefaultIdIndexSpec () const |
Returns the spec for the id index to create by default for this collection. More... | |
IndexDescriptor * | findIdIndex (OperationContext *const opCtx) const |
IndexDescriptor * | findIndexByName (OperationContext *const opCtx, const StringData name, const bool includeUnfinishedIndexes=false) const |
Find index by name. More... | |
IndexDescriptor * | findIndexByKeyPatternAndCollationSpec (OperationContext *const opCtx, const BSONObj &key, const BSONObj &collationSpec, const bool includeUnfinishedIndexes=false) const |
Find index by matching key pattern and collation spec. More... | |
void | findIndexesByKeyPattern (OperationContext *const opCtx, const BSONObj &key, const bool includeUnfinishedIndexes, std::vector< IndexDescriptor *> *const matches) const |
Find indexes with a matching key pattern, putting them into the vector 'matches'. More... | |
IndexDescriptor * | findShardKeyPrefixedIndex (OperationContext *const opCtx, const BSONObj &shardKey, const bool requireSingleKey) const |
Returns an index suitable for shard key range scans. More... | |
void | findIndexByType (OperationContext *const opCtx, const std::string &type, std::vector< IndexDescriptor *> &matches, const bool includeUnfinishedIndexes=false) const |
const IndexDescriptor * | refreshEntry (OperationContext *const opCtx, const IndexDescriptor *const oldDesc) |
Reload the index definition for 'oldDesc' from the CollectionCatalogEntry. More... | |
const IndexCatalogEntry * | getEntry (const IndexDescriptor *const desc) const |
IndexAccessMethod * | getIndex (const IndexDescriptor *const desc) |
const IndexAccessMethod * | getIndex (const IndexDescriptor *const desc) const |
Status | checkUnfinished () const |
Returns a not-ok Status if there are any unfinished index builds. More... | |
IndexIterator | getIndexIterator (OperationContext *const opCtx, const bool includeUnfinishedIndexes) const |
StatusWith< BSONObj > | createIndexOnEmptyCollection (OperationContext *const opCtx, const BSONObj spec) |
Call this only on an empty collection from inside a WriteUnitOfWork. More... | |
StatusWith< BSONObj > | prepareSpecForCreate (OperationContext *const opCtx, const BSONObj &original) const |
void | dropAllIndexes (OperationContext *opCtx, bool includingIdIndex, stdx::function< void(const IndexDescriptor *)> onDropFn=nullptr) |
Drops all indexes in the index catalog, optionally dropping the id index depending on the 'includingIdIndex' parameter value. More... | |
Status | dropIndex (OperationContext *const opCtx, IndexDescriptor *const desc) |
std::vector< BSONObj > | getAndClearUnfinishedIndexes (OperationContext *const opCtx) |
will drop all incompleted indexes and return specs after this, the indexes can be rebuilt. More... | |
bool | isMultikey (OperationContext *const opCtx, const IndexDescriptor *const idx) |
Returns true if the index 'idx' is multikey, and returns false otherwise. More... | |
MultikeyPaths | getMultikeyPaths (OperationContext *const opCtx, const IndexDescriptor *const idx) |
Returns the path components that cause the index 'idx' to be multikey if the index supports path-level multikey tracking, and returns an empty vector if path-level multikey tracking isn't supported. More... | |
Status | indexRecords (OperationContext *const opCtx, const std::vector< BsonRecord > &bsonRecords, int64_t *const keysInsertedOut) |
When 'keysInsertedOut' is not null, it will be set to the number of index keys inserted by this operation. More... | |
void | unindexRecord (OperationContext *const opCtx, const BSONObj &obj, const RecordId &loc, const bool noWarn, int64_t *const keysDeletedOut) |
When 'keysDeletedOut' is not null, it will be set to the number of index keys removed by this operation. More... | |
std::string | getAccessMethodName (OperationContext *const opCtx, const BSONObj &keyPattern) |
std::string::size_type | getLongestIndexNameLength (OperationContext *opCtx) const |
Returns length of longest index name. More... | |
Static Public Member Functions | |
static | MONGO_DECLARE_SHIM ((IndexCatalog *this_, Collection *collection, int maxNumIndexesAllowed, PrivateTo< IndexCatalog >) ->std::unique_ptr< Impl >) makeImpl |
static | MONGO_DECLARE_SHIM ((const BSONObj &key) ->BSONObj) fixIndexKey |
static | MONGO_DECLARE_SHIM ((OperationContext *opCtx, const IndexDescriptor *desc, InsertDeleteOptions *options) ->void) prepareInsertDeleteOptions |
Fills out 'options' in order to indicate whether to allow dups or relax index constraints, as needed by replication. More... | |
Private Member Functions | |
const Collection * | _getCollection () const |
Collection * | _getCollection () |
IndexCatalogEntry * | _setupInMemoryStructures (OperationContext *opCtx, std::unique_ptr< IndexDescriptor > descriptor, bool initFromDisk) |
Status | _dropIndex (OperationContext *const opCtx, IndexCatalogEntry *const desc) |
Status | _upgradeDatabaseMinorVersionIfNeeded (OperationContext *const opCtx, const std::string &newPluginName) |
const IndexCatalogEntryContainer & | _getEntries () const |
IndexCatalogEntryContainer & | _getEntries () |
void | _deleteIndexFromDisk (OperationContext *const opCtx, const std::string &indexName, const std::string &indexNamespace) |
const Impl & | _impl () const |
Impl & | _impl () |
Static Private Member Functions | |
static IndexCatalogEntryContainer & | _getEntries (IndexCatalog *const this_) |
static const IndexCatalogEntryContainer & | _getEntries (const IndexCatalog *const this_) |
static void | _deleteIndexFromDisk (IndexCatalog *const this_, OperationContext *const opCtx, const std::string &indexName, const std::string &indexNamespace) |
Private Attributes | |
std::unique_ptr< Impl > | _pimpl |
friend | IndexCatalogEntry |
Friends | |
class | IndexCatalogImpl |
class | MultiIndexBlockImpl |
|
inlinedefault |
|
inlineexplicit |
|
inlinedelete |
|
inlineprivate |
|
inlinestaticprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlineprivate |
|
inlineprivate |
|
private |
|
inlineprivate |
|
inline |
Returns a not-ok Status if there are any unfinished index builds.
No new indexes should be built when in this state.
|
inline |
Call this only on an empty collection from inside a WriteUnitOfWork.
Index creation on an empty collection can be rolled back as part of a larger WUOW. Returns the full specification of the created index, as it is stored in this index catalog.
|
inline |
Drops all indexes in the index catalog, optionally dropping the id index depending on the 'includingIdIndex' parameter value.
If 'onDropFn' is provided, it will be called before each index is dropped to allow timestamping each individual drop.
|
inline |
|
inline |
|
inline |
Find index by matching key pattern and collation spec.
The key pattern and collation spec uniquely identify an index.
Collation is specified as a normalized collation spec as returned by CollationInterface::getSpec. An empty object indicates the simple collation.
|
inline |
Find index by name.
The index name uniquely identifies an index.
|
inline |
|
inline |
Find indexes with a matching key pattern, putting them into the vector 'matches'.
The key pattern alone does not uniquely identify an index.
Consider using 'findIndexByName' if expecting to match one index.
|
inline |
Returns an index suitable for shard key range scans.
This index:
If the parameter 'requireSingleKey' is true, then this index additionally must not be multi-key.
If no such index exists, returns NULL.
|
inline |
|
inline |
will drop all incompleted indexes and return specs after this, the indexes can be rebuilt.
|
inline |
Returns the spec for the id index to create by default for this collection.
|
inline |
|
inline |
|
inline |
|
inline |
std::string::size_type mongo::IndexCatalog::getLongestIndexNameLength | ( | OperationContext * | opCtx | ) | const |
Returns length of longest index name.
This includes unfinished indexes.
|
inline |
Returns the path components that cause the index 'idx' to be multikey if the index supports path-level multikey tracking, and returns an empty vector if path-level multikey tracking isn't supported.
If the index supports path-level multikey tracking but isn't multikey, then this function returns a vector with size equal to the number of elements in the index key pattern where each element in the vector is an empty set.
|
inline |
|
inline |
this is in "alive" until the Collection goes away in which case everything from this tree has to go away.
|
inline |
When 'keysInsertedOut' is not null, it will be set to the number of index keys inserted by this operation.
This method may throw.
|
inline |
|
inline |
Returns true if the index 'idx' is multikey, and returns false otherwise.
|
static |
|
static |
|
static |
Fills out 'options' in order to indicate whether to allow dups or relax index constraints, as needed by replication.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinedelete |
|
inline |
|
inline |
Reload the index definition for 'oldDesc' from the CollectionCatalogEntry.
'oldDesc' must be a ready index that is already registered with the index catalog. Returns an unowned pointer to the descriptor for the new index definition.
Use this method to notify the IndexCatalog that the spec for this index has changed.
It is invalid to dereference 'oldDesc' after calling this method. This method broadcasts an invalidateAll() on the cursor manager to notify other users of the IndexCatalog that this descriptor is now invalid.
|
inline |
When 'keysDeletedOut' is not null, it will be set to the number of index keys removed by this operation.
|
friend |
|
friend |
|
private |
|
private |