summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/collection_impl.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2018-11-12 13:35:36 -0500
committerLouis Williams <louis.williams@mongodb.com>2018-11-29 13:09:15 -0500
commitca1cccb8a18be76c584f587e04b14512e59d8424 (patch)
tree455c08f9ad231f45fc64e8a3b2a5ec2d4048cc38 /src/mongo/db/catalog/collection_impl.cpp
parentb5308fc30a1ec7405ccec6dcc4213cf5fb167a4e (diff)
downloadmongo-ca1cccb8a18be76c584f587e04b14512e59d8424.tar.gz
SERVER-38027 SERVER-37268 Partially enable hybrid index builds for background, non-unique indexes. Change background index builds to use the bulk builder and external sorter
Diffstat (limited to 'src/mongo/db/catalog/collection_impl.cpp')
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp50
1 files changed, 5 insertions, 45 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index ec0be702ade..8e6c517c4c0 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -656,60 +656,20 @@ RecordId CollectionImpl::updateDocument(OperationContext* opCtx,
<< " != "
<< newDoc.objsize());
- // At the end of this step, we will have a map of UpdateTickets, one per index, which
- // represent the index updates needed to be done, based on the changes between oldDoc and
- // newDoc.
- OwnedPointerMap<IndexDescriptor*, UpdateTicket> updateTickets;
- if (indexesAffected) {
- std::unique_ptr<IndexCatalog::IndexIterator> ii =
- _indexCatalog->getIndexIterator(opCtx, true);
- while (ii->more()) {
- IndexCatalogEntry* entry = ii->next();
- IndexDescriptor* descriptor = entry->descriptor();
- IndexAccessMethod* iam = entry->accessMethod();
-
- InsertDeleteOptions options;
- _indexCatalog->prepareInsertDeleteOptions(opCtx, descriptor, &options);
- UpdateTicket* updateTicket = new UpdateTicket();
- updateTickets.mutableMap()[descriptor] = updateTicket;
- uassertStatusOK(iam->validateUpdate(opCtx,
- oldDoc.value(),
- newDoc,
- oldLocation,
- options,
- updateTicket,
- entry->getFilterExpression()));
- }
- }
-
args->preImageDoc = oldDoc.value().getOwned();
Status updateStatus =
_recordStore->updateRecord(opCtx, oldLocation, newDoc.objdata(), newDoc.objsize());
- // Update each index with each respective UpdateTicket.
if (indexesAffected) {
- int64_t keysInsertedTotal = 0;
- int64_t keysDeletedTotal = 0;
+ int64_t keysInserted, keysDeleted;
- std::unique_ptr<IndexCatalog::IndexIterator> ii =
- _indexCatalog->getIndexIterator(opCtx, true);
- while (ii->more()) {
- IndexCatalogEntry* entry = ii->next();
- IndexDescriptor* descriptor = entry->descriptor();
- IndexAccessMethod* iam = entry->accessMethod();
-
- int64_t keysInserted;
- int64_t keysDeleted;
- uassertStatusOK(iam->update(
- opCtx, *updateTickets.mutableMap()[descriptor], &keysInserted, &keysDeleted));
- keysInsertedTotal += keysInserted;
- keysDeletedTotal += keysDeleted;
- }
+ uassertStatusOK(_indexCatalog->updateRecord(
+ opCtx, args->preImageDoc.get(), newDoc, oldLocation, &keysInserted, &keysDeleted));
if (opDebug) {
- opDebug->additiveMetrics.incrementKeysInserted(keysInsertedTotal);
- opDebug->additiveMetrics.incrementKeysDeleted(keysDeletedTotal);
+ opDebug->additiveMetrics.incrementKeysInserted(keysInserted);
+ opDebug->additiveMetrics.incrementKeysDeleted(keysDeleted);
}
}