summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r--src/mongo/db/storage/key_string_bm.cpp2
-rw-r--r--src/mongo/db/storage/key_string_test.cpp4
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp2
4 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/storage/key_string_bm.cpp b/src/mongo/db/storage/key_string_bm.cpp
index bb500fc0a45..4e8b45c4818 100644
--- a/src/mongo/db/storage/key_string_bm.cpp
+++ b/src/mongo/db/storage/key_string_bm.cpp
@@ -127,7 +127,7 @@ void BM_BSONToKeyString(benchmark::State& state,
const BsonsAndKeyStrings bsonsAndKeyStrings = generateBsonsAndKeyStrings(bsonType, version);
for (auto _ : state) {
benchmark::ClobberMemory();
- for (auto bson : bsonsAndKeyStrings.bsons) {
+ for (const auto& bson : bsonsAndKeyStrings.bsons) {
benchmark::DoNotOptimize(KeyString::Builder(version, bson, ALL_ASCENDING));
}
}
diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp
index 733e527243f..d1ae1b3cda3 100644
--- a/src/mongo/db/storage/key_string_test.cpp
+++ b/src/mongo/db/storage/key_string_test.cpp
@@ -1847,7 +1847,7 @@ TEST_F(KeyStringBuilderTest, RandomizedInputsForToBsonSafe) {
std::numeric_limits<unsigned int>::max());
const auto interestingElements = getInterestingElements(KeyString::Version::V1);
- for (auto elem : interestingElements) {
+ for (const auto& elem : interestingElements) {
const KeyString::Builder ks(KeyString::Version::V1, elem, ALL_ASCENDING);
auto ksBuffer = SharedBuffer::allocate(ks.getSize());
@@ -1908,7 +1908,7 @@ void perfTest(KeyString::Version version, const Numbers& numbers) {
Timer t;
for (uint64_t i = 0; i < iters; i++)
- for (auto item : numbers) {
+ for (const auto& item : numbers) {
// Assuming there are sufficient invariants in the to/from KeyString::Builder
// methods
// that calls will not be optimized away.
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index 66a4e36183b..2743c014c96 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -654,7 +654,7 @@ StatusWith<StorageEngine::ReconcileResult> StorageEngineImpl::reconcileCatalogAn
// other contexts such as `recoverToStableTimestamp`.
std::vector<DurableCatalog::Entry> catalogEntries = _catalog->getAllCatalogEntries(opCtx);
if (!_options.forRepair) {
- for (DurableCatalog::Entry entry : catalogEntries) {
+ for (const DurableCatalog::Entry& entry : catalogEntries) {
if (engineIdents.find(entry.ident) == engineIdents.end()) {
return {ErrorCodes::UnrecoverableRollbackError,
str::stream() << "Expected collection does not exist. Collection: "
@@ -668,7 +668,7 @@ StatusWith<StorageEngine::ReconcileResult> StorageEngineImpl::reconcileCatalogAn
//
// Also, remove unfinished builds except those that were background index builds started on a
// secondary.
- for (DurableCatalog::Entry entry : catalogEntries) {
+ for (const DurableCatalog::Entry& entry : catalogEntries) {
std::shared_ptr<BSONCollectionCatalogEntry::MetaData> metaData =
_catalog->getMetaData(opCtx, entry.catalogId);
NamespaceString nss(metaData->nss);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
index 855a56b6bd0..7ce4cd12e34 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
@@ -436,7 +436,7 @@ Status WiredTigerUtil::checkTableCreationOptions(const BSONElement& configElem)
if (!status.isOK()) {
StringBuilder errorMsg;
errorMsg << status.reason();
- for (std::string error : errors) {
+ for (const std::string& error : errors) {
errorMsg << ". " << error;
}
errorMsg << ".";