diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /src/mongo/db/ftdc | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'src/mongo/db/ftdc')
-rw-r--r-- | src/mongo/db/ftdc/compressor_test.cpp | 223 | ||||
-rw-r--r-- | src/mongo/db/ftdc/controller.h | 16 | ||||
-rw-r--r-- | src/mongo/db/ftdc/controller_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/ftdc/file_manager.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/ftdc/file_manager_test.cpp | 92 | ||||
-rw-r--r-- | src/mongo/db/ftdc/file_reader.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/ftdc/file_writer.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/ftdc/file_writer_test.cpp | 86 | ||||
-rw-r--r-- | src/mongo/db/ftdc/ftdc_server.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/ftdc/ftdc_system_stats.h | 1 | ||||
-rw-r--r-- | src/mongo/db/ftdc/ftdc_system_stats_linux.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/ftdc/util.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/ftdc/util.h | 24 | ||||
-rw-r--r-- | src/mongo/db/ftdc/varint.h | 4 |
14 files changed, 134 insertions, 342 deletions
diff --git a/src/mongo/db/ftdc/compressor_test.cpp b/src/mongo/db/ftdc/compressor_test.cpp index 143a6c4b391..509504037b7 100644 --- a/src/mongo/db/ftdc/compressor_test.cpp +++ b/src/mongo/db/ftdc/compressor_test.cpp @@ -70,18 +70,12 @@ TEST_F(FTDCCompressorTest, TestBasic) { auto st = c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42), + << "key1" << 33 << "key2" << 42), Date_t()); ASSERT_HAS_SPACE(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t()); ASSERT_HAS_SPACE(st); @@ -190,112 +184,64 @@ TEST_F(FTDCCompressorTest, TestSchemaChanges) { auto st = c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42)); + << "key1" << 33 << "key2" << 42)); ASSERT_HAS_SPACE(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); ASSERT_HAS_SPACE(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); ASSERT_HAS_SPACE(st); // Add Field st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45 - << "key3" - << 47)); + << "key1" << 34 << "key2" << 45 << "key3" << 47)); ASSERT_SCHEMA_CHANGED(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45 - << "key3" - << 47)); + << "key1" << 34 << "key2" << 45 << "key3" << 47)); ASSERT_HAS_SPACE(st); // Rename field st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key5" - << 45 - << "key3" - << 47)); + << "key1" << 34 << "key5" << 45 << "key3" << 47)); ASSERT_SCHEMA_CHANGED(st); // Change type st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key5" + << "key1" << 34 << "key5" << "45" - << "key3" - << 47)); + << "key3" << 47)); ASSERT_SCHEMA_CHANGED(st); // Add Field st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45 - << "key3" - << 47 - << "key7" - << 34 - << "key9" - << 45 - << "key13" - << 47)); + << "key1" << 34 << "key2" << 45 << "key3" << 47 << "key7" << 34 << "key9" + << 45 << "key13" << 47)); ASSERT_SCHEMA_CHANGED(st); // Remove Field st = c.addSample(BSON("name" << "joe" - << "key7" - << 34 - << "key9" - << 45 - << "key13" - << 47)); + << "key7" << 34 << "key9" << 45 << "key13" << 47)); ASSERT_SCHEMA_CHANGED(st); st = c.addSample(BSON("name" << "joe" - << "key7" - << 34 - << "key9" - << 45 - << "key13" - << 47)); + << "key7" << 34 << "key9" << 45 << "key13" << 47)); ASSERT_HAS_SPACE(st); // Start new batch st = c.addSample(BSON("name" << "joe" - << "key7" - << 5)); + << "key7" << 5)); ASSERT_SCHEMA_CHANGED(st); // Change field to object @@ -309,22 +255,19 @@ TEST_F(FTDCCompressorTest, TestSchemaChanges) { // Change field from object to number st = c.addSample(BSON("name" << "joe" - << "key7" - << 7)); + << "key7" << 7)); ASSERT_SCHEMA_CHANGED(st); // Change field from number to array st = c.addSample(BSON("name" << "joe" - << "key7" - << BSON_ARRAY(13 << 17))); + << "key7" << BSON_ARRAY(13 << 17))); ASSERT_SCHEMA_CHANGED(st); // Change field from array to number st = c.addSample(BSON("name" << "joe" - << "key7" - << 19)); + << "key7" << 19)); ASSERT_SCHEMA_CHANGED(st); @@ -351,13 +294,11 @@ TEST_F(FTDCCompressorTest, TestStringSchemaChanges) { auto st = c.addSample(BSON("str1" << "joe" - << "int1" - << 42)); + << "int1" << 42)); ASSERT_HAS_SPACE(st); st = c.addSample(BSON("str1" << "joe" - << "int1" - << 45)); + << "int1" << 45)); ASSERT_HAS_SPACE(st); // Add string field @@ -365,8 +306,7 @@ TEST_F(FTDCCompressorTest, TestStringSchemaChanges) { << "joe" << "str2" << "smith" - << "int1" - << 47)); + << "int1" << 47)); ASSERT_HAS_SPACE(st); // Reset schema by renaming a int field @@ -374,41 +314,34 @@ TEST_F(FTDCCompressorTest, TestStringSchemaChanges) { << "joe" << "str2" << "smith" - << "int2" - << 48)); + << "int2" << 48)); ASSERT_SCHEMA_CHANGED(st); // Remove string field st = c.addSample(BSON("str1" << "joe" - << "int2" - << 49)); + << "int2" << 49)); ASSERT_HAS_SPACE(st); // Add string field as last element st = c.addSample(BSON("str1" << "joe" - << "int2" - << 50 - << "str3" + << "int2" << 50 << "str3" << "bar")); ASSERT_HAS_SPACE(st); // Reset schema by renaming a int field st = c.addSample(BSON("str1" << "joe" - << "int1" - << 51 - << "str3" + << "int1" << 51 << "str3" << "bar")); ASSERT_SCHEMA_CHANGED(st); // Remove string field as last element st = c.addSample(BSON("str1" << "joe" - << "int1" - << 52)); + << "int1" << 52)); ASSERT_HAS_SPACE(st); @@ -419,8 +352,7 @@ TEST_F(FTDCCompressorTest, TestStringSchemaChanges) { << "smith" << "str3" << "foo" - << "int1" - << 53)); + << "int1" << 53)); ASSERT_HAS_SPACE(st); // Reset schema by renaming a int field @@ -430,15 +362,13 @@ TEST_F(FTDCCompressorTest, TestStringSchemaChanges) { << "smith" << "str3" << "foo" - << "int2" - << 54)); + << "int2" << 54)); ASSERT_SCHEMA_CHANGED(st); // Remove 2 string fields st = c.addSample(BSON("str1" << "joe" - << "int2" - << 55)); + << "int2" << 55)); ASSERT_HAS_SPACE(st); // Change string to number @@ -448,8 +378,7 @@ TEST_F(FTDCCompressorTest, TestStringSchemaChanges) { // Change number to string st = c.addSample(BSON("str1" << "joe" - << "int1" - << 67)); + << "int1" << 67)); ASSERT_SCHEMA_CHANGED(st); } @@ -459,24 +388,15 @@ TEST_F(FTDCCompressorTest, TestNumbersCompat) { auto st = c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42LL)); + << "key1" << 33 << "key2" << 42LL)); ASSERT_HAS_SPACE(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << 34LL - << "key2" - << 45.0f)); + << "key1" << 34LL << "key2" << 45.0f)); ASSERT_HAS_SPACE(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << static_cast<char>(32) - << "key2" - << 45.0F)); + << "key1" << static_cast<char>(32) << "key2" << 45.0F)); ASSERT_HAS_SPACE(st); } @@ -500,50 +420,35 @@ TEST_F(FTDCCompressorTest, Types) { auto st = c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42LL)); + << "key1" << 33 << "key2" << 42LL)); ASSERT_HAS_SPACE(st); const char bytes[] = {0x1, 0x2, 0x3}; - BSONObj o = BSON("created" << DATENOW // date_t - << "null" - << BSONNULL // { a : null } - << "undefined" - << BSONUndefined // { a : undefined } + BSONObj o = BSON("created" << DATENOW // date_t + << "null" << BSONNULL // { a : null } + << "undefined" << BSONUndefined // { a : undefined } << "obj" << BSON( // nested object "a" << "abc" - << "b" - << 123LL) + << "b" << 123LL) << "foo" << BSON_ARRAY("bar" << "baz" - << "qux") // array of strings - << "foo2" - << BSON_ARRAY(5 << 6 << 7) // array of ints - << "bindata" - << BSONBinData(&bytes[0], 3, bdtCustom) // bindata - << "oid" - << OID("010203040506070809101112") // oid - << "bool" - << true // bool - << "regex" - << BSONRegEx("mongodb") // regex - << "ref" - << BSONDBRef("c", OID("010203040506070809101112")) // ref - << "code" - << BSONCode("func f() { return 1; }") // code + << "qux") // array of strings + << "foo2" << BSON_ARRAY(5 << 6 << 7) // array of ints + << "bindata" << BSONBinData(&bytes[0], 3, bdtCustom) // bindata + << "oid" << OID("010203040506070809101112") // oid + << "bool" << true // bool + << "regex" << BSONRegEx("mongodb") // regex + << "ref" << BSONDBRef("c", OID("010203040506070809101112")) // ref + << "code" << BSONCode("func f() { return 1; }") // code << "codewscope" << BSONCodeWScope("func f() { return 1; }", BSON("c" << true)) // codew - << "minkey" - << MINKEY // minkey - << "maxkey" - << MAXKEY // maxkey - ); + << "minkey" << MINKEY // minkey + << "maxkey" << MAXKEY // maxkey + ); st = c.addSample(o); ASSERT_SCHEMA_CHANGED(st); @@ -553,17 +458,11 @@ TEST_F(FTDCCompressorTest, Types) { st = c.addSample(BSON("name" << "joe" - << "key1" - << 34LL - << "key2" - << 45.0f)); + << "key1" << 34LL << "key2" << 45.0f)); ASSERT_SCHEMA_CHANGED(st); st = c.addSample(BSON("name" << "joe" - << "key1" - << static_cast<char>(32) - << "key2" - << 45.0F)); + << "key1" << static_cast<char>(32) << "key2" << 45.0F)); ASSERT_HAS_SPACE(st); } @@ -575,37 +474,25 @@ TEST_F(FTDCCompressorTest, TestFull) { auto st = c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42)); + << "key1" << 33 << "key2" << 42)); ASSERT_HAS_SPACE(st); for (size_t i = 0; i != FTDCConfig::kMaxSamplesPerArchiveMetricChunkDefault - 2; i++) { st = c.addSample(BSON("name" << "joe" - << "key1" - << static_cast<long long int>(i * j) - << "key2" - << 45)); + << "key1" << static_cast<long long int>(i * j) << "key2" << 45)); ASSERT_HAS_SPACE(st); } st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); ASSERT_FULL(st); // Add Value st = c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); ASSERT_HAS_SPACE(st); } } diff --git a/src/mongo/db/ftdc/controller.h b/src/mongo/db/ftdc/controller.h index 26d76b28ad7..5d1f2f5487a 100644 --- a/src/mongo/db/ftdc/controller.h +++ b/src/mongo/db/ftdc/controller.h @@ -150,14 +150,14 @@ private: private: /** - * Private enum to track state. - * - * +-----------------------------------------------------------+ - * | v - * +-------------+ +----------+ +----------------+ +-------+ - * | kNotStarted | --> | kStarted | --> | kStopRequested | --> | kDone | - * +-------------+ +----------+ +----------------+ +-------+ - */ + * Private enum to track state. + * + * +-----------------------------------------------------------+ + * | v + * +-------------+ +----------+ +----------------+ +-------+ + * | kNotStarted | --> | kStarted | --> | kStopRequested | --> | kDone | + * +-------------+ +----------+ +----------------+ +-------+ + */ enum class State { /** * Initial state. Either start() or stop() can be called next. diff --git a/src/mongo/db/ftdc/controller_test.cpp b/src/mongo/db/ftdc/controller_test.cpp index a2a4c9b8abc..43872f1ccd5 100644 --- a/src/mongo/db/ftdc/controller_test.cpp +++ b/src/mongo/db/ftdc/controller_test.cpp @@ -119,8 +119,8 @@ public: private: /** - * Private enum to ensure caller uses class correctly. - */ + * Private enum to ensure caller uses class correctly. + */ enum class State { kNotStarted, kStarted, diff --git a/src/mongo/db/ftdc/file_manager.cpp b/src/mongo/db/ftdc/file_manager.cpp index cdc7dcdb125..39ef2e133f7 100644 --- a/src/mongo/db/ftdc/file_manager.cpp +++ b/src/mongo/db/ftdc/file_manager.cpp @@ -76,8 +76,8 @@ StatusWith<std::unique_ptr<FTDCFileManager>> FTDCFileManager::create( boost::filesystem::create_directories(dir, ec); if (ec) { return {ErrorCodes::NonExistentPath, - str::stream() << "\"" << dir.generic_string() << "\" could not be created: " - << ec.message()}; + str::stream() << "\"" << dir.generic_string() + << "\" could not be created: " << ec.message()}; } } @@ -233,9 +233,9 @@ Status FTDCFileManager::trimDirectory(std::vector<boost::filesystem::path>& file boost::filesystem::remove(*it, ec); if (ec) { return {ErrorCodes::NonExistentPath, - str::stream() << "\"" << (*it).generic_string() - << "\" could not be removed during trimming: " - << ec.message()}; + str::stream() + << "\"" << (*it).generic_string() + << "\" could not be removed during trimming: " << ec.message()}; } } } diff --git a/src/mongo/db/ftdc/file_manager_test.cpp b/src/mongo/db/ftdc/file_manager_test.cpp index 13493e984b7..a6cf6c6b38c 100644 --- a/src/mongo/db/ftdc/file_manager_test.cpp +++ b/src/mongo/db/ftdc/file_manager_test.cpp @@ -72,45 +72,34 @@ TEST_F(FTDCFileManagerTest, TestFull) { // Test a large numbers of zeros, and incremental numbers in a full buffer for (int j = 0; j < 10; j++) { - ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, - BSON("name" - << "joe" - << "key1" - << 3230792343LL - << "key2" - << 235135), - Date_t())); + ASSERT_OK( + mgr->writeSampleAndRotateIfNeeded(client, + BSON("name" + << "joe" + << "key1" << 3230792343LL << "key2" << 235135), + Date_t())); for (size_t i = 0; i <= FTDCConfig::kMaxSamplesPerArchiveMetricChunkDefault - 2; i++) { - ASSERT_OK( - mgr->writeSampleAndRotateIfNeeded(client, - BSON("name" - << "joe" - << "key1" - << static_cast<long long int>(i * j * 37) - << "key2" - << static_cast<long long int>(i * - (645 << j))), - Date_t())); + ASSERT_OK(mgr->writeSampleAndRotateIfNeeded( + client, + BSON("name" + << "joe" + << "key1" << static_cast<long long int>(i * j * 37) << "key2" + << static_cast<long long int>(i * (645 << j))), + Date_t())); } ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t())); // Add Value ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t())); } @@ -175,9 +164,7 @@ TEST_F(FTDCFileManagerTest, TestNormalRestart) { ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 3230792343LL - << "key2" + << "key1" << 3230792343LL << "key2" << 235135), Date_t())); @@ -187,9 +174,7 @@ TEST_F(FTDCFileManagerTest, TestNormalRestart) { client, BSON("name" << "joe" - << "key1" - << static_cast<long long int>(i * j * 37) - << "key2" + << "key1" << static_cast<long long int>(i * j * 37) << "key2" << static_cast<long long int>(i * (645 << j))), Date_t())); } @@ -197,20 +182,14 @@ TEST_F(FTDCFileManagerTest, TestNormalRestart) { ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t())); // Add Value ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t())); } @@ -245,9 +224,7 @@ TEST_F(FTDCFileManagerTest, TestCorruptCrashRestart) { ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 3230792343LL - << "key2" + << "key1" << 3230792343LL << "key2" << 235135), Date_t())); @@ -257,9 +234,7 @@ TEST_F(FTDCFileManagerTest, TestCorruptCrashRestart) { client, BSON("name" << "joe" - << "key1" - << static_cast<long long int>(i * j * 37) - << "key2" + << "key1" << static_cast<long long int>(i * j * 37) << "key2" << static_cast<long long int>(i * (645 << j))), Date_t())); } @@ -267,20 +242,14 @@ TEST_F(FTDCFileManagerTest, TestCorruptCrashRestart) { ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t())); // Add Value ASSERT_OK(mgr->writeSampleAndRotateIfNeeded(client, BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45), + << "key1" << 34 << "key2" << 45), Date_t())); } @@ -311,23 +280,14 @@ TEST_F(FTDCFileManagerTest, TestNormalCrashInterim) { BSONObj mdoc1 = BSON("name" << "some_metadata" - << "key1" - << 34 - << "something" - << 98); + << "key1" << 34 << "something" << 98); BSONObj sdoc1 = BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45); + << "key1" << 34 << "key2" << 45); BSONObj sdoc2 = BSON("name" << "joe" - << "key3" - << 34 - << "key5" - << 45); + << "key3" << 34 << "key5" << 45); boost::filesystem::path fileOut; diff --git a/src/mongo/db/ftdc/file_reader.cpp b/src/mongo/db/ftdc/file_reader.cpp index 23d468aac0f..b71257e4278 100644 --- a/src/mongo/db/ftdc/file_reader.cpp +++ b/src/mongo/db/ftdc/file_reader.cpp @@ -195,8 +195,7 @@ StatusWith<BSONObj> FTDCFileReader::readDocument() { if (readSize != _stream.gcount()) { return {ErrorCodes::FileStreamFailed, str::stream() << "Failed to read " << readSize << " bytes from file \"" - << _file.generic_string() - << "\""}; + << _file.generic_string() << "\""}; } ConstDataRange cdr(_buffer.data(), _buffer.data() + bsonLength); diff --git a/src/mongo/db/ftdc/file_writer.cpp b/src/mongo/db/ftdc/file_writer.cpp index be4ea127b3b..24a6bf4cb17 100644 --- a/src/mongo/db/ftdc/file_writer.cpp +++ b/src/mongo/db/ftdc/file_writer.cpp @@ -210,8 +210,7 @@ Status FTDCFileWriter::flush(const boost::optional<ConstDataRange>& range, Date_ if (ec) { return {ErrorCodes::NonExistentPath, str::stream() << "\"" << _interimFile.generic_string() - << "\" could not be removed during flush: " - << ec.message()}; + << "\" could not be removed during flush: " << ec.message()}; } return Status::OK(); diff --git a/src/mongo/db/ftdc/file_writer_test.cpp b/src/mongo/db/ftdc/file_writer_test.cpp index b8f6dbd9f70..16118eec6ce 100644 --- a/src/mongo/db/ftdc/file_writer_test.cpp +++ b/src/mongo/db/ftdc/file_writer_test.cpp @@ -60,16 +60,10 @@ TEST_F(FTDCFileTest, TestFileBasicMetadata) { BSONObj doc1 = BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45); + << "key1" << 34 << "key2" << 45); BSONObj doc2 = BSON("name" << "joe" - << "key3" - << 34 - << "key5" - << 45); + << "key3" << 34 << "key5" << 45); FTDCConfig config; FTDCFileWriter writer(&config); @@ -111,16 +105,10 @@ TEST_F(FTDCFileTest, TestFileBasicCompress) { BSONObj doc1 = BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45); + << "key1" << 34 << "key2" << 45); BSONObj doc2 = BSON("name" << "joe" - << "key3" - << 34 - << "key5" - << 45); + << "key3" << 34 << "key5" << 45); FTDCConfig config; FTDCFileWriter writer(&config); @@ -216,69 +204,41 @@ TEST_F(FTDCFileTest, TestSchemaChanges) { c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42)); + << "key1" << 33 << "key2" << 42)); c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); // Add Value c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45 - << "key3" - << 47)); + << "key1" << 34 << "key2" << 45 << "key3" << 47)); c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45 - << "key3" - << 47)); + << "key1" << 34 << "key2" << 45 << "key3" << 47)); // Rename field c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key5" - << 45 - << "key3" - << 47)); + << "key1" << 34 << "key5" << 45 << "key3" << 47)); // Change type c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key5" + << "key1" << 34 << "key5" << "45" - << "key3" - << 47)); + << "key3" << 47)); // RemoveField c.addSample(BSON("name" << "joe" << "key5" << "45" - << "key3" - << 47)); + << "key3" << 47)); } // Test a full buffer @@ -289,34 +249,22 @@ TEST_F(FTDCFileTest, TestFull) { c.addSample(BSON("name" << "joe" - << "key1" - << 33 - << "key2" - << 42)); + << "key1" << 33 << "key2" << 42)); for (size_t i = 0; i <= FTDCConfig::kMaxSamplesPerArchiveMetricChunkDefault - 2; i++) { c.addSample(BSON("name" << "joe" - << "key1" - << static_cast<long long int>(i * j) - << "key2" - << 45)); + << "key1" << static_cast<long long int>(i * j) << "key2" << 45)); } c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); // Add Value c.addSample(BSON("name" << "joe" - << "key1" - << 34 - << "key2" - << 45)); + << "key1" << 34 << "key2" << 45)); } } diff --git a/src/mongo/db/ftdc/ftdc_server.cpp b/src/mongo/db/ftdc/ftdc_server.cpp index 92c2ca4fe2a..fc081316701 100644 --- a/src/mongo/db/ftdc/ftdc_server.cpp +++ b/src/mongo/db/ftdc/ftdc_server.cpp @@ -34,7 +34,6 @@ #include <boost/filesystem.hpp> #include <fstream> #include <memory> -#include <memory> #include "mongo/base/status.h" #include "mongo/bson/bsonobjbuilder.h" diff --git a/src/mongo/db/ftdc/ftdc_system_stats.h b/src/mongo/db/ftdc/ftdc_system_stats.h index b5886fea819..bdc2e87984c 100644 --- a/src/mongo/db/ftdc/ftdc_system_stats.h +++ b/src/mongo/db/ftdc/ftdc_system_stats.h @@ -33,7 +33,6 @@ #include "mongo/base/status.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/ftdc/controller.h" -#include "mongo/db/ftdc/controller.h" namespace mongo { diff --git a/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp b/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp index 0338f5b7f17..08fedbb8e6b 100644 --- a/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp +++ b/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp @@ -68,7 +68,10 @@ static const std::vector<StringData> kMemKeys{ }; static const std::vector<StringData> kNetstatKeys{ - "Tcp:"_sd, "Ip:"_sd, "TcpExt:"_sd, "IpExt:"_sd, + "Tcp:"_sd, + "Ip:"_sd, + "TcpExt:"_sd, + "IpExt:"_sd, }; /** diff --git a/src/mongo/db/ftdc/util.cpp b/src/mongo/db/ftdc/util.cpp index f745068fdea..9500bf62ecb 100644 --- a/src/mongo/db/ftdc/util.cpp +++ b/src/mongo/db/ftdc/util.cpp @@ -444,9 +444,7 @@ StatusWith<FTDCType> getBSONDocumentType(const BSONObj& obj) { static_cast<FTDCType>(value) != FTDCType::kMetadata) { return {ErrorCodes::BadValue, str::stream() << "Field '" << std::string(kFTDCTypeField) - << "' is not an expected value, found '" - << value - << "'"}; + << "' is not an expected value, found '" << value << "'"}; } return {static_cast<FTDCType>(value)}; diff --git a/src/mongo/db/ftdc/util.h b/src/mongo/db/ftdc/util.h index 87defea80ea..4d47c610559 100644 --- a/src/mongo/db/ftdc/util.h +++ b/src/mongo/db/ftdc/util.h @@ -45,23 +45,23 @@ namespace mongo { namespace FTDCBSONUtil { /** -* Type of FTDC document. -* -* NOTE: Persisted to disk via BSON Objects. -*/ + * Type of FTDC document. + * + * NOTE: Persisted to disk via BSON Objects. + */ enum class FTDCType : std::int32_t { /** - * A metadata document is composed of a header + an array of bson documents - * - * See createBSONMetadataChunkDocument - */ + * A metadata document is composed of a header + an array of bson documents + * + * See createBSONMetadataChunkDocument + */ kMetadata = 0, /** - * A metrics chunk is composed of a header + a compressed metric chunk. - * - * See createBSONMetricChunkDocument - */ + * A metrics chunk is composed of a header + a compressed metric chunk. + * + * See createBSONMetricChunkDocument + */ kMetricChunk = 1, }; diff --git a/src/mongo/db/ftdc/varint.h b/src/mongo/db/ftdc/varint.h index 08a064de2b4..66a4b30cab7 100644 --- a/src/mongo/db/ftdc/varint.h +++ b/src/mongo/db/ftdc/varint.h @@ -46,8 +46,8 @@ namespace mongo { */ struct FTDCVarInt { /** - * Maximum number of bytes an integer can compress to - */ + * Maximum number of bytes an integer can compress to + */ static const std::size_t kMaxSizeBytes64 = 10; FTDCVarInt() = default; |