diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-05-28 17:55:12 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-05-28 17:55:12 -0400 |
commit | 6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch) | |
tree | c8cfb5acb62c80f375bc37e7d4350382deea6a37 /src/mongo/db/storage | |
parent | d4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff) | |
download | mongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz |
SERVER-23971 Clang-Format code
Diffstat (limited to 'src/mongo/db/storage')
63 files changed, 367 insertions, 263 deletions
diff --git a/src/mongo/db/storage/devnull/devnull_init.cpp b/src/mongo/db/storage/devnull/devnull_init.cpp index afdfecc1457..b1c73dbbbcd 100644 --- a/src/mongo/db/storage/devnull/devnull_init.cpp +++ b/src/mongo/db/storage/devnull/devnull_init.cpp @@ -30,8 +30,8 @@ */ #include "mongo/base/init.h" -#include "mongo/db/service_context_d.h" #include "mongo/db/service_context.h" +#include "mongo/db/service_context_d.h" #include "mongo/db/storage/devnull/devnull_kv_engine.h" #include "mongo/db/storage/kv/kv_storage_engine.h" #include "mongo/db/storage/storage_options.h" diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp index a308b6d7984..a036b05c44e 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp @@ -35,8 +35,8 @@ #include <set> #include "mongo/db/catalog/index_catalog_entry.h" -#include "mongo/db/storage/index_entry_comparison.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h" +#include "mongo/db/storage/index_entry_comparison.h" #include "mongo/stdx/memory.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp index 300929ae41d..9b36c222c53 100644 --- a/src/mongo/db/storage/key_string.cpp +++ b/src/mongo/db/storage/key_string.cpp @@ -718,9 +718,9 @@ void KeyString::_appendNumberDecimal(const Decimal128 dec, bool invert) { // in the normal range of double, so the decimal can be represented with at least 15 digits // of precision by the double 'bin' } else if (dec.getCoefficientHigh() == 0 && dec.getCoefficientLow() < k1E15) { - dassert(Decimal128(std::abs(bin), - Decimal128::kRoundTo15Digits, - Decimal128::kRoundTowardPositive).isEqual(dec.toAbs())); + dassert(Decimal128( + std::abs(bin), Decimal128::kRoundTo15Digits, Decimal128::kRoundTowardPositive) + .isEqual(dec.toAbs())); _appendDoubleWithoutTypeBits(bin, kDCMEqualToDoubleRoundedUpTo15Digits, invert); return; } else { @@ -752,10 +752,10 @@ void KeyString::_appendNumberDecimal(const Decimal128 dec, bool invert) { // Now we know that we can recover the original decimal value (but not its precision, which is // given by the type bits) from the binary double plus the decimal continuation. uint64_t decimalContinuation = decDiff.getCoefficientLow(); - dassert(storedValue.add(Decimal128(isNegative, - storedValue.getBiasedExponent(), - 0, - decimalContinuation)).isEqual(dec)); + dassert( + storedValue + .add(Decimal128(isNegative, storedValue.getBiasedExponent(), 0, decimalContinuation)) + .isEqual(dec)); decimalContinuation = endian::nativeToBig(decimalContinuation); _append(decimalContinuation, isNegative ? !invert : invert); } @@ -976,9 +976,10 @@ void KeyString::_appendTinyDecimalWithoutTypeBits(const Decimal128 dec, _append(endian::nativeToBig(encoded), isNegative ? !invert : invert); Decimal128 storedVal(scaledBin, Decimal128::kRoundTo34Digits, Decimal128::kRoundTowardPositive); - storedVal = storedVal.multiply(kTinyDoubleExponentDownshiftFactorAsDecimal, - Decimal128::kRoundTowardZero) - .add(Decimal128::kLargestNegativeExponentZero); + storedVal = + storedVal + .multiply(kTinyDoubleExponentDownshiftFactorAsDecimal, Decimal128::kRoundTowardZero) + .add(Decimal128::kLargestNegativeExponentZero); dassert(storedVal.isLess(magnitude)); Decimal128 decDiff = magnitude.subtract(storedVal); dassert(decDiff.getBiasedExponent() == storedVal.getBiasedExponent() || decDiff.isZero()); diff --git a/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp b/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp index a37eb986256..4bbc373c9c2 100644 --- a/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp +++ b/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp @@ -33,9 +33,9 @@ #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/catalog/database_catalog_entry.h" -#include "mongo/db/operation_context_noop.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/multikey_paths.h" +#include "mongo/db/operation_context_noop.h" #include "mongo/db/storage/devnull/devnull_kv_engine.h" #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/kv/kv_storage_engine.h" @@ -105,7 +105,8 @@ 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_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp index 6968d06d063..98f00ff1d07 100644 --- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp +++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp @@ -30,8 +30,8 @@ #include "mongo/db/storage/kv/kv_engine_test_harness.h" -#include "mongo/db/operation_context_noop.h" #include "mongo/db/index/index_descriptor.h" +#include "mongo/db/operation_context_noop.h" #include "mongo/db/storage/kv/kv_catalog.h" #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/record_store.h" diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp index ff42dd15c16..5a3914ea072 100644 --- a/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp +++ b/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp @@ -38,8 +38,8 @@ #include "mongo/db/storage/mmap_v1/btree/btree_logic.h" #include "mongo/db/storage/mmap_v1/btree/key.h" #include "mongo/db/storage/mmap_v1/diskloc.h" -#include "mongo/db/storage/record_store.h" #include "mongo/db/storage/mmap_v1/record_store_v1_base.h" +#include "mongo/db/storage/record_store.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" @@ -396,7 +396,8 @@ bool BtreeLogic<BtreeLayout>::pushBack(BucketType* bucket, const FullKey klast = getFullKey(bucket, bucket->n - 1); if (klast.data.woCompare(key, _ordering) > 0) { log() << "btree bucket corrupt? " - "consider reindexing or running validate command" << endl; + "consider reindexing or running validate command" + << endl; log() << " klast: " << klast.data.toString() << endl; log() << " key: " << key.toString() << endl; invariant(false); diff --git a/src/mongo/db/storage/mmap_v1/catalog/hashtab.h b/src/mongo/db/storage/mmap_v1/catalog/hashtab.h index ff2e889a202..ecd0f8c4b4e 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/hashtab.h +++ b/src/mongo/db/storage/mmap_v1/catalog/hashtab.h @@ -28,9 +28,9 @@ #pragma once +#include "mongo/db/operation_context.h" #include "mongo/db/storage/mmap_v1/catalog/namespace.h" #include "mongo/db/storage/mmap_v1/catalog/namespace_details.h" -#include "mongo/db/operation_context.h" #include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp index 915e3a7e44d..dc270d813b2 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp @@ -42,10 +42,10 @@ #include "mongo/db/db.h" #include "mongo/db/index_legacy.h" #include "mongo/db/json.h" +#include "mongo/db/operation_context.h" #include "mongo/db/ops/delete.h" #include "mongo/db/ops/update.h" #include "mongo/db/storage/mmap_v1/catalog/namespace_index.h" -#include "mongo/db/operation_context.h" #include "mongo/scripting/engine.h" #include "mongo/util/startup_test.h" diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp index cc5e57e0868..acc2460f1ec 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp @@ -401,7 +401,8 @@ void NamespaceDetailsCollectionCatalogEntry::updateValidator(OperationContext* t _updateSystemNamespaces( txn, BSON("$set" << BSON("options.validator" << validator << "options.validationLevel" - << validationLevel << "options.validationAction" + << validationLevel + << "options.validationAction" << validationAction))); } diff --git a/src/mongo/db/storage/mmap_v1/data_file.cpp b/src/mongo/db/storage/mmap_v1/data_file.cpp index 64fb1e64066..b5fc8bf4d6c 100644 --- a/src/mongo/db/storage/mmap_v1/data_file.cpp +++ b/src/mongo/db/storage/mmap_v1/data_file.cpp @@ -38,11 +38,11 @@ #include <utility> #include <vector> +#include "mongo/db/operation_context.h" #include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/storage/mmap_v1/durable_mapped_file.h" -#include "mongo/db/storage/mmap_v1/mmap_v1_options.h" -#include "mongo/db/operation_context.h" #include "mongo/db/storage/mmap_v1/file_allocator.h" +#include "mongo/db/storage/mmap_v1/mmap_v1_options.h" #include "mongo/util/log.h" namespace mongo { @@ -211,7 +211,9 @@ void DataFileHeader::init(OperationContext* txn, int fileno, int filelength, con massert(13640, str::stream() << "DataFileHeader looks corrupt at file open filelength:" - << filelength << " fileno:" << fileno, + << filelength + << " fileno:" + << fileno, filelength > 32768); // The writes done in this function must not be rolled back. If the containing diff --git a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp index 4fafae825ea..61e52b5dedf 100644 --- a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp +++ b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp @@ -34,8 +34,8 @@ #include "mongo/db/client.h" #include "mongo/db/commands/server_status_metric.h" -#include "mongo/db/service_context.h" #include "mongo/db/instance.h" +#include "mongo/db/service_context.h" #include "mongo/db/storage/mmap_v1/dur_journal.h" #include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp index db74bd99ea8..9bd44ba3ee3 100644 --- a/src/mongo/db/storage/mmap_v1/dur.cpp +++ b/src/mongo/db/storage/mmap_v1/dur.cpp @@ -488,10 +488,15 @@ void Stats::S::_asObj(BSONObjBuilder* builder) const { << _journaledBytes / (_uncompressedBytes + 1.0) << "commitsInWriteLock" << _commitsInWriteLock << "earlyCommits" << 0 << "timeMs" << BSON("dt" << _durationMillis << "prepLogBuffer" << (unsigned)(_prepLogBufferMicros / 1000) - << "writeToJournal" << (unsigned)(_writeToJournalMicros / 1000) - << "writeToDataFiles" << (unsigned)(_writeToDataFilesMicros / 1000) - << "remapPrivateView" << (unsigned)(_remapPrivateViewMicros / 1000) << "commits" - << (unsigned)(_commitsMicros / 1000) << "commitsInWriteLock" + << "writeToJournal" + << (unsigned)(_writeToJournalMicros / 1000) + << "writeToDataFiles" + << (unsigned)(_writeToDataFilesMicros / 1000) + << "remapPrivateView" + << (unsigned)(_remapPrivateViewMicros / 1000) + << "commits" + << (unsigned)(_commitsMicros / 1000) + << "commitsInWriteLock" << (unsigned)(_commitsInWriteLockMicros / 1000)); if (storageGlobalParams.journalCommitIntervalMs != 0) { diff --git a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp index aff01c1c7bf..6a8ca62f15d 100644 --- a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp @@ -37,8 +37,8 @@ #include <iostream> #include "mongo/db/storage/mmap_v1/dur.h" -#include "mongo/db/storage/mmap_v1/durable_mapped_file.h" #include "mongo/db/storage/mmap_v1/dur_stats.h" +#include "mongo/db/storage/mmap_v1/durable_mapped_file.h" #include "mongo/util/log.h" #include "mongo/util/stacktrace.h" diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp index 524085a87e9..91a6d6fd569 100644 --- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp @@ -40,13 +40,13 @@ #include "mongo/base/init.h" #include "mongo/config.h" #include "mongo/db/client.h" -#include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/aligned_builder.h" #include "mongo/db/storage/mmap_v1/compress.h" #include "mongo/db/storage/mmap_v1/dur_journalformat.h" #include "mongo/db/storage/mmap_v1/dur_journalimpl.h" #include "mongo/db/storage/mmap_v1/dur_stats.h" #include "mongo/db/storage/mmap_v1/logfile.h" +#include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" #include "mongo/db/storage/paths.h" #include "mongo/db/storage/storage_options.h" @@ -569,10 +569,10 @@ void LSNFile::set(unsigned long long x) { if something highly surprising, throws to abort */ unsigned long long LSNFile::get() { - uassert( - 13614, - str::stream() << "unexpected version number of lsn file in journal/ directory got: " << ver, - ver == 0); + uassert(13614, + str::stream() << "unexpected version number of lsn file in journal/ directory got: " + << ver, + ver == 0); if (~lsn != checkbytes) { log() << "lsnfile not valid. recovery will be from log start. lsn: " << hex << lsn << " checkbytes: " << hex << checkbytes << endl; diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp index dfd429d0713..15e7e994b38 100644 --- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp @@ -47,8 +47,8 @@ #include "mongo/db/storage/mmap_v1/dur_journal.h" #include "mongo/db/storage/mmap_v1/dur_journalformat.h" #include "mongo/db/storage/mmap_v1/dur_stats.h" -#include "mongo/db/storage/mmap_v1/durop.h" #include "mongo/db/storage/mmap_v1/durable_mapped_file.h" +#include "mongo/db/storage/mmap_v1/durop.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" #include "mongo/platform/strnlen.h" #include "mongo/util/bufreader.h" @@ -92,7 +92,7 @@ void removeJournalFiles(); boost::filesystem::path getJournalDir(); -struct ParsedJournalEntry {/*copyable*/ +struct ParsedJournalEntry { /*copyable*/ ParsedJournalEntry() : e(0) {} // relative path of database for the operation. @@ -121,7 +121,8 @@ static void getFiles(boost::filesystem::path dir, vector<boost::filesystem::path if (m.count(u)) { uasserted(13531, str::stream() << "unexpected files in journal directory " << dir.string() - << " : " << fileName); + << " : " + << fileName); } m.insert(pair<unsigned, boost::filesystem::path>(u, filepath)); } @@ -130,7 +131,8 @@ static void getFiles(boost::filesystem::path dir, vector<boost::filesystem::path if (i != m.begin() && m.count(i->first - 1) == 0) { uasserted(13532, str::stream() << "unexpected file in journal directory " << dir.string() - << " : " << boost::filesystem::path(i->second).leaf().string() + << " : " + << boost::filesystem::path(i->second).leaf().string() << " : can't find its preceding file"); } files.push_back(i->second); @@ -489,7 +491,8 @@ bool RecoveryJob::processFileBuffer(const void* p, unsigned len) { log() << "journal file version number mismatch got:" << hex << h._version << " expected:" << hex << (unsigned)JHeader::CurrentVersion << ". if you have just upgraded, recover with old version of mongod, " - "terminate cleanly, then upgrade." << endl; + "terminate cleanly, then upgrade." + << endl; // Not using JournalSectionCurruptException as we don't want to ignore // journal files on upgrade. uasserted(13536, str::stream() << "journal version number mismatch " << h._version); diff --git a/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp b/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp index 6eb2f82dcee..ff8add6cb91 100644 --- a/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp +++ b/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp @@ -46,8 +46,8 @@ #include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/storage/mmap_v1/dur_journalformat.h" #include "mongo/db/storage/storage_options.h" -#include "mongo/util/mongoutils/str.h" #include "mongo/util/log.h" +#include "mongo/util/mongoutils/str.h" #include "mongo/util/processinfo.h" using namespace mongoutils; diff --git a/src/mongo/db/storage/mmap_v1/durop.cpp b/src/mongo/db/storage/mmap_v1/durop.cpp index 0ea1949ad12..627d53df05d 100644 --- a/src/mongo/db/storage/mmap_v1/durop.cpp +++ b/src/mongo/db/storage/mmap_v1/durop.cpp @@ -39,9 +39,9 @@ #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/storage/mmap_v1/aligned_builder.h" #include "mongo/db/storage/mmap_v1/durable_mapped_file.h" +#include "mongo/db/storage/mmap_v1/file_allocator.h" #include "mongo/db/storage/mmap_v1/mmap_v1_engine.h" #include "mongo/util/file.h" -#include "mongo/db/storage/mmap_v1/file_allocator.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/storage/mmap_v1/durop.h b/src/mongo/db/storage/mmap_v1/durop.h index 50ddc33318a..98aaf8406c3 100644 --- a/src/mongo/db/storage/mmap_v1/durop.h +++ b/src/mongo/db/storage/mmap_v1/durop.h @@ -49,7 +49,7 @@ namespace dur { * * For each op we want to journal, we define a subclass. */ -class DurOp {/* copyable */ +class DurOp { /* copyable */ public: // @param opcode a sentinel value near max unsigned which uniquely identifies the operation. // @see dur::JEntry diff --git a/src/mongo/db/storage/mmap_v1/extent.cpp b/src/mongo/db/storage/mmap_v1/extent.cpp index 7b92551fa8a..fb134504f10 100644 --- a/src/mongo/db/storage/mmap_v1/extent.cpp +++ b/src/mongo/db/storage/mmap_v1/extent.cpp @@ -44,8 +44,14 @@ static_assert(sizeof(Extent) - 4 == 48 + 128, "sizeof(Extent) - 4 == 48 + 128"); BSONObj Extent::dump() const { return BSON("loc" << myLoc.toString() << "xnext" << xnext.toString() << "xprev" - << xprev.toString() << "nsdiag" << nsDiagnostic.toString() << "size" << length - << "firstRecord" << firstRecord.toString() << "lastRecord" + << xprev.toString() + << "nsdiag" + << nsDiagnostic.toString() + << "size" + << length + << "firstRecord" + << firstRecord.toString() + << "lastRecord" << lastRecord.toString()); } diff --git a/src/mongo/db/storage/mmap_v1/file_allocator.cpp b/src/mongo/db/storage/mmap_v1/file_allocator.cpp index 0be9d157481..7a630ea3118 100644 --- a/src/mongo/db/storage/mmap_v1/file_allocator.cpp +++ b/src/mongo/db/storage/mmap_v1/file_allocator.cpp @@ -38,8 +38,8 @@ #include <fcntl.h> #if defined(__FreeBSD__) -#include <sys/param.h> #include <sys/mount.h> +#include <sys/param.h> #endif #if defined(__linux__) diff --git a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp index a67ecd85f3d..94beefc55ae 100644 --- a/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp +++ b/src/mongo/db/storage/mmap_v1/journal_latency_test_cmd.cpp @@ -44,10 +44,10 @@ #include "mongo/db/index/index_descriptor.h" #include "mongo/db/jsobj.h" #include "mongo/db/query/internal_plans.h" -#include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/mmap_v1/aligned_builder.h" #include "mongo/db/storage/mmap_v1/logfile.h" #include "mongo/db/storage/paths.h" +#include "mongo/db/storage/storage_options.h" #include "mongo/scripting/engine.h" #include "mongo/util/background.h" #include "mongo/util/timer.h" diff --git a/src/mongo/db/storage/mmap_v1/logfile.cpp b/src/mongo/db/storage/mmap_v1/logfile.cpp index 6124ce51248..ddc66b8ce2f 100644 --- a/src/mongo/db/storage/mmap_v1/logfile.cpp +++ b/src/mongo/db/storage/mmap_v1/logfile.cpp @@ -123,7 +123,9 @@ void LogFile::synchronousAppend(const void* _buf, size_t _len) { else uasserted(13517, str::stream() << "error appending to file " << _name << ' ' << _len << ' ' - << toWrite << ' ' << errnoWithDescription(e)); + << toWrite + << ' ' + << errnoWithDescription(e)); } else { dassert(written == toWrite); } @@ -137,10 +139,10 @@ void LogFile::synchronousAppend(const void* _buf, size_t _len) { /// posix -#include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/types.h> #ifdef __linux__ #include <linux/fs.h> diff --git a/src/mongo/db/storage/mmap_v1/mmap.cpp b/src/mongo/db/storage/mmap_v1/mmap.cpp index 90cda10c57e..82d62aba8e9 100644 --- a/src/mongo/db/storage/mmap_v1/mmap.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap.cpp @@ -103,7 +103,9 @@ void* MemoryMappedFile::map(const char* filename) { } catch (boost::filesystem::filesystem_error& e) { uasserted(15922, mongoutils::str::stream() << "couldn't get file length when opening mapping " - << filename << ' ' << e.what()); + << filename + << ' ' + << e.what()); } return map(filename, l); } diff --git a/src/mongo/db/storage/mmap_v1/mmap_posix.cpp b/src/mongo/db/storage/mmap_v1/mmap_posix.cpp index a5fdc361694..382860f3556 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_posix.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_posix.cpp @@ -37,10 +37,10 @@ #include <sys/stat.h> #include <sys/types.h> -#include "mongo/platform/atomic_word.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/storage/mmap_v1/file_allocator.h" #include "mongo/db/storage/mmap_v1/mmap.h" +#include "mongo/platform/atomic_word.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" #include "mongo/util/processinfo.h" @@ -162,7 +162,8 @@ void* MemoryMappedFile::map(const char* filename, unsigned long long& length) { unsigned long long filelen = lseek(fd, 0, SEEK_END); uassert(10447, str::stream() << "map file alloc failed, wanted: " << length << " filelen: " << filelen - << ' ' << sizeof(size_t), + << ' ' + << sizeof(size_t), filelen == length); lseek(fd, 0, SEEK_SET); @@ -174,7 +175,8 @@ void* MemoryMappedFile::map(const char* filename, unsigned long long& length) { if (errno == ENOMEM) { if (sizeof(void*) == 4) error() << "mmap failed with out of memory. You are using a 32-bit build and " - "probably need to upgrade to 64" << endl; + "probably need to upgrade to 64" + << endl; else error() << "mmap failed with out of memory. (64 bit build)" << endl; } @@ -202,7 +204,8 @@ void* MemoryMappedFile::createPrivateMap() { if (errno == ENOMEM) { if (sizeof(void*) == 4) { error() << "mmap private failed with out of memory. You are using a 32-bit build " - "and probably need to upgrade to 64" << endl; + "and probably need to upgrade to 64" + << endl; } else { error() << "mmap private failed with out of memory. (64 bit build)" << endl; } diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp index 83fda94c14d..37f96019430 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp @@ -37,10 +37,10 @@ #include "mongo/db/catalog/index_catalog_entry.h" #include "mongo/db/index/2d_access_method.h" #include "mongo/db/index/btree_access_method.h" -#include "mongo/db/index/index_access_method.h" #include "mongo/db/index/fts_access_method.h" #include "mongo/db/index/hash_access_method.h" #include "mongo/db/index/haystack_access_method.h" +#include "mongo/db/index/index_access_method.h" #include "mongo/db/index/s2_access_method.h" #include "mongo/db/operation_context.h" #include "mongo/db/record_id.h" diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h index 3ecb76b9ecb..d02f7da17b0 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h @@ -34,8 +34,8 @@ #include "mongo/base/status.h" #include "mongo/base/string_data.h" #include "mongo/db/catalog/database_catalog_entry.h" -#include "mongo/db/storage/mmap_v1/catalog/namespace_index.h" #include "mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.h" +#include "mongo/db/storage/mmap_v1/catalog/namespace_index.h" #include "mongo/db/storage/mmap_v1/mmap_v1_extent_manager.h" namespace mongo { diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp index b83e72dc580..e4f4b0340de 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp @@ -32,22 +32,22 @@ #include "mongo/db/storage/mmap_v1/mmap_v1_engine.h" -#include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> +#include <boost/filesystem/path.hpp> #include <fstream> #include "mongo/db/mongod_options.h" -#include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/data_file_sync.h" #include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/storage/mmap_v1/dur_journal.h" #include "mongo/db/storage/mmap_v1/dur_recover.h" #include "mongo/db/storage/mmap_v1/dur_recovery_unit.h" +#include "mongo/db/storage/mmap_v1/file_allocator.h" +#include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" #include "mongo/db/storage/storage_engine_lock_file.h" #include "mongo/db/storage/storage_options.h" -#include "mongo/db/storage/mmap_v1/file_allocator.h" #include "mongo/util/clock_source.h" #include "mongo/util/log.h" @@ -132,9 +132,11 @@ void checkForUncleanShutdown(MMAPV1Engine* storageEngine, if (!storageGlobalParams.dur && dur::haveJournalFiles()) { log() << "**************" << endl; log() << "Error: journal files are present in journal directory, yet starting without " - "journaling enabled." << endl; + "journaling enabled." + << endl; log() << "It is recommended that you start with journaling enabled so that recovery may " - "occur." << endl; + "occur." + << endl; log() << "**************" << endl; uasserted(13597, "can't start without --journal enabled when journal/ files are present"); } @@ -149,11 +151,14 @@ void checkForUncleanShutdown(MMAPV1Engine* storageEngine, if (!storageGlobalParams.dur && dur::haveJournalFiles()) { log() << "**************" << endl; log() << "Error: journal files are present in journal directory, yet starting without " - "--journal enabled." << endl; + "--journal enabled." + << endl; log() << "It is recommended that you start with journaling enabled so that recovery may " - "occur." << endl; + "occur." + << endl; log() << "Alternatively (not recommended), you can backup everything, then delete the " - "journal files, and run --repair" << endl; + "journal files, and run --repair" + << endl; log() << "**************" << endl; uasserted(13618, "can't start without --journal enabled when journal/ files are present"); } diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.h b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.h index 347b6e02d17..80a20ecbb0c 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.h +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.h @@ -32,8 +32,8 @@ #include <map> -#include "mongo/db/storage/mmap_v1/record_access_tracker.h" #include "mongo/db/storage/mmap_v1/extent_manager.h" +#include "mongo/db/storage/mmap_v1/record_access_tracker.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/stdx/mutex.h" diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp index 2076ca868b1..3fcf1205646 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp @@ -37,17 +37,17 @@ #include "mongo/base/counter.h" #include "mongo/db/audit.h" #include "mongo/db/client.h" +#include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" -#include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/storage/mmap_v1/data_file.h" -#include "mongo/db/storage/mmap_v1/record.h" +#include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/storage/mmap_v1/extent.h" #include "mongo/db/storage/mmap_v1/extent_manager.h" #include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/mmap_v1_engine.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" +#include "mongo/db/storage/mmap_v1/record.h" #include "mongo/db/storage/record_fetcher.h" -#include "mongo/db/operation_context.h" #include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/file.h" diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp index ab1bd378fea..19ec450e1ac 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp @@ -29,8 +29,8 @@ #include "mongo/platform/basic.h" -#include "mongo/db/service_context.h" #include "mongo/db/json.h" +#include "mongo/db/service_context.h" #include "mongo/db/storage/storage_engine_metadata.h" #include "mongo/db/storage/storage_options.h" #include "mongo/unittest/unittest.h" @@ -85,9 +85,13 @@ 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); + << ErrorCodes::errorString(expectedCode) + << " but got " + << status.toString() + << " instead. metadataOptions: " + << metadataOptions + << "; directoryPerDB: " + << directoryPerDB); } } diff --git a/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp b/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp index 535bc3fc447..f9725f6a104 100644 --- a/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp +++ b/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp @@ -36,8 +36,8 @@ #include "mongo/config.h" #include "mongo/db/storage/mmap_v1/record.h" #include "mongo/platform/bits.h" -#include "mongo/util/concurrency/threadlocal.h" #include "mongo/util/clock_source.h" +#include "mongo/util/concurrency/threadlocal.h" #include "mongo/util/debug_util.h" #include "mongo/util/net/listen.h" #include "mongo/util/processinfo.h" diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp index c0f2796ee05..7950922afd7 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp @@ -572,17 +572,17 @@ Status RecordStoreV1Base::validate(OperationContext* txn, if (_details->firstExtent(txn).isNull()) output->append("firstExtent", "null"); else - output->append("firstExtent", - str::stream() - << _details->firstExtent(txn).toString() << " ns:" - << _getExtent(txn, _details->firstExtent(txn))->nsDiagnostic.toString()); + output->append( + "firstExtent", + str::stream() << _details->firstExtent(txn).toString() << " ns:" + << _getExtent(txn, _details->firstExtent(txn))->nsDiagnostic.toString()); if (_details->lastExtent(txn).isNull()) output->append("lastExtent", "null"); else - output->append("lastExtent", - str::stream() - << _details->lastExtent(txn).toString() << " ns:" - << _getExtent(txn, _details->lastExtent(txn))->nsDiagnostic.toString()); + output->append( + "lastExtent", + str::stream() << _details->lastExtent(txn).toString() << " ns:" + << _getExtent(txn, _details->lastExtent(txn))->nsDiagnostic.toString()); // 22222222222222222222222222 { // validate extent basics @@ -784,9 +784,12 @@ Status RecordStoreV1Base::validate(OperationContext* txn, break; } - string err(str::stream() - << "bad pointer in deleted record list: " << loc.toString() - << " bucket: " << i << " k: " << k); + string err(str::stream() << "bad pointer in deleted record list: " + << loc.toString() + << " bucket: " + << i + << " k: " + << k); results->errors.push_back(err); results->valid = false; break; diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h index 53b86129e13..489f084fffe 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h @@ -30,8 +30,8 @@ #pragma once -#include "mongo/util/concurrency/spin_lock.h" #include "mongo/platform/unordered_set.h" +#include "mongo/util/concurrency/spin_lock.h" #include "mongo/db/storage/mmap_v1/diskloc.h" #include "mongo/db/storage/record_store.h" diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp index 1c678074ace..7dab4124df6 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp @@ -101,11 +101,12 @@ StatusWith<DiskLoc> CappedRecordStoreV1::allocRecord(OperationContext* txn, // since we have to iterate all the extents (for now) to get // storage size if (lenToAlloc > storageSize(txn)) { - return StatusWith<DiskLoc>(ErrorCodes::DocTooLargeForCapped, - mongoutils::str::stream() - << "document is larger than capped size " << lenToAlloc - << " > " << storageSize(txn), - 16328); + return StatusWith<DiskLoc>( + ErrorCodes::DocTooLargeForCapped, + mongoutils::str::stream() << "document is larger than capped size " << lenToAlloc + << " > " + << storageSize(txn), + 16328); } } DiskLoc loc; @@ -161,8 +162,10 @@ StatusWith<DiskLoc> CappedRecordStoreV1::allocRecord(OperationContext* txn, return StatusWith<DiskLoc>(ErrorCodes::DocTooLargeForCapped, str::stream() << "document doesn't fit in capped collection." - << " size: " << lenToAlloc - << " storageSize:" << storageSize(txn), + << " size: " + << lenToAlloc + << " storageSize:" + << storageSize(txn), 28575); } continue; diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped_test.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_capped_test.cpp index 5f20ba62385..2bde7396e44 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped_test.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped_test.cpp @@ -32,8 +32,8 @@ #include "mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.h" #include "mongo/db/operation_context_noop.h" -#include "mongo/db/storage/mmap_v1/record.h" #include "mongo/db/storage/mmap_v1/extent.h" +#include "mongo/db/storage/mmap_v1/record.h" #include "mongo/db/storage/mmap_v1/record_store_v1_test_help.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h index a45cb1ca9e7..b65782cd27b 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h @@ -30,8 +30,8 @@ #include <set> -#include "mongo/db/storage/record_store.h" #include "mongo/db/storage/mmap_v1/record_store_v1_base.h" +#include "mongo/db/storage/record_store.h" namespace mongo { diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_simple.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_simple.cpp index aa29b7f0174..51baec1cd29 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_simple.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_simple.cpp @@ -37,17 +37,17 @@ #include "mongo/base/counter.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/client.h" -#include "mongo/db/curop.h" #include "mongo/db/commands/server_status_metric.h" +#include "mongo/db/curop.h" +#include "mongo/db/operation_context.h" #include "mongo/db/storage/mmap_v1/extent.h" #include "mongo/db/storage/mmap_v1/extent_manager.h" #include "mongo/db/storage/mmap_v1/record.h" -#include "mongo/db/operation_context.h" #include "mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.h" #include "mongo/stdx/memory.h" #include "mongo/util/log.h" -#include "mongo/util/progress_meter.h" #include "mongo/util/mongoutils/str.h" +#include "mongo/util/progress_meter.h" #include "mongo/util/timer.h" #include "mongo/util/touch_pages.h" @@ -152,7 +152,8 @@ StatusWith<DiskLoc> SimpleRecordStoreV1::allocRecord(OperationContext* txn, return StatusWith<DiskLoc>( ErrorCodes::InvalidLength, str::stream() << "Attempting to allocate a record larger than maximum size: " - << lengthWithHeaders << " > 16.5MB"); + << lengthWithHeaders + << " > 16.5MB"); } DiskLoc loc = _allocFromExistingExtents(txn, lengthWithHeaders); diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp index 234acf8695e..0c56ef9e6f1 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp @@ -32,8 +32,8 @@ #include "mongo/db/storage/mmap_v1/record_store_v1_test_help.h" -#include <boost/next_prior.hpp> #include <algorithm> +#include <boost/next_prior.hpp> #include <map> #include <set> #include <vector> diff --git a/src/mongo/db/storage/mmap_v1/repair_database.cpp b/src/mongo/db/storage/mmap_v1/repair_database.cpp index b73d346a708..5587e4c2b9a 100644 --- a/src/mongo/db/storage/mmap_v1/repair_database.cpp +++ b/src/mongo/db/storage/mmap_v1/repair_database.cpp @@ -45,11 +45,11 @@ #include "mongo/db/db_raii.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/storage/mmap_v1/dur.h" +#include "mongo/db/storage/mmap_v1/file_allocator.h" #include "mongo/db/storage/mmap_v1/mmap.h" #include "mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" #include "mongo/util/file.h" -#include "mongo/db/storage/mmap_v1/file_allocator.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -95,8 +95,7 @@ void _deleteDataFiles(const std::string& database) { virtual const char* op() const { return "remove"; } - } - deleter; + } deleter; _applyOpToDataFiles(database, deleter, true); } @@ -290,9 +289,11 @@ Status MMAPV1Engine::repairDatabase(OperationContext* txn, if (freeSize > -1 && freeSize < totalSize) { return Status(ErrorCodes::OutOfDiskSpace, - str::stream() - << "Cannot repair database " << dbName << " having size: " << totalSize - << " (bytes) because free disk space is: " << freeSize << " (bytes)"); + str::stream() << "Cannot repair database " << dbName << " having size: " + << totalSize + << " (bytes) because free disk space is: " + << freeSize + << " (bytes)"); } txn->checkForInterrupt(); diff --git a/src/mongo/db/storage/paths.cpp b/src/mongo/db/storage/paths.cpp index 2f6fb4d4a77..b9f05ad17d1 100644 --- a/src/mongo/db/storage/paths.cpp +++ b/src/mongo/db/storage/paths.cpp @@ -84,8 +84,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; @@ -102,8 +102,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); } } diff --git a/src/mongo/db/storage/paths.h b/src/mongo/db/storage/paths.h index 7f9a479f416..384b6459419 100644 --- a/src/mongo/db/storage/paths.h +++ b/src/mongo/db/storage/paths.h @@ -31,9 +31,9 @@ #pragma once #include <boost/filesystem/path.hpp> -#include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> +#include <sys/stat.h> +#include <sys/types.h> #include "mongo/util/mongoutils/str.h" 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 21127d5342f..195f9e0a184 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 @@ -41,7 +41,7 @@ void testSetEndPosition_Next_Forward(bool unique, bool inclusive) { auto sorted = harnessHelper->newSortedDataInterface( unique, { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, {key5, loc1}, + {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, {key5, loc1}, }); // Dup key on end point. Illegal for unique indexes. @@ -80,7 +80,7 @@ void testSetEndPosition_Next_Reverse(bool unique, bool inclusive) { auto sorted = harnessHelper->newSortedDataInterface( unique, { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, {key5, loc1}, + {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, {key5, loc1}, }); // Dup key on end point. Illegal for unique indexes. @@ -119,10 +119,10 @@ void testSetEndPosition_Seek_Forward(bool unique, bool inclusive) { auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, - // No key2 - {key3, loc1}, - {key4, loc1}, + {key1, loc1}, + // No key2 + {key3, loc1}, + {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get()); @@ -167,10 +167,10 @@ void testSetEndPosition_Seek_Reverse(bool unique, bool inclusive) { auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, - {key2, loc1}, - // No key3 - {key4, loc1}, + {key1, loc1}, + {key2, loc1}, + // No key3 + {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), false); @@ -217,7 +217,7 @@ void testSetEndPosition_Restore_Forward(bool unique) { auto sorted = harnessHelper->newSortedDataInterface( unique, { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, + {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get()); @@ -234,7 +234,7 @@ void testSetEndPosition_Restore_Forward(bool unique) { removeFromIndex(opCtx, sorted, { - {key2, loc1}, {key3, loc1}, + {key2, loc1}, {key3, loc1}, }); cursor->restore(); @@ -253,7 +253,7 @@ void testSetEndPosition_Restore_Reverse(bool unique) { auto sorted = harnessHelper->newSortedDataInterface( unique, { - {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, + {key1, loc1}, {key2, loc1}, {key3, loc1}, {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), false); @@ -270,7 +270,7 @@ void testSetEndPosition_Restore_Reverse(bool unique) { removeFromIndex(opCtx, sorted, { - {key2, loc1}, {key3, loc1}, + {key2, loc1}, {key3, loc1}, }); cursor->restore(); @@ -293,7 +293,7 @@ void testSetEndPosition_RestoreEndCursor_Forward(bool unique) { auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, {key4, loc1}, + {key1, loc1}, {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get()); @@ -306,8 +306,8 @@ void testSetEndPosition_RestoreEndCursor_Forward(bool unique) { insertToIndex(opCtx, sorted, { - {key2, loc1}, // in range - {key3, loc1}, // out of range + {key2, loc1}, // in range + {key3, loc1}, // out of range }); cursor->restore(); @@ -327,7 +327,7 @@ void testSetEndPosition_RestoreEndCursor_Reverse(bool unique) { auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, {key4, loc1}, + {key1, loc1}, {key4, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), false); @@ -339,8 +339,8 @@ void testSetEndPosition_RestoreEndCursor_Reverse(bool unique) { insertToIndex(opCtx, sorted, { - {key2, loc1}, // in range - {key3, loc1}, // out of range + {key2, loc1}, // in range + {key3, loc1}, // out of range }); cursor->restore(); // must restore end cursor even with saveUnpositioned(). @@ -360,10 +360,11 @@ TEST(SortedDataInterface, SetEndPosition_RestoreEndCursor_Reverse_Unique) { void testSetEndPosition_Empty_Forward(bool unique, bool inclusive) { auto harnessHelper = newHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface(unique, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = + harnessHelper->newSortedDataInterface(unique, + { + {key1, loc1}, {key2, loc1}, {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get()); cursor->setEndPosition(BSONObj(), inclusive); @@ -389,10 +390,11 @@ TEST(SortedDataInterface, SetEndPosition_Empty_Forward_Standard_Exclusive) { void testSetEndPosition_Empty_Reverse(bool unique, bool inclusive) { auto harnessHelper = newHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface(unique, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = + harnessHelper->newSortedDataInterface(unique, + { + {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 d900dbdc1d7..63c3bf6bc44 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 @@ -291,7 +291,7 @@ void testSaveAndRestorePositionSeesNewInserts(bool forward, bool unique) { auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, {key3, loc1}, + {key1, loc1}, {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -325,7 +325,7 @@ void testSaveAndRestorePositionSeesNewInsertsAfterRemove(bool forward, bool uniq auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, {key3, loc1}, + {key1, loc1}, {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -365,7 +365,7 @@ void testSaveAndRestorePositionSeesNewInsertsAfterEOF(bool forward, bool unique) auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(false, { - {key1, loc1}, + {key1, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -403,10 +403,11 @@ TEST(SortedDataInterface, SaveAndRestorePositionSeesNewInsertsAfterEOF_Reverse_S TEST(SortedDataInterface, SaveAndRestorePositionStandardIndexConsidersRecordId_Forward) { auto harnessHelper = newHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface(/*isUnique*/ false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = + harnessHelper->newSortedDataInterface(/*isUnique*/ false, + { + {key1, loc1}, {key2, loc1}, {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get()); @@ -482,10 +483,11 @@ TEST(SortedDataInterface, SaveAndRestorePositionUniqueIndexWontReturnDupKeys_For TEST(SortedDataInterface, SaveAndRestorePositionStandardIndexConsidersRecordId_Reverse) { auto harnessHelper = newHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface(/*isUnique*/ false, - { - {key0, loc1}, {key1, loc1}, {key2, loc2}, - }); + auto sorted = + harnessHelper->newSortedDataInterface(/*isUnique*/ false, + { + {key0, loc1}, {key1, loc1}, {key2, loc2}, + }); auto cursor = sorted->newCursor(opCtx.get(), false); @@ -561,10 +563,11 @@ TEST(SortedDataInterface, SaveAndRestorePositionUniqueIndexWontReturnDupKeys_Rev TEST(SortedDataInterface, SaveUnpositionedAndRestore) { auto harnessHelper = newHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface(false, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = + harnessHelper->newSortedDataInterface(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 c767dbee859..ae22f28c52b 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 @@ -38,10 +38,11 @@ namespace mongo { void testSeekExact_Hit(bool unique, bool forward) { auto harnessHelper = newHarnessHelper(); auto opCtx = harnessHelper->newOperationContext(); - auto sorted = harnessHelper->newSortedDataInterface(unique, - { - {key1, loc1}, {key2, loc1}, {key3, loc1}, - }); + auto sorted = + harnessHelper->newSortedDataInterface(unique, + { + {key1, loc1}, {key2, loc1}, {key3, loc1}, + }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -71,9 +72,9 @@ void testSeekExact_Miss(bool unique, bool forward) { auto opCtx = harnessHelper->newOperationContext(); auto sorted = harnessHelper->newSortedDataInterface(unique, { - {key1, loc1}, - // No key2. - {key3, loc1}, + {key1, loc1}, + // No key2. + {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get(), forward); @@ -105,7 +106,7 @@ TEST(SortedDataInterface, SeekExact_HitWithDups_Forward) { auto sorted = harnessHelper->newSortedDataInterface( false, { - {key1, loc1}, {key2, loc1}, {key2, loc2}, {key3, loc1}, + {key1, loc1}, {key2, loc1}, {key2, loc2}, {key3, loc1}, }); auto cursor = sorted->newCursor(opCtx.get()); @@ -124,7 +125,7 @@ TEST(SortedDataInterface, SeekExact_HitWithDups_Reverse) { auto sorted = harnessHelper->newSortedDataInterface( 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/sorted_data_interface_test_harness.cpp b/src/mongo/db/storage/sorted_data_interface_test_harness.cpp index 8506af3e43e..40ce99a6911 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_harness.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_harness.cpp @@ -529,10 +529,10 @@ TEST(SortedDataInterface, Locate4) { auto harnessHelper = newHarnessHelper(); auto sorted = harnessHelper->newSortedDataInterface(false, { - {BSON("" << 1), RecordId(1, 2)}, - {BSON("" << 1), RecordId(1, 4)}, - {BSON("" << 1), RecordId(1, 6)}, - {BSON("" << 2), RecordId(1, 8)}, + {BSON("" << 1), RecordId(1, 2)}, + {BSON("" << 1), RecordId(1, 4)}, + {BSON("" << 1), RecordId(1, 6)}, + {BSON("" << 2), RecordId(1, 8)}, }); { 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 de9e0bb97aa..ab5f12484ca 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp @@ -35,11 +35,11 @@ #include <boost/filesystem.hpp> #include <fcntl.h> #include <ostream> +#include <sstream> #include <sys/file.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#include <sstream> #include "mongo/db/storage/paths.h" #include "mongo/platform/process_id.h" @@ -93,7 +93,8 @@ 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 @@ -151,7 +152,9 @@ Status StorageEngineLockFile::writePid() { int errorcode = errno; return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id to file (ftruncate failed): " - << _filespec << ' ' << errnoWithDescription(errorcode)); + << _filespec + << ' ' + << errnoWithDescription(errorcode)); } ProcessId pid = ProcessId::getCurrent(); @@ -163,20 +166,26 @@ Status StorageEngineLockFile::writePid() { int errorcode = errno; return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id " << pid.toString() - << " to file: " << _filespec << ' ' + << " to file: " + << _filespec + << ' ' << errnoWithDescription(errorcode)); } else if (bytesWritten == 0) { return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id " << pid.toString() - << " to file: " << _filespec << " no data written."); + << " to file: " + << _filespec + << " no data written."); } if (::fsync(_lockFileHandle->_fd)) { int errorcode = errno; return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id " << pid.toString() - << " 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 ee77676291a..e628c7a7ba2 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_test.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_test.cpp @@ -38,9 +38,9 @@ #include "mongo/unittest/unittest.h" #ifndef _WIN32 -#include <unistd.h> -#include <sys/types.h> #include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> #endif namespace { 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 dfac9d024bd..0016f8f0873 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp @@ -109,7 +109,8 @@ 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 = CreateFileA(_filespec.c_str(), @@ -170,12 +171,16 @@ Status StorageEngineLockFile::writePid() { int errorcode = GetLastError(); return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id " << pid.toString() - << " to file: " << _filespec << ' ' + << " to file: " + << _filespec + << ' ' << errnoWithDescription(errorcode)); } else if (bytesWritten == 0) { return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unable to write process id " << pid.toString() - << " to file: " << _filespec << " no data written."); + << " to file: " + << _filespec + << " no data written."); } ::FlushFileBuffers(_lockFileHandle->_handle); diff --git a/src/mongo/db/storage/storage_engine_metadata.cpp b/src/mongo/db/storage/storage_engine_metadata.cpp index 1a281e171e6..144ba7c838b 100644 --- a/src/mongo/db/storage/storage_engine_metadata.cpp +++ b/src/mongo/db/storage/storage_engine_metadata.cpp @@ -32,9 +32,9 @@ #include "mongo/db/storage/storage_engine_metadata.h" -#include <cstdio> #include <boost/filesystem.hpp> #include <boost/optional.hpp> +#include <cstdio> #include <fstream> #include <limits> #include <ostream> @@ -158,16 +158,17 @@ Status StorageEngineMetadata::read() { } catch (const std::exception& ex) { return Status(ErrorCodes::FileStreamFailed, str::stream() << "Unexpected error reading BSON data from " << filename - << ": " << ex.what()); + << ": " + << ex.what()); } BSONObj obj; try { obj = BSONObj(&buffer[0]); } catch (DBException& ex) { - return Status(ErrorCodes::FailedToParse, - str::stream() << "Failed to convert data in " << filename - << " to BSON: " << ex.what()); + return Status( + ErrorCodes::FailedToParse, + str::stream() << "Failed to convert data in " << filename << " to BSON: " << ex.what()); } // Validate 'storage.engine' field. @@ -235,8 +236,11 @@ 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(); @@ -252,7 +256,9 @@ Status StorageEngineMetadata::validateStorageEngineOption<bool>(StringData field 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(); @@ -260,9 +266,12 @@ Status StorageEngineMetadata::validateStorageEngineOption<bool>(StringData field 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 0f0326a2161..466c0016037 100644 --- a/src/mongo/db/storage/storage_engine_metadata_test.cpp +++ b/src/mongo/db/storage/storage_engine_metadata_test.cpp @@ -36,8 +36,8 @@ #include <ostream> #include "mongo/bson/bsonobj.h" -#include "mongo/db/storage/storage_engine_metadata.h" #include "mongo/db/json.h" +#include "mongo/db/storage/storage_engine_metadata.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/storage/storage_init.cpp b/src/mongo/db/storage/storage_init.cpp index 16cffe81ae9..0af1b78a602 100644 --- a/src/mongo/db/storage/storage_init.cpp +++ b/src/mongo/db/storage/storage_init.cpp @@ -33,8 +33,8 @@ #include "mongo/db/client.h" #include "mongo/db/commands/server_status.h" #include "mongo/db/operation_context.h" -#include "mongo/db/storage/storage_engine.h" #include "mongo/db/service_context.h" +#include "mongo/db/storage/storage_engine.h" #include "mongo/db/storage/storage_options.h" namespace mongo { @@ -55,8 +55,10 @@ public: virtual BSONObj generateSection(OperationContext* txn, const BSONElement& configElement) const { auto engine = txn->getClient()->getServiceContext()->getGlobalStorageEngine(); return BSON("name" << storageGlobalParams.engine << "supportsCommittedReads" - << bool(engine->getSnapshotManager()) << "readOnly" - << storageGlobalParams.readOnly << "persistent" + << bool(engine->getSnapshotManager()) + << "readOnly" + << storageGlobalParams.readOnly + << "persistent" << !engine->isEphemeral()); } diff --git a/src/mongo/db/storage/storage_options.cpp b/src/mongo/db/storage/storage_options.cpp index 9ea45c706b5..8b031ff7a59 100644 --- a/src/mongo/db/storage/storage_options.cpp +++ b/src/mongo/db/storage/storage_options.cpp @@ -85,7 +85,8 @@ public: return Status(ErrorCodes::BadValue, str::stream() << "journalCommitInterval must be between 1 and " << StorageGlobalParams::kMaxJournalCommitIntervalMs - << ", but attempted to set to: " << potentialNewValue); + << ", but attempted to set to: " + << potentialNewValue); } return Status::OK(); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp index fd16df07dcb..0de33e67ce5 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp @@ -49,55 +49,63 @@ Status WiredTigerGlobalOptions::add(moe::OptionSection* options) { moe::Double, "maximum amount of memory to allocate for cache; " "defaults to 1/2 of physical RAM"); - wiredTigerOptions.addOptionChaining( - "storage.wiredTiger.engineConfig.statisticsLogDelaySecs", - "wiredTigerStatisticsLogDelaySecs", - moe::Int, - "seconds to wait between each write to a statistics file in the dbpath; " - "0 means do not log statistics") + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.engineConfig.statisticsLogDelaySecs", + "wiredTigerStatisticsLogDelaySecs", + moe::Int, + "seconds to wait between each write to a statistics file in the dbpath; " + "0 means do not log statistics") .validRange(0, 100000) .setDefault(moe::Value(0)); - wiredTigerOptions.addOptionChaining("storage.wiredTiger.engineConfig.journalCompressor", - "wiredTigerJournalCompressor", - moe::String, - "use a compressor for log records [none|snappy|zlib]") + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.engineConfig.journalCompressor", + "wiredTigerJournalCompressor", + moe::String, + "use a compressor for log records [none|snappy|zlib]") .format("(:?none)|(:?snappy)|(:?zlib)", "(none/snappy/zlib)") .setDefault(moe::Value(std::string("snappy"))); wiredTigerOptions.addOptionChaining("storage.wiredTiger.engineConfig.directoryForIndexes", "wiredTigerDirectoryForIndexes", moe::Switch, "Put indexes and data in different directories"); - wiredTigerOptions.addOptionChaining("storage.wiredTiger.engineConfig.configString", - "wiredTigerEngineConfigString", - moe::String, - "WiredTiger storage engine custom " - "configuration settings").hidden(); + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.engineConfig.configString", + "wiredTigerEngineConfigString", + moe::String, + "WiredTiger storage engine custom " + "configuration settings") + .hidden(); // WiredTiger collection options - wiredTigerOptions.addOptionChaining("storage.wiredTiger.collectionConfig.blockCompressor", - "wiredTigerCollectionBlockCompressor", - moe::String, - "block compression algorithm for collection data " - "[none|snappy|zlib]") + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.collectionConfig.blockCompressor", + "wiredTigerCollectionBlockCompressor", + moe::String, + "block compression algorithm for collection data " + "[none|snappy|zlib]") .format("(:?none)|(:?snappy)|(:?zlib)", "(none/snappy/zlib)") .setDefault(moe::Value(std::string("snappy"))); - wiredTigerOptions.addOptionChaining("storage.wiredTiger.collectionConfig.configString", - "wiredTigerCollectionConfigString", - moe::String, - "WiredTiger custom collection configuration settings") + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.collectionConfig.configString", + "wiredTigerCollectionConfigString", + moe::String, + "WiredTiger custom collection configuration settings") .hidden(); // WiredTiger index options - wiredTigerOptions.addOptionChaining("storage.wiredTiger.indexConfig.prefixCompression", - "wiredTigerIndexPrefixCompression", - moe::Bool, - "use prefix compression on row-store leaf pages") + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.indexConfig.prefixCompression", + "wiredTigerIndexPrefixCompression", + moe::Bool, + "use prefix compression on row-store leaf pages") .setDefault(moe::Value(true)); - wiredTigerOptions.addOptionChaining("storage.wiredTiger.indexConfig.configString", - "wiredTigerIndexConfigString", - moe::String, - "WiredTiger custom index configuration settings").hidden(); + wiredTigerOptions + .addOptionChaining("storage.wiredTiger.indexConfig.configString", + "wiredTigerIndexConfigString", + moe::String, + "WiredTiger custom index configuration settings") + .hidden(); return options->addSection(wiredTigerOptions); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp index 7bc63bc7903..28b7f7d28fb 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp @@ -37,22 +37,22 @@ #include <set> #include "mongo/base/checked_cast.h" -#include "mongo/db/json.h" #include "mongo/db/catalog/index_catalog_entry.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/index/index_descriptor.h" +#include "mongo/db/json.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/key_string.h" +#include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.h" #include "mongo/db/storage/wiredtiger/wiredtiger_global_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/db/storage/storage_options.h" #include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" -#include "mongo/util/hex.h" #include "mongo/util/fail_point.h" +#include "mongo/util/hex.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" @@ -60,7 +60,7 @@ #if TRACING_ENABLED #define TRACE_CURSOR log() << "WT index (" << (const void*)&_idx << ") " -#define TRACE_INDEX log() << "WT index (" << (const void*) this << ") " +#define TRACE_INDEX log() << "WT index (" << (const void*)this << ") " #else #define TRACE_CURSOR \ if (0) \ @@ -141,7 +141,8 @@ 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()); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h index c2d6c70cf12..ee729502550 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h @@ -31,8 +31,8 @@ #include <wiredtiger.h> #include "mongo/base/status_with.h" -#include "mongo/db/storage/key_string.h" #include "mongo/db/storage/index_entry_comparison.h" +#include "mongo/db/storage/key_string.h" #include "mongo/db/storage/sorted_data_interface.h" #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp index 7cd4a095699..4173f8ed455 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp @@ -71,7 +71,8 @@ public: BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << "testIndex" - << "ns" << ns); + << "ns" + << ns); IndexDescriptor desc(NULL, "", spec); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp index fc60f082ea6..2d4db8a3123 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp @@ -33,20 +33,20 @@ #include "mongo/base/init.h" #include "mongo/db/catalog/collection_options.h" -#include "mongo/db/service_context_d.h" -#include "mongo/db/service_context.h" #include "mongo/db/jsobj.h" +#include "mongo/db/service_context.h" +#include "mongo/db/service_context_d.h" #include "mongo/db/storage/kv/kv_storage_engine.h" #include "mongo/db/storage/storage_engine_lock_file.h" #include "mongo/db/storage/storage_engine_metadata.h" -#include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h" +#include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_global_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_index.h" +#include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h" #include "mongo/db/storage/wiredtiger/wiredtiger_parameters.h" #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" #include "mongo/db/storage/wiredtiger/wiredtiger_server_status.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/db/storage/storage_options.h" #include "mongo/util/log.h" 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 4bf932ac276..a2830efebfd 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp @@ -29,12 +29,12 @@ #include "mongo/platform/basic.h" -#include "mongo/db/service_context.h" #include "mongo/db/json.h" +#include "mongo/db/service_context.h" #include "mongo/db/storage/storage_engine_metadata.h" +#include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_global_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" -#include "mongo/db/storage/storage_options.h" #include "mongo/unittest/unittest.h" #include "mongo/util/mongoutils/str.h" @@ -94,9 +94,15 @@ 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 163654c12cb..e6c2875ec7c 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -45,13 +45,14 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/client.h" +#include "mongo/db/commands/server_status_metric.h" #include "mongo/db/concurrency/locker.h" #include "mongo/db/concurrency/write_conflict_exception.h" -#include "mongo/db/commands/server_status_metric.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/server_parameters.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/journal_listener.h" +#include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.h" #include "mongo/db/storage/wiredtiger/wiredtiger_global_options.h" #include "mongo/db/storage/wiredtiger/wiredtiger_index.h" @@ -60,11 +61,10 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/db/storage/storage_options.h" -#include "mongo/util/log.h" #include "mongo/util/background.h" #include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/exit.h" +#include "mongo/util/log.h" #include "mongo/util/processinfo.h" #include "mongo/util/scopeguard.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp index 49ef155b51d..cb7852d0bfc 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.cpp @@ -70,7 +70,8 @@ Status WiredTigerEngineRuntimeConfigParameter::setFromString(const std::string& return Status(ErrorCodes::BadValue, (str::stream() << "WiredTiger configuration strings cannot have embedded null characters. " - "Embedded null found at position " << pos)); + "Embedded null found at position " + << pos)); } log() << "Reconfiguring WiredTiger storage engine with config string: \"" << str << "\""; @@ -79,7 +80,9 @@ Status WiredTigerEngineRuntimeConfigParameter::setFromString(const std::string& if (ret != 0) { string result = (mongoutils::str::stream() << "WiredTiger reconfiguration failed with error code (" - << ret << "): " << wiredtiger_strerror(ret)); + << ret + << "): " + << wiredtiger_strerror(ret)); error() << result; return Status(ErrorCodes::BadValue, result); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index f31bbd1e38a..1543b5706f6 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -488,7 +488,8 @@ public: if (_forward && MONGO_FAIL_POINT(WTEmulateOutOfOrderNextRecordId)) { log() << "WTEmulateOutOfOrderNextRecordId fail point has triggerd so RecordId is now " - "RecordId(1) instead of " << id; + "RecordId(1) instead of " + << id; // Replace the found RecordId with a (small) fake one. id = RecordId{1}; } @@ -649,7 +650,8 @@ 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()); 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 37d64e8bd00..249dcacdc81 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp @@ -33,16 +33,16 @@ #include <sstream> #include <string> +#include "mongo/base/checked_cast.h" #include "mongo/base/string_data.h" #include "mongo/bson/bsonobjbuilder.h" -#include "mongo/base/checked_cast.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/json.h" #include "mongo/db/operation_context_noop.h" #include "mongo/db/storage/record_store_test_harness.h" -#include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" #include "mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h" +#include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp index 415081d334c..6f4bcf0d025 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp @@ -154,7 +154,9 @@ Status WiredTigerUtil::getApplicationMetadata(OperationContext* opCtx, if (keysSeen.count(key)) { return Status(ErrorCodes::DuplicateKey, str::stream() << "app_metadata must not contain duplicate keys. " - << "Found multiple instances of key '" << key << "'."); + << "Found multiple instances of key '" + << key + << "'."); } keysSeen.insert(key); @@ -230,7 +232,9 @@ Status WiredTigerUtil::checkApplicationMetadataFormatVersion(OperationContext* o 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 " @@ -278,7 +282,8 @@ StatusWith<uint64_t> WiredTigerUtil::getStatisticsValue(WT_SESSION* session, if (ret != 0) { return StatusWith<uint64_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); @@ -286,19 +291,21 @@ StatusWith<uint64_t> WiredTigerUtil::getStatisticsValue(WT_SESSION* session, cursor->set_key(cursor, statisticsKey); ret = cursor->search(cursor); if (ret != 0) { - return StatusWith<uint64_t>(ErrorCodes::NoSuchKey, - str::stream() << "unable to find key " << statisticsKey - << " at URI " << uri - << ". reason: " << wiredtiger_strerror(ret)); + return StatusWith<uint64_t>( + ErrorCodes::NoSuchKey, + str::stream() << "unable to find key " << statisticsKey << " at URI " << uri + << ". reason: " + << wiredtiger_strerror(ret)); } uint64_t value; ret = cursor->get_value(cursor, NULL, NULL, &value); if (ret != 0) { - return StatusWith<uint64_t>(ErrorCodes::BadValue, - str::stream() << "unable to get value for key " << statisticsKey - << " at URI " << uri - << ". reason: " << wiredtiger_strerror(ret)); + return StatusWith<uint64_t>( + ErrorCodes::BadValue, + str::stream() << "unable to get value for key " << statisticsKey << " at URI " << uri + << ". reason: " + << wiredtiger_strerror(ret)); } return StatusWith<uint64_t>(value); @@ -437,8 +444,8 @@ Status WiredTigerUtil::exportTableToBSON(WT_SESSION* session, int ret = session->open_cursor(session, uri.c_str(), NULL, 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); |