diff options
Diffstat (limited to 'src/mongo/db/storage')
71 files changed, 302 insertions, 371 deletions
diff --git a/src/mongo/db/storage/biggie/biggie_record_store.cpp b/src/mongo/db/storage/biggie/biggie_record_store.cpp index dcb9cde53bd..4c47df9cd7b 100644 --- a/src/mongo/db/storage/biggie/biggie_record_store.cpp +++ b/src/mongo/db/storage/biggie/biggie_record_store.cpp @@ -55,8 +55,7 @@ Ordering allAscending = Ordering::make(BSONObj()); auto const version = KeyString::Version::V1; BSONObj const sample = BSON("" << "s" - << "" - << (int64_t)0); + << "" << (int64_t)0); std::string createKey(StringData ident, int64_t recordId) { KeyString::Builder ks(version, BSON("" << ident << "" << recordId), allAscending); @@ -561,7 +560,7 @@ RecordStore::SizeAdjuster::~SizeAdjuster() { int64_t deltaDataSize = _workingCopy->dataSize() - _origDataSize; _rs->_numRecords.fetchAndAdd(deltaNumRecords); _rs->_dataSize.fetchAndAdd(deltaDataSize); - RecoveryUnit::get(_opCtx)->onRollback([ rs = _rs, deltaNumRecords, deltaDataSize ]() { + RecoveryUnit::get(_opCtx)->onRollback([rs = _rs, deltaNumRecords, deltaDataSize]() { invariant(rs->_numRecords.load() >= deltaNumRecords); rs->_numRecords.fetchAndSubtract(deltaNumRecords); rs->_dataSize.fetchAndSubtract(deltaDataSize); diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp b/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp index 6a0ccceba63..03aa3330b60 100644 --- a/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp +++ b/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp @@ -59,12 +59,8 @@ public: BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << "testIndex" - << "v" - << static_cast<int>(IndexDescriptor::kLatestIndexVersion) - << "ns" - << ns - << "unique" - << unique); + << "v" << static_cast<int>(IndexDescriptor::kLatestIndexVersion) + << "ns" << ns << "unique" << unique); if (partial) { auto partialBSON = BSON(IndexDescriptor::kPartialFilterExprFieldName.toString() << BSON("" diff --git a/src/mongo/db/storage/biggie/store.h b/src/mongo/db/storage/biggie/store.h index 6c0c883f108..a09b5b49b63 100644 --- a/src/mongo/db/storage/biggie/store.h +++ b/src/mongo/db/storage/biggie/store.h @@ -153,10 +153,10 @@ public: : _root(root), _current(current) {} /** - * This function traverses the tree to find the next left-most node with data. Modifies - * '_current' to point to this node. It uses a pre-order traversal ('visit' the current - * node itself then 'visit' the child subtrees from left to right). - */ + * This function traverses the tree to find the next left-most node with data. Modifies + * '_current' to point to this node. It uses a pre-order traversal ('visit' the current + * node itself then 'visit' the child subtrees from left to right). + */ void _findNext() { // If 'current' is a nullptr there is no next node to go to. if (_current == nullptr) diff --git a/src/mongo/db/storage/biggie/store_test.cpp b/src/mongo/db/storage/biggie/store_test.cpp index cc4c8a5d7ca..e75a81bc7c7 100644 --- a/src/mongo/db/storage/biggie/store_test.cpp +++ b/src/mongo/db/storage/biggie/store_test.cpp @@ -2492,5 +2492,5 @@ TEST_F(RadixStoreTest, LowerBoundEndpoint) { ASSERT_TRUE(it == thisStore.end()); } -} // biggie namespace -} // mongo namespace +} // namespace biggie +} // namespace mongo diff --git a/src/mongo/db/storage/bson_collection_catalog_entry.cpp b/src/mongo/db/storage/bson_collection_catalog_entry.cpp index b6485febf42..a90848175a0 100644 --- a/src/mongo/db/storage/bson_collection_catalog_entry.cpp +++ b/src/mongo/db/storage/bson_collection_catalog_entry.cpp @@ -254,4 +254,4 @@ void BSONCollectionCatalogEntry::MetaData::parse(const BSONObj& obj) { prefix = KVPrefix::fromBSONElement(obj["prefix"]); } -} +} // namespace mongo diff --git a/src/mongo/db/storage/bson_collection_catalog_entry.h b/src/mongo/db/storage/bson_collection_catalog_entry.h index 15405b1942d..4f71435937c 100644 --- a/src/mongo/db/storage/bson_collection_catalog_entry.h +++ b/src/mongo/db/storage/bson_collection_catalog_entry.h @@ -110,4 +110,4 @@ public: KVPrefix prefix = KVPrefix::kNotPrefixed; }; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/capped_callback.h b/src/mongo/db/storage/capped_callback.h index 44b11310544..cced6f61f5d 100644 --- a/src/mongo/db/storage/capped_callback.h +++ b/src/mongo/db/storage/capped_callback.h @@ -63,4 +63,4 @@ public: */ virtual void notifyCappedWaitersIfNeeded() = 0; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h index d0645b897b2..ad4f95460b7 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.h +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h @@ -156,4 +156,4 @@ private: int _cachePressureForTest; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/durable_catalog_impl.cpp b/src/mongo/db/storage/durable_catalog_impl.cpp index 208566a2385..c8b849206c1 100644 --- a/src/mongo/db/storage/durable_catalog_impl.cpp +++ b/src/mongo/db/storage/durable_catalog_impl.cpp @@ -804,7 +804,7 @@ StatusWith<std::unique_ptr<RecordStore>> DurableCatalogImpl::createCollection( } CollectionUUID uuid = options.uuid.get(); - opCtx->recoveryUnit()->onRollback([ opCtx, catalog = this, nss, ident, uuid ]() { + opCtx->recoveryUnit()->onRollback([opCtx, catalog = this, nss, ident, uuid]() { // Intentionally ignoring failure catalog->_engine->getEngine()->dropIdent(opCtx, ident).ignore(); }); @@ -871,7 +871,7 @@ Status DurableCatalogImpl::dropCollection(OperationContext* opCtx, const Namespa // This will notify the storageEngine to drop the collection only on WUOW::commit(). opCtx->recoveryUnit()->onCommit( - [ opCtx, catalog = this, nss, uuid, ident ](boost::optional<Timestamp> commitTimestamp) { + [opCtx, catalog = this, nss, uuid, ident](boost::optional<Timestamp> commitTimestamp) { StorageEngineInterface* engine = catalog->_engine; auto storageEngine = engine->getStorageEngine(); if (storageEngine->supportsPendingDrops() && commitTimestamp) { diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp index 209af0253fa..1f689ddd607 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp @@ -124,4 +124,4 @@ std::vector<std::string> EphemeralForTestEngine::getAllIdents(OperationContext* } return all; } -} +} // namespace mongo diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h index 3a76d268efb..a083f9f3a4b 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h @@ -133,4 +133,4 @@ private: // Notified when we write as everything is considered "journalled" since repl depends on it. JournalListener* _journalListener = &NoOpJournalListener::instance; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp index dc0d2fa1ed0..dc41fab864c 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp @@ -389,10 +389,8 @@ StatusWith<RecordId> EphemeralForTestRecordStore::extractAndCheckLocForOplog(Wit return StatusWith<RecordId>(ErrorCodes::BadValue, str::stream() << "attempted out-of-order oplog insert of " - << status.getValue() - << " (oplog last insert was " - << _data->records.rbegin()->first - << " )"); + << status.getValue() << " (oplog last insert was " + << _data->records.rbegin()->first << " )"); } return status; } diff --git a/src/mongo/db/storage/journal_listener.h b/src/mongo/db/storage/journal_listener.h index 275b8ad05d7..88597adb2bc 100644 --- a/src/mongo/db/storage/journal_listener.h +++ b/src/mongo/db/storage/journal_listener.h @@ -70,4 +70,4 @@ public: // As this has no state, it is de facto const and can be safely shared freely. static NoOpJournalListener instance; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp index 5c4e269e6ed..98ca9082f41 100644 --- a/src/mongo/db/storage/key_string.cpp +++ b/src/mongo/db/storage/key_string.cpp @@ -1315,9 +1315,9 @@ void toBsonValue(uint8_t ctype, break; } - // - // Numerics - // + // + // Numerics + // case CType::kNumericNaN: { auto type = typeBits->readNumeric(); @@ -1430,7 +1430,7 @@ void toBsonValue(uint8_t ctype, case CType::kNumericNegativeSmallMagnitude: inverted = !inverted; isNegative = true; - // fallthrough (format is the same as positive, but inverted) + // fallthrough (format is the same as positive, but inverted) case CType::kNumericPositiveSmallMagnitude: { const uint8_t originalType = typeBits->readNumeric(); @@ -1561,7 +1561,7 @@ void toBsonValue(uint8_t ctype, case CType::kNumericNegative1ByteInt: inverted = !inverted; isNegative = true; - // fallthrough (format is the same as positive, but inverted) + // fallthrough (format is the same as positive, but inverted) case CType::kNumericPositive1ByteInt: case CType::kNumericPositive2ByteInt: @@ -1795,9 +1795,9 @@ void filterKeyFromKeyString(uint8_t ctype, BufReader* reader, bool inverted, Ver break; } - // - // Numerics - // + // + // Numerics + // case CType::kNumericNaN: { break; @@ -1836,7 +1836,7 @@ void filterKeyFromKeyString(uint8_t ctype, BufReader* reader, bool inverted, Ver case CType::kNumericNegativeSmallMagnitude: inverted = !inverted; isNegative = true; - // fallthrough (format is the same as positive, but inverted) + // fallthrough (format is the same as positive, but inverted) case CType::kNumericPositiveSmallMagnitude: { uint64_t encoded = readType<uint64_t>(reader, inverted); @@ -1898,7 +1898,7 @@ void filterKeyFromKeyString(uint8_t ctype, BufReader* reader, bool inverted, Ver case CType::kNumericNegative1ByteInt: inverted = !inverted; isNegative = true; - // fallthrough (format is the same as positive, but inverted) + // fallthrough (format is the same as positive, but inverted) case CType::kNumericPositive1ByteInt: case CType::kNumericPositive2ByteInt: diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp index 0c7bf0b9f5e..7d860b8da6b 100644 --- a/src/mongo/db/storage/key_string_test.cpp +++ b/src/mongo/db/storage/key_string_test.cpp @@ -664,7 +664,6 @@ TEST_F(KeyStringBuilderTest, LotsOfNumbers3) { for (double k = 0; k < 8; k++) { futures.push_back(stdx::async(stdx::launch::async, [k, this] { - for (double i = -1100; i < 1100; i++) { for (double j = 0; j < 52; j++) { const auto V1 = KeyString::Version::V1; @@ -886,10 +885,8 @@ const std::vector<BSONObj>& getInterestingElements(KeyString::Version version) { // Something with exceptional typeBits for Decimal elements.push_back( BSON("" << BSON_ARRAY("" << BSONSymbol("") << Decimal128::kNegativeInfinity - << Decimal128::kPositiveInfinity - << Decimal128::kPositiveNaN - << Decimal128("0.0000000") - << Decimal128("-0E1000")))); + << Decimal128::kPositiveInfinity << Decimal128::kPositiveNaN + << Decimal128("0.0000000") << Decimal128("-0E1000")))); } // diff --git a/src/mongo/db/storage/key_string_to_bson_fuzzer.cpp b/src/mongo/db/storage/key_string_to_bson_fuzzer.cpp index 7208a589c54..8ec66a5c14b 100644 --- a/src/mongo/db/storage/key_string_to_bson_fuzzer.cpp +++ b/src/mongo/db/storage/key_string_to_bson_fuzzer.cpp @@ -27,8 +27,8 @@ * it in the license file. */ -#include "mongo/db/storage/key_string.h" #include "mongo/bson/bson_validate.h" +#include "mongo/db/storage/key_string.h" const mongo::Ordering kAllAscending = mongo::Ordering::make(mongo::BSONObj()); const mongo::Ordering kOneDescending = mongo::Ordering::make(BSON("a" << -1)); diff --git a/src/mongo/db/storage/kv/durable_catalog_test.cpp b/src/mongo/db/storage/kv/durable_catalog_test.cpp index c125d8a8d22..f76ad1830eb 100644 --- a/src/mongo/db/storage/kv/durable_catalog_test.cpp +++ b/src/mongo/db/storage/kv/durable_catalog_test.cpp @@ -129,8 +129,7 @@ public: bool match = (expected == actual); if (!match) { FAIL(str::stream() << "Expected: " << dumpMultikeyPaths(expected) << ", " - << "Actual: " - << dumpMultikeyPaths(actual)); + << "Actual: " << dumpMultikeyPaths(actual)); } ASSERT(match); } diff --git a/src/mongo/db/storage/kv/kv_engine.h b/src/mongo/db/storage/kv/kv_engine.h index d8b5772cd3b..523a487feed 100644 --- a/src/mongo/db/storage/kv/kv_engine.h +++ b/src/mongo/db/storage/kv/kv_engine.h @@ -438,4 +438,4 @@ protected: */ const int64_t kDefaultCappedSizeBytes = 4096; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp index 17ad60721d7..7b9bfb7a5f4 100644 --- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp +++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp @@ -168,9 +168,7 @@ TEST(KVEngineTestHarness, SimpleSorted1) { IndexDescriptor desc(collection.get(), "", BSON("v" << static_cast<int>(IndexDescriptor::kLatestIndexVersion) << "ns" - << ns.ns() - << "key" - << BSON("a" << 1))); + << ns.ns() << "key" << BSON("a" << 1))); std::unique_ptr<SortedDataInterface> sorted; { MyOperationContext opCtx(engine); @@ -706,10 +704,7 @@ DEATH_TEST_F(DurableCatalogImplTest, TerminateOnNonNumericIndexVersion, "Fatal A "", BSON("v" << "1" - << "ns" - << ns.ns() - << "key" - << BSON("a" << 1))); + << "ns" << ns.ns() << "key" << BSON("a" << 1))); std::unique_ptr<SortedDataInterface> sorted; { MyOperationContext opCtx(engine); diff --git a/src/mongo/db/storage/kv/kv_prefix.cpp b/src/mongo/db/storage/kv/kv_prefix.cpp index 078446493bc..6b88dc22c3b 100644 --- a/src/mongo/db/storage/kv/kv_prefix.cpp +++ b/src/mongo/db/storage/kv/kv_prefix.cpp @@ -70,4 +70,4 @@ std::string KVPrefix::toString() const { stdx::lock_guard<stdx::mutex> lk(_nextValueMutex); return KVPrefix(_nextValue++); } -} +} // namespace mongo diff --git a/src/mongo/db/storage/kv/kv_prefix.h b/src/mongo/db/storage/kv/kv_prefix.h index ee35720cbe5..6a785dc19db 100644 --- a/src/mongo/db/storage/kv/kv_prefix.h +++ b/src/mongo/db/storage/kv/kv_prefix.h @@ -100,4 +100,4 @@ private: inline std::ostream& operator<<(std::ostream& s, const KVPrefix& prefix) { return (s << prefix.toString()); } -} +} // namespace mongo diff --git a/src/mongo/db/storage/kv/temporary_kv_record_store.h b/src/mongo/db/storage/kv/temporary_kv_record_store.h index a992ca69cd4..f4b7c6033bd 100644 --- a/src/mongo/db/storage/kv/temporary_kv_record_store.h +++ b/src/mongo/db/storage/kv/temporary_kv_record_store.h @@ -53,8 +53,7 @@ public: // Move constructor. TemporaryKVRecordStore(TemporaryKVRecordStore&& other) noexcept - : TemporaryRecordStore(std::move(other._rs)), - _kvEngine(other._kvEngine) {} + : TemporaryRecordStore(std::move(other._rs)), _kvEngine(other._kvEngine) {} ~TemporaryKVRecordStore(); diff --git a/src/mongo/db/storage/mobile/mobile_session_pool.h b/src/mongo/db/storage/mobile/mobile_session_pool.h index 605117e6983..08586e0ece8 100644 --- a/src/mongo/db/storage/mobile/mobile_session_pool.h +++ b/src/mongo/db/storage/mobile/mobile_session_pool.h @@ -102,8 +102,8 @@ public: private: /** - * Gets the front element from _sessions and then pops it off the queue. - */ + * Gets the front element from _sessions and then pops it off the queue. + */ sqlite3* _popSession_inlock(); // This is used to lock the _sessions vector. diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h index 21e70b95143..ad6747b2ad1 100644 --- a/src/mongo/db/storage/record_store.h +++ b/src/mongo/db/storage/record_store.h @@ -602,4 +602,4 @@ public: const RecordData& recordData, size_t* dataSize) = 0; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/record_store_test_harness.cpp b/src/mongo/db/storage/record_store_test_harness.cpp index 9f4214aef1f..1fb200c5105 100644 --- a/src/mongo/db/storage/record_store_test_harness.cpp +++ b/src/mongo/db/storage/record_store_test_harness.cpp @@ -38,8 +38,8 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; +using std::unique_ptr; TEST(RecordStoreTestHarness, Simple1) { const auto harnessHelper(newRecordStoreHarnessHelper()); diff --git a/src/mongo/db/storage/record_store_test_randomiter.cpp b/src/mongo/db/storage/record_store_test_randomiter.cpp index c9c9757d827..dda51057e6d 100644 --- a/src/mongo/db/storage/record_store_test_randomiter.cpp +++ b/src/mongo/db/storage/record_store_test_randomiter.cpp @@ -38,10 +38,10 @@ namespace mongo { namespace { -using std::unique_ptr; using std::set; using std::string; using std::stringstream; +using std::unique_ptr; // Create a random iterator for empty record store. TEST(RecordStoreTestHarness, GetRandomIteratorEmpty) { diff --git a/src/mongo/db/storage/record_store_test_recorditer.cpp b/src/mongo/db/storage/record_store_test_recorditer.cpp index 38a5f356aad..c50ebba023c 100644 --- a/src/mongo/db/storage/record_store_test_recorditer.cpp +++ b/src/mongo/db/storage/record_store_test_recorditer.cpp @@ -42,9 +42,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; // Insert multiple records and iterate through them in the forward direction. // When curr() or getNext() is called on an iterator positioned at EOF, diff --git a/src/mongo/db/storage/record_store_test_recordstore.cpp b/src/mongo/db/storage/record_store_test_recordstore.cpp index 38649fa89da..a10adfa75fa 100644 --- a/src/mongo/db/storage/record_store_test_recordstore.cpp +++ b/src/mongo/db/storage/record_store_test_recordstore.cpp @@ -38,8 +38,8 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; +using std::unique_ptr; // Verify that the name of the record store is not NULL and nonempty. TEST(RecordStoreTestHarness, RecordStoreName) { diff --git a/src/mongo/db/storage/record_store_test_repairiter.cpp b/src/mongo/db/storage/record_store_test_repairiter.cpp index 74aa0237cbc..cad095d0286 100644 --- a/src/mongo/db/storage/record_store_test_repairiter.cpp +++ b/src/mongo/db/storage/record_store_test_repairiter.cpp @@ -40,10 +40,10 @@ namespace mongo { namespace { -using std::unique_ptr; using std::set; using std::string; using std::stringstream; +using std::unique_ptr; // Create an iterator for repairing an empty record store. TEST(RecordStoreTestHarness, GetIteratorForRepairEmpty) { diff --git a/src/mongo/db/storage/record_store_test_storagesize.cpp b/src/mongo/db/storage/record_store_test_storagesize.cpp index cba9e555c16..57b126b37a5 100644 --- a/src/mongo/db/storage/record_store_test_storagesize.cpp +++ b/src/mongo/db/storage/record_store_test_storagesize.cpp @@ -38,9 +38,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; // Verify that a nonempty collection maybe takes up some space on disk. TEST(RecordStoreTestHarness, StorageSizeNonEmpty) { diff --git a/src/mongo/db/storage/record_store_test_touch.cpp b/src/mongo/db/storage/record_store_test_touch.cpp index edafde0683e..ead23584b87 100644 --- a/src/mongo/db/storage/record_store_test_touch.cpp +++ b/src/mongo/db/storage/record_store_test_touch.cpp @@ -38,9 +38,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; // Verify that calling touch() on an empty collection returns an OK status. TEST(RecordStoreTestHarness, TouchEmpty) { diff --git a/src/mongo/db/storage/record_store_test_truncate.cpp b/src/mongo/db/storage/record_store_test_truncate.cpp index d05e3e9a117..a37c9a6681c 100644 --- a/src/mongo/db/storage/record_store_test_truncate.cpp +++ b/src/mongo/db/storage/record_store_test_truncate.cpp @@ -38,9 +38,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; // Verify that calling truncate() on an already empty collection returns an OK status. TEST(RecordStoreTestHarness, TruncateEmpty) { diff --git a/src/mongo/db/storage/record_store_test_updaterecord.cpp b/src/mongo/db/storage/record_store_test_updaterecord.cpp index d6f16586cde..b07d215cfa0 100644 --- a/src/mongo/db/storage/record_store_test_updaterecord.cpp +++ b/src/mongo/db/storage/record_store_test_updaterecord.cpp @@ -38,9 +38,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; // Insert a record and try to update it. TEST(RecordStoreTestHarness, UpdateRecord) { diff --git a/src/mongo/db/storage/record_store_test_updatewithdamages.cpp b/src/mongo/db/storage/record_store_test_updatewithdamages.cpp index 298685c7285..9753e7d76b6 100644 --- a/src/mongo/db/storage/record_store_test_updatewithdamages.cpp +++ b/src/mongo/db/storage/record_store_test_updatewithdamages.cpp @@ -40,8 +40,8 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; +using std::unique_ptr; // Insert a record and try to perform an in-place update on it. TEST(RecordStoreTestHarness, UpdateWithDamages) { diff --git a/src/mongo/db/storage/remove_saver.cpp b/src/mongo/db/storage/remove_saver.cpp index 16ad9b482e9..7012f671c37 100644 --- a/src/mongo/db/storage/remove_saver.cpp +++ b/src/mongo/db/storage/remove_saver.cpp @@ -45,8 +45,8 @@ using std::ios_base; using std::ofstream; -using std::stringstream; using std::string; +using std::stringstream; namespace mongo { diff --git a/src/mongo/db/storage/snapshot.h b/src/mongo/db/storage/snapshot.h index 57045aae502..d169e4dada0 100644 --- a/src/mongo/db/storage/snapshot.h +++ b/src/mongo/db/storage/snapshot.h @@ -93,4 +93,4 @@ private: SnapshotId _id; T _value; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_end_position.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_end_position.cpp index 895fc5560d9..20aba3337b3 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_end_position.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_end_position.cpp @@ -40,12 +40,15 @@ namespace { void testSetEndPosition_Next_Forward(bool unique, bool inclusive) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface( - unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, {key5, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + {key4, loc1}, + {key5, loc1}, + }); // Dup key on end point. Illegal for unique indexes. if (!unique) @@ -80,12 +83,15 @@ TEST(SortedDataInterface, SetEndPosition_Next_Forward_Standard_Exclusive) { void testSetEndPosition_Next_Reverse(bool unique, bool inclusive) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface( - unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, {key5, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + {key4, loc1}, + {key5, loc1}, + }); // Dup key on end point. Illegal for unique indexes. if (!unique) @@ -220,12 +226,14 @@ TEST(SortedDataInterface, SetEndPosition_Seek_Reverse_Standard_Exclusive) { void testSetEndPosition_Restore_Forward(bool unique) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface( - unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + {key4, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get()); cursor->setEndPosition(key3, false); // Should never see key3 or key4. @@ -241,7 +249,8 @@ void testSetEndPosition_Restore_Forward(bool unique) { removeFromIndex(opCtx, sorted, { - {key2, loc1}, {key3, loc1}, + {key2, loc1}, + {key3, loc1}, }); cursor->restore(); @@ -257,12 +266,14 @@ TEST(SortedDataInterface, SetEndPosition_Restore_Forward_Standard) { void testSetEndPosition_Restore_Reverse(bool unique) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface( - unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + {key4, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get(), false); cursor->setEndPosition(key2, false); // Should never see key1 or key2. @@ -278,7 +289,8 @@ void testSetEndPosition_Restore_Reverse(bool unique) { removeFromIndex(opCtx, sorted, { - {key2, loc1}, {key3, loc1}, + {key2, loc1}, + {key3, loc1}, }); cursor->restore(); @@ -302,7 +314,8 @@ void testSetEndPosition_RestoreEndCursor_Forward(bool unique) { auto sorted = harnessHelper->newSortedDataInterface(unique, /*partial=*/false, { - {key1, loc1}, {key4, loc1}, + {key1, loc1}, + {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get()); @@ -337,7 +350,8 @@ void testSetEndPosition_RestoreEndCursor_Reverse(bool unique) { auto sorted = harnessHelper->newSortedDataInterface(unique, /*partial=*/false, { - {key1, loc1}, {key4, loc1}, + {key1, loc1}, + {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), false); @@ -370,12 +384,13 @@ TEST(SortedDataInterface, SetEndPosition_RestoreEndCursor_Reverse_Unique) { void testSetEndPosition_Empty_Forward(bool unique, bool inclusive) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = - harnessHelper->newSortedDataInterface(unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get()); cursor->setEndPosition(BSONObj(), inclusive); @@ -401,12 +416,13 @@ TEST(SortedDataInterface, SetEndPosition_Empty_Forward_Standard_Exclusive) { void testSetEndPosition_Empty_Reverse(bool unique, bool inclusive) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = - harnessHelper->newSortedDataInterface(unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get(), false); cursor->setEndPosition(BSONObj(), inclusive); diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp index 88a43ed0005..30d207d5031 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp @@ -300,7 +300,8 @@ void testSaveAndRestorePositionSeesNewInserts(bool forward, bool unique) { auto sorted = harnessHelper->newSortedDataInterface(unique, /*partial=*/false, { - {key1, loc1}, {key3, loc1}, + {key1, loc1}, + {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -335,7 +336,8 @@ void testSaveAndRestorePositionSeesNewInsertsAfterRemove(bool forward, bool uniq auto sorted = harnessHelper->newSortedDataInterface(unique, /*partial=*/false, { - {key1, loc1}, {key3, loc1}, + {key1, loc1}, + {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -414,12 +416,13 @@ TEST(SortedDataInterface, SaveAndRestorePositionSeesNewInsertsAfterEOF_Reverse_S TEST(SortedDataInterface, SaveAndRestorePositionStandardIndexConsidersRecordId_Forward) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = - harnessHelper->newSortedDataInterface(/*unique*/ false, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(/*unique*/ false, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get()); @@ -497,12 +500,13 @@ TEST(SortedDataInterface, SaveAndRestorePositionUniqueIndexWontReturnDupKeys_For TEST(SortedDataInterface, SaveAndRestorePositionStandardIndexConsidersRecordId_Reverse) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = - harnessHelper->newSortedDataInterface(/*unique*/ false, - /*partial=*/false, - { - {key0, loc1}, {key1, loc1}, {key2, loc2}, - }); + auto sorted = harnessHelper->newSortedDataInterface(/*unique*/ false, + /*partial=*/false, + { + {key0, loc1}, + {key1, loc1}, + {key2, loc2}, + }); auto cursor = sorted->newCursor(opCtx.get(), false); @@ -580,12 +584,13 @@ TEST(SortedDataInterface, SaveAndRestorePositionUniqueIndexWontReturnDupKeys_Rev TEST(SortedDataInterface, SaveUnpositionedAndRestore) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = - harnessHelper->newSortedDataInterface(/*unique=*/false, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(/*unique=*/false, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get()); diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_seek_exact.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_seek_exact.cpp index fa608652d8f..4a0584e0559 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_seek_exact.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_seek_exact.cpp @@ -40,12 +40,13 @@ namespace { void testSeekExact_Hit(bool unique, bool forward) { const auto harnessHelper = newSortedDataInterfaceHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = - harnessHelper->newSortedDataInterface(unique, - /*partial=*/false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = harnessHelper->newSortedDataInterface(unique, + /*partial=*/false, + { + {key1, loc1}, + {key2, loc1}, + {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -111,7 +112,10 @@ TEST(SortedDataInterface, SeekExact_HitWithDups_Forward) { /*unique=*/false, /*partial=*/false, { - {key1, loc1}, {key2, loc1}, {key2, loc2}, {key3, loc1}, + {key1, loc1}, + {key2, loc1}, + {key2, loc2}, + {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get()); @@ -131,7 +135,10 @@ TEST(SortedDataInterface, SeekExact_HitWithDups_Reverse) { /*unique=*/false, /*partial=*/false, { - {key1, loc1}, {key2, loc1}, {key2, loc2}, {key3, loc1}, + {key1, loc1}, + {key2, loc1}, + {key2, loc2}, + {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), false); diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h index 1b0bf3e6216..24e3781fba1 100644 --- a/src/mongo/db/storage/storage_engine.h +++ b/src/mongo/db/storage/storage_engine.h @@ -151,8 +151,8 @@ public: }; /** - * The destructor should only be called if we are tearing down but not exiting the process. - */ + * The destructor should only be called if we are tearing down but not exiting the process. + */ virtual ~StorageEngine() {} /** diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp index 57dcb407253..9e003e4fa5b 100644 --- a/src/mongo/db/storage/storage_engine_impl.cpp +++ b/src/mongo/db/storage/storage_engine_impl.cpp @@ -93,8 +93,8 @@ void StorageEngineImpl::loadCatalog(OperationContext* opCtx) { if (status.code() == ErrorCodes::DataModifiedByRepair) { warning() << "Catalog data modified by repair: " << status.reason(); - repairObserver->onModification(str::stream() << "DurableCatalog repaired: " - << status.reason()); + repairObserver->onModification(str::stream() + << "DurableCatalog repaired: " << status.reason()); } else { fassertNoTrace(50926, status); } @@ -210,8 +210,8 @@ void StorageEngineImpl::loadCatalog(OperationContext* opCtx) { if (_options.forRepair) { StorageRepairObserver::get(getGlobalServiceContext()) - ->onModification(str::stream() << "Collection " << nss << " dropped: " - << status.reason()); + ->onModification(str::stream() << "Collection " << nss + << " dropped: " << status.reason()); } wuow.commit(); continue; @@ -299,8 +299,8 @@ Status StorageEngineImpl::_recoverOrphanedCollection(OperationContext* opCtx, } if (dataModified) { StorageRepairObserver::get(getGlobalServiceContext()) - ->onModification(str::stream() << "Collection " << collectionName << " recovered: " - << status.reason()); + ->onModification(str::stream() << "Collection " << collectionName + << " recovered: " << status.reason()); } wuow.commit(); return Status::OK(); @@ -398,8 +398,7 @@ StorageEngineImpl::reconcileCatalogAndIdents(OperationContext* opCtx) { if (engineIdents.find(identForColl) == engineIdents.end()) { return {ErrorCodes::UnrecoverableRollbackError, str::stream() << "Expected collection does not exist. Collection: " << coll - << " Ident: " - << identForColl}; + << " Ident: " << identForColl}; } } } @@ -495,8 +494,8 @@ StorageEngineImpl::reconcileCatalogAndIdents(OperationContext* opCtx) { for (auto&& indexName : indexesToDrop) { invariant(metaData.eraseIndex(indexName), - str::stream() << "Index is missing. Collection: " << coll << " Index: " - << indexName); + str::stream() + << "Index is missing. Collection: " << coll << " Index: " << indexName); } if (indexesToDrop.size() > 0) { WriteUnitOfWork wuow(opCtx); @@ -684,8 +683,8 @@ Status StorageEngineImpl::repairRecordStore(OperationContext* opCtx, const Names } if (dataModified) { - repairObserver->onModification(str::stream() << "Collection " << nss << ": " - << status.reason()); + repairObserver->onModification(str::stream() + << "Collection " << nss << ": " << status.reason()); } // After repairing, re-initialize the collection with a valid RecordStore. @@ -825,8 +824,8 @@ void StorageEngineImpl::_dumpCatalog(OperationContext* opCtx) { while (rec) { // This should only be called by a parent that's done an appropriate `shouldLog` check. Do // not duplicate the log level policy. - LOG_FOR_RECOVERY(kCatalogLogLevel) << "\tId: " << rec->id - << " Value: " << rec->data.toBson(); + LOG_FOR_RECOVERY(kCatalogLogLevel) + << "\tId: " << rec->id << " Value: " << rec->data.toBson(); auto valueBson = rec->data.toBson(); if (valueBson.hasField("md")) { std::string ns = valueBson.getField("md").Obj().getField("ns").String(); diff --git a/src/mongo/db/storage/storage_engine_init.cpp b/src/mongo/db/storage/storage_engine_init.cpp index 5377f91dfb2..281a32fdc53 100644 --- a/src/mongo/db/storage/storage_engine_init.cpp +++ b/src/mongo/db/storage/storage_engine_init.cpp @@ -106,14 +106,12 @@ void initializeStorageEngine(ServiceContext* service, const StorageEngineInitFla getFactoryForStorageEngine(service, storageGlobalParams.engine); if (factory) { uassert(28662, - str::stream() << "Cannot start server. Detected data files in " << dbpath - << " created by" - << " the '" - << *existingStorageEngine - << "' storage engine, but the" - << " specified storage engine was '" - << factory->getCanonicalName() - << "'.", + str::stream() + << "Cannot start server. Detected data files in " << dbpath + << " created by" + << " the '" << *existingStorageEngine << "' storage engine, but the" + << " specified storage engine was '" << factory->getCanonicalName() + << "'.", factory->getCanonicalName() == *existingStorageEngine); } } else { @@ -156,8 +154,7 @@ void initializeStorageEngine(ServiceContext* service, const StorageEngineInitFla uassert(34368, str::stream() << "Server was started in read-only mode, but the configured storage engine, " - << storageGlobalParams.engine - << ", does not support read-only operation", + << storageGlobalParams.engine << ", does not support read-only operation", factory->supportsReadOnly()); } @@ -223,9 +220,7 @@ void createLockFile(ServiceContext* service) { } catch (const std::exception& ex) { uassert(28596, str::stream() << "Unable to determine status of lock file in the data directory " - << storageGlobalParams.dbpath - << ": " - << ex.what(), + << storageGlobalParams.dbpath << ": " << ex.what(), false); } const bool wasUnclean = lockFile->createdByUncleanShutdown(); diff --git a/src/mongo/db/storage/storage_engine_interface.h b/src/mongo/db/storage/storage_engine_interface.h index db7201c1492..77703c8aa6f 100644 --- a/src/mongo/db/storage/storage_engine_interface.h +++ b/src/mongo/db/storage/storage_engine_interface.h @@ -46,4 +46,4 @@ public: StringData ident) = 0; virtual DurableCatalog* getCatalog() = 0; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp index b39b0503547..c0398eddec3 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp @@ -67,8 +67,8 @@ void flushMyDirectory(const boost::filesystem::path& file) { int fd = ::open(dir.string().c_str(), O_RDONLY); // DO NOT THROW OR ASSERT BEFORE CLOSING massert(40387, - str::stream() << "Couldn't open directory '" << dir.string() << "' for flushing: " - << errnoWithDescription(), + str::stream() << "Couldn't open directory '" << dir.string() + << "' for flushing: " << errnoWithDescription(), fd >= 0); if (fsync(fd) != 0) { int e = errno; @@ -85,8 +85,8 @@ void flushMyDirectory(const boost::filesystem::path& file) { } else { close(fd); massert(40388, - str::stream() << "Couldn't fsync directory '" << dir.string() << "': " - << errnoWithDescription(e), + str::stream() << "Couldn't fsync directory '" << dir.string() + << "': " << errnoWithDescription(e), false); } } @@ -136,8 +136,7 @@ Status StorageEngineLockFile::open() { } catch (const std::exception& ex) { return Status(ErrorCodes::UnknownError, str::stream() << "Unable to check existence of data directory " << _dbpath - << ": " - << ex.what()); + << ": " << ex.what()); } // Use file permissions 644 @@ -153,13 +152,11 @@ Status StorageEngineLockFile::open() { } return Status(ErrorCodes::DBPathInUse, str::stream() << "Unable to create/open the lock file: " << _filespec << " (" - << errnoWithDescription(errorcode) - << ")." + << errnoWithDescription(errorcode) << ")." << " Ensure the user executing mongod is the owner of the lock " "file and has the appropriate permissions. Also make sure " "that another mongod instance is not already running on the " - << _dbpath - << " directory"); + << _dbpath << " directory"); } int ret = ::flock(lockFile, LOCK_EX | LOCK_NB); if (ret != 0) { @@ -167,11 +164,9 @@ Status StorageEngineLockFile::open() { ::close(lockFile); return Status(ErrorCodes::DBPathInUse, str::stream() << "Unable to lock the lock file: " << _filespec << " (" - << errnoWithDescription(errorcode) - << ")." + << errnoWithDescription(errorcode) << ")." << " Another mongod instance is already running on the " - << _dbpath - << " directory"); + << _dbpath << " directory"); } _lockFileHandle->_fd = lockFile; return Status::OK(); @@ -197,9 +192,7 @@ Status StorageEngineLockFile::writeString(StringData str) { int errorcode = errno; return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write string to file (ftruncate failed): " - << _filespec - << ' ' - << errnoWithDescription(errorcode)); + << _filespec << ' ' << errnoWithDescription(errorcode)); } int bytesWritten = ::write(_lockFileHandle->_fd, str.rawData(), str.size()); @@ -207,8 +200,7 @@ Status StorageEngineLockFile::writeString(StringData str) { int errorcode = errno; return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write string " << str << " to file: " << _filespec - << ' ' - << errnoWithDescription(errorcode)); + << ' ' << errnoWithDescription(errorcode)); } else if (bytesWritten == 0) { return Status(ErrorCodes::FileStreamFailed, @@ -220,9 +212,7 @@ Status StorageEngineLockFile::writeString(StringData str) { int errorcode = errno; return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id " << str - << " to file (fsync failed): " - << _filespec - << ' ' + << " to file (fsync failed): " << _filespec << ' ' << errnoWithDescription(errorcode)); } diff --git a/src/mongo/db/storage/storage_engine_lock_file_test.cpp b/src/mongo/db/storage/storage_engine_lock_file_test.cpp index 153040ef874..df4967e2d41 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_test.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_test.cpp @@ -46,8 +46,8 @@ namespace { -using std::string; using mongo::unittest::TempDir; +using std::string; using namespace mongo; diff --git a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp index 2be6f11bb03..4055318d1d8 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp @@ -108,8 +108,7 @@ Status StorageEngineLockFile::open() { } catch (const std::exception& ex) { return Status(ErrorCodes::UnknownError, str::stream() << "Unable to check existence of data directory " << _dbpath - << ": " - << ex.what()); + << ": " << ex.what()); } HANDLE lockFileHandle = CreateFileW(toNativeString(_filespec.c_str()).c_str(), @@ -130,13 +129,11 @@ Status StorageEngineLockFile::open() { } return Status(ErrorCodes::DBPathInUse, str::stream() << "Unable to create/open the lock file: " << _filespec << " (" - << errnoWithDescription(errorcode) - << ")." + << errnoWithDescription(errorcode) << ")." << " Ensure the user executing mongod is the owner of the lock " "file and has the appropriate permissions. Also make sure " "that another mongod instance is not already running on the " - << _dbpath - << " directory"); + << _dbpath << " directory"); } _lockFileHandle->_handle = lockFileHandle; return Status::OK(); @@ -171,8 +168,7 @@ Status StorageEngineLockFile::writeString(StringData str) { int errorcode = GetLastError(); return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write string " << str << " to file: " << _filespec - << ' ' - << errnoWithDescription(errorcode)); + << ' ' << errnoWithDescription(errorcode)); } else if (bytesWritten == 0) { return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write string " << str << " to file: " << _filespec diff --git a/src/mongo/db/storage/storage_engine_metadata.cpp b/src/mongo/db/storage/storage_engine_metadata.cpp index 62fecc4c102..ecf401f3ee9 100644 --- a/src/mongo/db/storage/storage_engine_metadata.cpp +++ b/src/mongo/db/storage/storage_engine_metadata.cpp @@ -142,13 +142,13 @@ Status StorageEngineMetadata::read() { boost::uintmax_t fileSize = boost::filesystem::file_size(metadataPath); if (fileSize == 0) { return Status(ErrorCodes::InvalidPath, - str::stream() << "Metadata file " << metadataPath.string() - << " cannot be empty."); + str::stream() + << "Metadata file " << metadataPath.string() << " cannot be empty."); } if (fileSize == static_cast<boost::uintmax_t>(-1)) { return Status(ErrorCodes::InvalidPath, - str::stream() << "Unable to determine size of metadata file " - << metadataPath.string()); + str::stream() + << "Unable to determine size of metadata file " << metadataPath.string()); } std::vector<char> buffer(fileSize); @@ -156,23 +156,21 @@ Status StorageEngineMetadata::read() { std::ifstream ifs(metadataPath.c_str(), std::ios_base::in | std::ios_base::binary); if (!ifs) { return Status(ErrorCodes::FileNotOpen, - str::stream() << "Failed to read metadata from " - << metadataPath.string()); + str::stream() + << "Failed to read metadata from " << metadataPath.string()); } // Read BSON from file ifs.read(&buffer[0], buffer.size()); if (!ifs) { return Status(ErrorCodes::FileStreamFailed, - str::stream() << "Unable to read BSON data from " - << metadataPath.string()); + str::stream() + << "Unable to read BSON data from " << metadataPath.string()); } } catch (const std::exception& ex) { return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unexpected error reading BSON data from " - << metadataPath.string() - << ": " - << ex.what()); + << metadataPath.string() << ": " << ex.what()); } ConstDataRange cdr(&buffer[0], buffer.size()); @@ -232,8 +230,8 @@ void flushMyDirectory(const boost::filesystem::path& file) { int fd = ::open(dir.string().c_str(), O_RDONLY); // DO NOT THROW OR ASSERT BEFORE CLOSING massert(13650, - str::stream() << "Couldn't open directory '" << dir.string() << "' for flushing: " - << errnoWithDescription(), + str::stream() << "Couldn't open directory '" << dir.string() + << "' for flushing: " << errnoWithDescription(), fd >= 0); if (fsync(fd) != 0) { int e = errno; @@ -250,8 +248,8 @@ void flushMyDirectory(const boost::filesystem::path& file) { } else { close(fd); massert(13651, - str::stream() << "Couldn't fsync directory '" << dir.string() << "': " - << errnoWithDescription(e), + str::stream() << "Couldn't fsync directory '" << dir.string() + << "': " << errnoWithDescription(e), false); } } @@ -270,9 +268,9 @@ Status StorageEngineMetadata::write() const { { std::ofstream ofs(metadataTempPath.c_str(), std::ios_base::out | std::ios_base::binary); if (!ofs) { - return Status( - ErrorCodes::FileNotOpen, - str::stream() << "Failed to write metadata to " << metadataTempPath.string() << ": " + return Status(ErrorCodes::FileNotOpen, + str::stream() + << "Failed to write metadata to " << metadataTempPath.string() << ": " << errnoWithDescription()); } @@ -281,10 +279,9 @@ Status StorageEngineMetadata::write() const { ofs.write(obj.objdata(), obj.objsize()); if (!ofs) { return Status(ErrorCodes::OperationFailed, - str::stream() << "Failed to write BSON data to " - << metadataTempPath.string() - << ": " - << errnoWithDescription()); + str::stream() + << "Failed to write BSON data to " << metadataTempPath.string() + << ": " << errnoWithDescription()); } } @@ -304,11 +301,8 @@ Status StorageEngineMetadata::write() const { } catch (const std::exception& ex) { return Status(ErrorCodes::FileRenameFailed, str::stream() << "Unexpected error while renaming temporary metadata file " - << metadataTempPath.string() - << " to " - << metadataPath.string() - << ": " - << ex.what()); + << metadataTempPath.string() << " to " << metadataPath.string() + << ": " << ex.what()); } return Status::OK(); @@ -324,21 +318,16 @@ Status StorageEngineMetadata::validateStorageEngineOption<bool>( ErrorCodes::InvalidOptions, str::stream() << "Requested option conflicts with the current storage engine option for " - << fieldName - << "; you requested " - << (expectedValue ? "true" : "false") + << fieldName << "; you requested " << (expectedValue ? "true" : "false") << " but the current server storage is implicitly set to " - << (*defaultValue ? "true" : "false") - << " and cannot be changed"); + << (*defaultValue ? "true" : "false") << " and cannot be changed"); } return Status::OK(); } if (!element.isBoolean()) { return Status(ErrorCodes::FailedToParse, str::stream() << "Expected boolean field " << fieldName << " but got " - << typeName(element.type()) - << " instead: " - << element); + << typeName(element.type()) << " instead: " << element); } if (element.boolean() == expectedValue) { return Status::OK(); @@ -346,12 +335,9 @@ Status StorageEngineMetadata::validateStorageEngineOption<bool>( return Status( ErrorCodes::InvalidOptions, str::stream() << "Requested option conflicts with current storage engine option for " - << fieldName - << "; you requested " - << (expectedValue ? "true" : "false") + << fieldName << "; you requested " << (expectedValue ? "true" : "false") << " but the current server storage is already set to " - << (element.boolean() ? "true" : "false") - << " and cannot be changed"); + << (element.boolean() ? "true" : "false") << " and cannot be changed"); } } // namespace mongo diff --git a/src/mongo/db/storage/storage_engine_metadata_test.cpp b/src/mongo/db/storage/storage_engine_metadata_test.cpp index 0e1e59dc5c2..57e386644d6 100644 --- a/src/mongo/db/storage/storage_engine_metadata_test.cpp +++ b/src/mongo/db/storage/storage_engine_metadata_test.cpp @@ -44,8 +44,8 @@ namespace { -using std::string; using mongo::unittest::TempDir; +using std::string; using namespace mongo; diff --git a/src/mongo/db/storage/storage_file_util.cpp b/src/mongo/db/storage/storage_file_util.cpp index c267b292ee1..dd47a85642d 100644 --- a/src/mongo/db/storage/storage_file_util.cpp +++ b/src/mongo/db/storage/storage_file_util.cpp @@ -72,8 +72,8 @@ Status fsyncParentDirectory(const boost::filesystem::path& file) { int fd = ::open(dir.string().c_str(), O_RDONLY); if (fd < 0) { return {ErrorCodes::FileOpenFailed, - str::stream() << "Failed to open directory " << dir.string() << " for flushing: " - << errnoWithDescription()}; + str::stream() << "Failed to open directory " << dir.string() + << " for flushing: " << errnoWithDescription()}; } if (fsync(fd) != 0) { int e = errno; @@ -82,8 +82,8 @@ Status fsyncParentDirectory(const boost::filesystem::path& file) { } else { close(fd); return {ErrorCodes::OperationFailed, - str::stream() << "Failed to fsync directory '" << dir.string() << "': " - << errnoWithDescription(e)}; + str::stream() << "Failed to fsync directory '" << dir.string() + << "': " << errnoWithDescription(e)}; } } close(fd); @@ -102,9 +102,7 @@ Status fsyncRename(const boost::filesystem::path& source, const boost::filesyste if (ec) { return {ErrorCodes::FileRenameFailed, str::stream() << "Error renaming data file from " << source.string() << " to " - << dest.string() - << ": " - << ec.message()}; + << dest.string() << ": " << ec.message()}; } auto status = fsyncFile(dest); if (!status.isOK()) { diff --git a/src/mongo/db/storage/storage_init.cpp b/src/mongo/db/storage/storage_init.cpp index fb1d025289d..1da860e1e0d 100644 --- a/src/mongo/db/storage/storage_init.cpp +++ b/src/mongo/db/storage/storage_init.cpp @@ -63,17 +63,12 @@ public: << (oldestRequiredTimestampForCrashRecovery ? *oldestRequiredTimestampForCrashRecovery : Timestamp()) - << "supportsPendingDrops" - << engine->supportsPendingDrops() + << "supportsPendingDrops" << engine->supportsPendingDrops() << "dropPendingIdents" << static_cast<long long>(engine->getDropPendingIdents().size()) - << "supportsSnapshotReadConcern" - << engine->supportsReadConcernSnapshot() - << "readOnly" - << storageGlobalParams.readOnly - << "persistent" - << !engine->isEphemeral() - << "backupCursorOpen" + << "supportsSnapshotReadConcern" << engine->supportsReadConcernSnapshot() + << "readOnly" << storageGlobalParams.readOnly << "persistent" + << !engine->isEphemeral() << "backupCursorOpen" << backupCursorHooks->isBackupCursorOpen()); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h b/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h index abadc810e6a..2c321725173 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h @@ -77,4 +77,4 @@ protected: WT_CURSOR* _cursor = nullptr; // Owned }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp index caf4bb11cbd..eb9326f0625 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp @@ -144,8 +144,7 @@ StatusWith<std::string> WiredTigerIndex::parseIndexOptions(const BSONObj& option // Return error on first unrecognized field. return StatusWith<std::string>(ErrorCodes::InvalidOptions, str::stream() << '\'' << elem.fieldNameStringData() - << '\'' - << " is not a supported option."); + << '\'' << " is not a supported option."); } } return StatusWith<std::string>(ss.str()); @@ -337,10 +336,10 @@ void WiredTigerIndex::fullValidate(OperationContext* opCtx, warning() << msg; fullResults->warnings.push_back(msg); } else if (err) { - std::string msg = str::stream() << "verify() returned " << wiredtiger_strerror(err) - << ". " - << "This indicates structural damage. " - << "Not examining individual index entries."; + std::string msg = str::stream() + << "verify() returned " << wiredtiger_strerror(err) << ". " + << "This indicates structural damage. " + << "Not examining individual index entries."; error() << msg; fullResults->errors.push_back(msg); fullResults->valid = false; @@ -538,12 +537,11 @@ KeyString::Version WiredTigerIndex::_handleVersionInfo(OperationContext* ctx, ctx, uri, kMinimumIndexVersion, kMaximumIndexVersion); if (!version.isOK()) { Status versionStatus = version.getStatus(); - Status indexVersionStatus( - ErrorCodes::UnsupportedFormat, - str::stream() << versionStatus.reason() << " Index: {name: " << desc->indexName() - << ", ns: " - << desc->parentNS() - << "} - version either too old or too new for this mongod."); + Status indexVersionStatus(ErrorCodes::UnsupportedFormat, + str::stream() + << versionStatus.reason() << " Index: {name: " + << desc->indexName() << ", ns: " << desc->parentNS() + << "} - version either too old or too new for this mongod."); fassertFailedWithStatusNoTrace(28579, indexVersionStatus); } _dataFormatVersion = version.getValue(); @@ -553,14 +551,13 @@ KeyString::Version WiredTigerIndex::_handleVersionInfo(OperationContext* ctx, _dataFormatVersion == kDataFormatV4KeyStringV1UniqueIndexVersionV2 ? Status::OK() : Status(ErrorCodes::UnsupportedFormat, - str::stream() << "Index: {name: " << desc->indexName() << ", ns: " - << desc->parentNS() - << "} has incompatible format version: " - << _dataFormatVersion - << ". MongoDB 4.2 onwards, WT secondary unique indexes use " - "either format version 11 or 12. See " - "https://dochub.mongodb.org/core/upgrade-4.2-procedures for " - "detailed instructions on upgrading the index format."); + str::stream() + << "Index: {name: " << desc->indexName() << ", ns: " << desc->parentNS() + << "} has incompatible format version: " << _dataFormatVersion + << ". MongoDB 4.2 onwards, WT secondary unique indexes use " + "either format version 11 or 12. See " + "https://dochub.mongodb.org/core/upgrade-4.2-procedures for " + "detailed instructions on upgrading the index format."); fassertNoTrace(31179, versionStatus); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h index 30774f9032e..df17969fc5a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h @@ -301,4 +301,4 @@ public: bool dupsAllowed) override; }; -} // namespace +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp index b84d3e812b1..f53623761d1 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp @@ -85,15 +85,9 @@ void _testValidateMetadata(const StorageEngine::Factory* factory, if (expectedCode != status.code()) { FAIL(str::stream() << "Unexpected StorageEngine::Factory::validateMetadata result. Expected: " - << ErrorCodes::errorString(expectedCode) - << " but got " - << status.toString() - << " instead. metadataOptions: " - << metadataOptions - << "; directoryPerDB: " - << directoryPerDB - << "; directoryForIndexes: " - << directoryForIndexes); + << ErrorCodes::errorString(expectedCode) << " but got " << status.toString() + << " instead. metadataOptions: " << metadataOptions << "; directoryPerDB: " + << directoryPerDB << "; directoryForIndexes: " << directoryForIndexes); } } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 026e7d59c74..09566bd3465 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -1719,8 +1719,7 @@ StatusWith<Timestamp> WiredTigerKVEngine::recoverToStableTimestamp(OperationCont str::stream() << "No stable timestamp available to recover to. Initial data timestamp: " << initialDataTS.toString() - << ", Stable timestamp: " - << stableTS.toString()); + << ", Stable timestamp: " << stableTS.toString()); } LOG_FOR_ROLLBACK(2) << "WiredTiger::RecoverToStableTimestamp syncing size storer to disk."; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index c1502094ec5..6be66bd9128 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -455,4 +455,4 @@ private: // timestamp. Provided by replication layer because WT does not persist timestamps. AtomicWord<std::uint64_t> _initialDataTimestamp; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp index 6e4cbf157ab..90292778505 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp @@ -50,4 +50,4 @@ MONGO_STARTUP_OPTIONS_STORE(WiredTigerOptions)(InitializerContext* context) { } return Status::OK(); } -} +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp index 4901b30d631..d2a25c55a4f 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp @@ -56,9 +56,8 @@ Status applyMaxCacheOverflowSizeGBParameter(WiredTigerMaxCacheOverflowSizeGBPara int ret = param._data.second->reconfigure( fmt::format("cache_overflow=(file_max={}M)", valueMB).c_str()); if (ret != 0) { - string result = - (str::stream() << "WiredTiger reconfiguration failed with error code (" << ret << "): " - << wiredtiger_strerror(ret)); + string result = (str::stream() << "WiredTiger reconfiguration failed with error code (" + << ret << "): " << wiredtiger_strerror(ret)); error() << result; return Status(ErrorCodes::BadValue, result); @@ -91,9 +90,8 @@ Status WiredTigerEngineRuntimeConfigParameter::setFromString(const std::string& invariant(_data.second); int ret = _data.second->reconfigure(str.c_str()); if (ret != 0) { - string result = - (str::stream() << "WiredTiger reconfiguration failed with error code (" << ret << "): " - << wiredtiger_strerror(ret)); + string result = (str::stream() << "WiredTiger reconfiguration failed with error code (" + << ret << "): " << wiredtiger_strerror(ret)); error() << result; return Status(ErrorCodes::BadValue, result); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp index df39f655421..4684e13e264 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp @@ -76,12 +76,8 @@ public: BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << "testIndex" - << "v" - << static_cast<int>(IndexDescriptor::kLatestIndexVersion) - << "ns" - << ns - << "unique" - << unique); + << "v" << static_cast<int>(IndexDescriptor::kLatestIndexVersion) + << "ns" << ns << "unique" << unique); if (partial) { auto partialBSON = diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp index 549b160913b..5272bc0ca27 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp @@ -64,9 +64,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; class PrefixedWiredTigerHarnessHelper final : public RecordStoreHarnessHelper { public: diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 682e48e840c..a904a507827 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -72,8 +72,8 @@ namespace mongo { using namespace fmt::literals; -using std::unique_ptr; using std::string; +using std::unique_ptr; namespace { @@ -481,8 +481,7 @@ StatusWith<std::string> WiredTigerRecordStore::parseOptionsField(const BSONObj o // Return error on first unrecognized field. return StatusWith<std::string>(ErrorCodes::InvalidOptions, str::stream() << '\'' << elem.fieldNameStringData() - << '\'' - << " is not a supported option."); + << '\'' << " is not a supported option."); } } return StatusWith<std::string>(ss.str()); @@ -645,10 +644,11 @@ WiredTigerRecordStore::WiredTigerRecordStore(WiredTigerKVEngine* kvEngine, _engineName(params.engineName), _isCapped(params.isCapped), _isEphemeral(params.isEphemeral), - _isLogged(!isTemp() && WiredTigerUtil::useTableLogging( - NamespaceString(ns()), - getGlobalReplSettings().usingReplSets() || - repl::ReplSettings::shouldRecoverFromOplogAsStandalone())), + _isLogged(!isTemp() && + WiredTigerUtil::useTableLogging( + NamespaceString(ns()), + getGlobalReplSettings().usingReplSets() || + repl::ReplSettings::shouldRecoverFromOplogAsStandalone())), _isOplog(NamespaceString::oplog(params.ns)), _cappedMaxSize(params.cappedMaxSize), _cappedMaxSizeSlack(std::min(params.cappedMaxSize / 10, int64_t(16 * 1024 * 1024))), diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h index 81c59999fc8..ddd90ba990a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h @@ -525,4 +525,4 @@ MONGO_FAIL_POINT_DECLARE(WTWriteConflictExceptionForReads); // will not be considered durable until deactivated. It is unspecified whether writes that commit // before activation will become visible while active. MONGO_FAIL_POINT_DECLARE(WTPausePrimaryOplogDurabilityLoop); -} +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp index 2b59fc2c762..36094cf945a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp @@ -56,9 +56,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; TEST(WiredTigerRecordStoreTest, GenerateCreateStringEmptyDocument) { BSONObj spec = fromjson("{}"); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp index 40b916222ff..4a096b0cbba 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp @@ -370,8 +370,7 @@ void WiredTigerRecoveryUnit::_txnClose(bool commit) { str::stream() << "Cannot have both a _lastTimestampSet and a " "_commitTimestamp. _lastTimestampSet: " << _lastTimestampSet->toString() - << ". _commitTimestamp: " - << _commitTimestamp.toString()); + << ". _commitTimestamp: " << _commitTimestamp.toString()); // We reset the _lastTimestampSet between transactions. Since it is legal for one // transaction on a RecoveryUnit to call setTimestamp() and another to call @@ -608,8 +607,7 @@ Status WiredTigerRecoveryUnit::setTimestamp(Timestamp timestamp) { invariant(_prepareTimestamp.isNull()); invariant(_commitTimestamp.isNull(), str::stream() << "Commit timestamp set to " << _commitTimestamp.toString() - << " and trying to set WUOW timestamp to " - << timestamp.toString()); + << " and trying to set WUOW timestamp to " << timestamp.toString()); invariant(_readAtTimestamp.isNull() || timestamp >= _readAtTimestamp, str::stream() << "future commit timestamp " << timestamp.toString() << " cannot be older than read timestamp " @@ -636,12 +634,10 @@ void WiredTigerRecoveryUnit::setCommitTimestamp(Timestamp timestamp) { invariant(!_inUnitOfWork() || !_prepareTimestamp.isNull(), toString(_getState())); invariant(_commitTimestamp.isNull(), str::stream() << "Commit timestamp set to " << _commitTimestamp.toString() - << " and trying to set it to " - << timestamp.toString()); + << " and trying to set it to " << timestamp.toString()); invariant(!_lastTimestampSet, str::stream() << "Last timestamp set is " << _lastTimestampSet->toString() - << " and trying to set commit timestamp to " - << timestamp.toString()); + << " and trying to set commit timestamp to " << timestamp.toString()); invariant(!_isTimestamped); _commitTimestamp = timestamp; @@ -655,9 +651,7 @@ void WiredTigerRecoveryUnit::setDurableTimestamp(Timestamp timestamp) { invariant( _durableTimestamp.isNull(), str::stream() << "Trying to reset durable timestamp when it was already set. wasSetTo: " - << _durableTimestamp.toString() - << " setTo: " - << timestamp.toString()); + << _durableTimestamp.toString() << " setTo: " << timestamp.toString()); _durableTimestamp = timestamp; } @@ -681,16 +675,13 @@ void WiredTigerRecoveryUnit::setPrepareTimestamp(Timestamp timestamp) { invariant(_inUnitOfWork(), toString(_getState())); invariant(_prepareTimestamp.isNull(), str::stream() << "Trying to set prepare timestamp to " << timestamp.toString() - << ". It's already set to " - << _prepareTimestamp.toString()); + << ". It's already set to " << _prepareTimestamp.toString()); invariant(_commitTimestamp.isNull(), str::stream() << "Commit timestamp is " << _commitTimestamp.toString() - << " and trying to set prepare timestamp to " - << timestamp.toString()); + << " and trying to set prepare timestamp to " << timestamp.toString()); invariant(!_lastTimestampSet, str::stream() << "Last timestamp set is " << _lastTimestampSet->toString() - << " and trying to set prepare timestamp to " - << timestamp.toString()); + << " and trying to set prepare timestamp to " << timestamp.toString()); _prepareTimestamp = timestamp; } @@ -730,8 +721,7 @@ void WiredTigerRecoveryUnit::setRoundUpPreparedTimestamps(bool value) { // This cannot be called after WiredTigerRecoveryUnit::_txnOpen. invariant(!_isActive(), str::stream() << "Can't change round up prepared timestamps flag " - << "when current state is " - << toString(_getState())); + << "when current state is " << toString(_getState())); _roundUpPreparedTimestamps = (value) ? RoundUpPreparedTimestamps::kRound : RoundUpPreparedTimestamps::kNoRound; } @@ -744,8 +734,7 @@ void WiredTigerRecoveryUnit::setTimestampReadSource(ReadSource readSource, invariant(!_isActive() || _timestampReadSource == readSource, str::stream() << "Current state: " << toString(_getState()) << ". Invalid internal state while setting timestamp read source: " - << static_cast<int>(readSource) - << ", provided timestamp: " + << static_cast<int>(readSource) << ", provided timestamp: " << (provided ? provided->toString() : "none")); invariant(!provided == (readSource != ReadSource::kProvided)); invariant(!(provided && provided->isNull())); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp index be6d00fc27f..065e75e3661 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp @@ -60,7 +60,7 @@ public: false, // .ephemeral false, // .repair false // .readOnly - ) { + ) { repl::ReplicationCoordinator::set( getGlobalServiceContext(), std::unique_ptr<repl::ReplicationCoordinator>(new repl::ReplicationCoordinatorMock( diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h index ace8580f465..afb2da1fbed 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h @@ -359,4 +359,4 @@ typedef std::unique_ptr<WiredTigerSession, UniqueWiredTigerSession; extern const std::string kWTRepairMsg; -} // namespace +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h index b9096b29279..5db2a4e72bc 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h @@ -103,4 +103,4 @@ private: mutable stdx::mutex _bufferMutex; // Guards _buffer Buffer _buffer; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.h b/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.h index c5f2fc17651..75c9777a502 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_snapshot_manager.h @@ -98,4 +98,4 @@ private: mutable stdx::mutex _localSnapshotMutex; // Guards _localSnapshot. boost::optional<Timestamp> _localSnapshot; }; -} +} // namespace mongo diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp index 0185b30fadd..f03fc201827 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp @@ -76,12 +76,8 @@ public: BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << "testIndex" - << "v" - << static_cast<int>(IndexDescriptor::kLatestIndexVersion) - << "ns" - << ns - << "unique" - << unique); + << "v" << static_cast<int>(IndexDescriptor::kLatestIndexVersion) + << "ns" << ns << "unique" << unique); if (partial) { auto partialBSON = diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp index 1f790206918..2607ce3ce45 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp @@ -63,9 +63,9 @@ namespace mongo { namespace { -using std::unique_ptr; using std::string; using std::stringstream; +using std::unique_ptr; class WiredTigerHarnessHelper final : public RecordStoreHarnessHelper { public: diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp index b00bb678eef..7ff8d2af36a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp @@ -187,9 +187,7 @@ Status WiredTigerUtil::getApplicationMetadata(OperationContext* opCtx, if (keysSeen.count(key)) { return Status(ErrorCodes::Error(50998), str::stream() << "app_metadata must not contain duplicate keys. " - << "Found multiple instances of key '" - << key - << "'."); + << "Found multiple instances of key '" << key << "'."); } keysSeen.insert(key); @@ -265,9 +263,7 @@ StatusWith<int64_t> WiredTigerUtil::checkApplicationMetadataFormatVersion(Operat if (version < minimumVersion || version > maximumVersion) { return Status(ErrorCodes::UnsupportedFormat, str::stream() << "Application metadata for " << uri - << " has unsupported format version: " - << version - << "."); + << " has unsupported format version: " << version << "."); } LOG(2) << "WiredTigerUtil::checkApplicationMetadataFormatVersion " @@ -320,8 +316,7 @@ StatusWith<int64_t> WiredTigerUtil::getStatisticsValue(WT_SESSION* session, if (ret != 0) { return StatusWith<int64_t>(ErrorCodes::CursorNotFound, str::stream() << "unable to open cursor at URI " << uri - << ". reason: " - << wiredtiger_strerror(ret)); + << ". reason: " << wiredtiger_strerror(ret)); } invariant(cursor); ON_BLOCK_EXIT([&] { cursor->close(cursor); }); @@ -329,21 +324,19 @@ StatusWith<int64_t> WiredTigerUtil::getStatisticsValue(WT_SESSION* session, cursor->set_key(cursor, statisticsKey); ret = cursor->search(cursor); if (ret != 0) { - return StatusWith<int64_t>( - ErrorCodes::NoSuchKey, - str::stream() << "unable to find key " << statisticsKey << " at URI " << uri - << ". reason: " - << wiredtiger_strerror(ret)); + return StatusWith<int64_t>(ErrorCodes::NoSuchKey, + str::stream() + << "unable to find key " << statisticsKey << " at URI " + << uri << ". reason: " << wiredtiger_strerror(ret)); } int64_t value; ret = cursor->get_value(cursor, nullptr, nullptr, &value); if (ret != 0) { - return StatusWith<int64_t>( - ErrorCodes::BadValue, - str::stream() << "unable to get value for key " << statisticsKey << " at URI " << uri - << ". reason: " - << wiredtiger_strerror(ret)); + return StatusWith<int64_t>(ErrorCodes::BadValue, + str::stream() << "unable to get value for key " << statisticsKey + << " at URI " << uri + << ". reason: " << wiredtiger_strerror(ret)); } return StatusWith<int64_t>(value); @@ -461,7 +454,7 @@ WT_EVENT_HANDLER defaultEventHandlers() { handlers.handle_progress = mdb_handle_progress; return handlers; } -} +} // namespace WiredTigerEventHandler::WiredTigerEventHandler() { WT_EVENT_HANDLER* handler = static_cast<WT_EVENT_HANDLER*>(this); @@ -577,8 +570,7 @@ Status WiredTigerUtil::setTableLogging(WT_SESSION* session, const std::string& u // Sanity check against a table having multiple logging specifications. invariant(false, str::stream() << "Table has contradictory logging settings. Uri: " << uri - << " Conf: " - << existingMetadata); + << " Conf: " << existingMetadata); } if (existingMetadata.find(setting) != std::string::npos) { @@ -617,8 +609,8 @@ Status WiredTigerUtil::exportTableToBSON(WT_SESSION* session, int ret = session->open_cursor(session, uri.c_str(), nullptr, cursorConfig, &c); if (ret != 0) { return Status(ErrorCodes::CursorNotFound, - str::stream() << "unable to open cursor at URI " << uri << ". reason: " - << wiredtiger_strerror(ret)); + str::stream() << "unable to open cursor at URI " << uri + << ". reason: " << wiredtiger_strerror(ret)); } bob->append("uri", uri); invariant(c); |