summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@mongodb.com>2021-10-13 22:44:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-13 23:21:16 +0000
commitae87bea78ec2ea001185677ecce3c8a930f86555 (patch)
treebf9286b96c97fc468fb4b444d5a2ed481daa3116 /src/mongo/db/catalog
parent4896779edec6f650d945ffb814116630ce2a19c9 (diff)
downloadmongo-ae87bea78ec2ea001185677ecce3c8a930f86555.tar.gz
SERVER-57376 Ensure CollectionImpl and IndexCatalogImpl stats are initialized
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp7
-rw-r--r--src/mongo/db/catalog/index_catalog_impl.cpp8
2 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 122dbae5190..6d220a9e33a 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -886,7 +886,7 @@ Status CollectionImpl::_insertDocuments(OperationContext* opCtx,
bsonRecords.push_back(bsonRecord);
}
- int64_t keysInserted;
+ int64_t keysInserted = 0;
status = _indexCatalog->indexRecords(
opCtx, {this, CollectionPtr::NoYieldTag{}}, bsonRecords, &keysInserted);
if (!status.isOK()) {
@@ -1170,7 +1170,7 @@ void CollectionImpl::deleteDocument(OperationContext* opCtx,
getRecordPreImages()) {
deletedDoc.emplace(doc.value().getOwned());
}
- int64_t keysDeleted;
+ int64_t keysDeleted = 0;
_indexCatalog->unindexRecord(opCtx,
CollectionPtr(this, CollectionPtr::NoYieldTag{}),
doc.value(),
@@ -1274,7 +1274,8 @@ RecordId CollectionImpl::updateDocument(OperationContext* opCtx,
opCtx, oldLocation, newDoc.objdata(), newDoc.objsize()));
if (indexesAffected) {
- int64_t keysInserted, keysDeleted;
+ int64_t keysInserted = 0;
+ int64_t keysDeleted = 0;
uassertStatusOK(_indexCatalog->updateRecord(opCtx,
{this, CollectionPtr::NoYieldTag{}},
diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp
index b9486620ee9..4553c696639 100644
--- a/src/mongo/db/catalog/index_catalog_impl.cpp
+++ b/src/mongo/db/catalog/index_catalog_impl.cpp
@@ -1376,7 +1376,7 @@ Status IndexCatalogImpl::_indexKeys(OperationContext* opCtx,
}
}
- int64_t inserted;
+ int64_t inserted = 0;
status = index->indexBuildInterceptor()->sideWrite(opCtx,
keys,
multikeyMetadataKeys,
@@ -1388,7 +1388,7 @@ Status IndexCatalogImpl::_indexKeys(OperationContext* opCtx,
*keysInsertedOut += inserted;
}
} else {
- int64_t numInserted;
+ int64_t numInserted = 0;
status = index->accessMethod()->insertKeysAndUpdateMultikeyPaths(
opCtx,
coll,
@@ -1553,7 +1553,7 @@ void IndexCatalogImpl::_unindexKeys(OperationContext* opCtx,
}
}
- int64_t removed;
+ int64_t removed = 0;
fassert(31155,
index->indexBuildInterceptor()->sideWrite(
opCtx, keys, {}, {}, loc, IndexBuildInterceptor::Op::kDelete, &removed));
@@ -1573,7 +1573,7 @@ void IndexCatalogImpl::_unindexKeys(OperationContext* opCtx,
// duplicates. See SERVER-17487 for more details.
options.dupsAllowed = options.dupsAllowed || !index->isReady(opCtx, collection);
- int64_t removed;
+ int64_t removed = 0;
Status status = index->accessMethod()->removeKeys(opCtx, keys, loc, options, &removed);
if (!status.isOK()) {