diff options
Diffstat (limited to 'src/mongo/db/index/index_access_method.cpp')
-rw-r--r-- | src/mongo/db/index/index_access_method.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp index f6f1386baab..8341b81c73d 100644 --- a/src/mongo/db/index/index_access_method.cpp +++ b/src/mongo/db/index/index_access_method.cpp @@ -120,6 +120,7 @@ AbstractIndexAccessMethod::AbstractIndexAccessMethod(const IndexCatalogEntry* bt // Find the keys for obj, put them in the tree pointing to loc. Status AbstractIndexAccessMethod::insert(OperationContext* opCtx, + SharedBufferFragmentBuilder& pooledBufferBuilder, const CollectionPtr& coll, const BSONObj& obj, const RecordId& loc, @@ -134,7 +135,7 @@ Status AbstractIndexAccessMethod::insert(OperationContext* opCtx, auto multikeyMetadataKeys = executionCtx.multikeyMetadataKeys(); auto multikeyPaths = executionCtx.multikeyPaths(); - getKeys(executionCtx.pooledBufferBuilder(), + getKeys(pooledBufferBuilder, obj, options.getKeysMode, GetKeysContext::kAddingKeys, @@ -273,12 +274,14 @@ RecordId AbstractIndexAccessMethod::findSingle(OperationContext* opCtx, KeyString::Value actualKey = [&]() { if (_indexCatalogEntry->getCollator()) { // For performance, call get keys only if there is a non-simple collation. + SharedBufferFragmentBuilder pooledBuilder( + KeyString::HeapBuilder::kHeapAllocatorDefaultBytes); auto& executionCtx = StorageExecutionContext::get(opCtx); auto keys = executionCtx.keys(); KeyStringSet* multikeyMetadataKeys = nullptr; MultikeyPaths* multikeyPaths = nullptr; - getKeys(executionCtx.pooledBufferBuilder(), + getKeys(pooledBuilder, requestedKey, GetKeysMode::kEnforceConstraints, GetKeysContext::kAddingKeys, @@ -385,7 +388,7 @@ void AbstractIndexAccessMethod::prepareUpdate(OperationContext* opCtx, const RecordId& record, const InsertDeleteOptions& options, UpdateTicket* ticket) const { - auto& executionCtx = StorageExecutionContext::get(opCtx); + SharedBufferFragmentBuilder pooledBuilder(KeyString::HeapBuilder::kHeapAllocatorDefaultBytes); const MatchExpression* indexFilter = index->getFilterExpression(); if (!indexFilter || indexFilter->matchesBSON(from)) { // Override key constraints when generating keys for removal. This only applies to keys @@ -397,7 +400,7 @@ void AbstractIndexAccessMethod::prepareUpdate(OperationContext* opCtx, // There's no need to compute the prefixes of the indexed fields that possibly caused the // index to be multikey when the old version of the document was written since the index // metadata isn't updated when keys are deleted. - getKeys(executionCtx.pooledBufferBuilder(), + getKeys(pooledBuilder, from, getKeysMode, GetKeysContext::kRemovingKeys, @@ -409,7 +412,7 @@ void AbstractIndexAccessMethod::prepareUpdate(OperationContext* opCtx, } if (!indexFilter || indexFilter->matchesBSON(to)) { - getKeys(executionCtx.pooledBufferBuilder(), + getKeys(pooledBuilder, to, options.getKeysMode, GetKeysContext::kAddingKeys, @@ -488,6 +491,7 @@ public: StringData dbName); Status insert(OperationContext* opCtx, + SharedBufferFragmentBuilder& pooledBuilder, const BSONObj& obj, const RecordId& loc, const InsertDeleteOptions& options, @@ -564,6 +568,7 @@ AbstractIndexAccessMethod::BulkBuilderImpl::BulkBuilderImpl(const IndexCatalogEn Status AbstractIndexAccessMethod::BulkBuilderImpl::insert( OperationContext* opCtx, + SharedBufferFragmentBuilder& pooledBuilder, const BSONObj& obj, const RecordId& loc, const InsertDeleteOptions& options, @@ -576,7 +581,7 @@ Status AbstractIndexAccessMethod::BulkBuilderImpl::insert( try { _indexCatalogEntry->accessMethod()->getKeys( - executionCtx.pooledBufferBuilder(), + pooledBuilder, obj, options.getKeysMode, GetKeysContext::kAddingKeys, |