diff options
author | Kevin Pulo <kevin.pulo@mongodb.com> | 2015-10-26 23:40:07 +0000 |
---|---|---|
committer | Kevin Pulo <kevin.pulo@mongodb.com> | 2015-10-30 20:52:35 +1100 |
commit | a57f58a7d2a00a1b737978dae7a2f1485df4636c (patch) | |
tree | 887fa5b09e25ed92771642935d8e4abb36394dc7 | |
parent | 0c8b0d57c7072788e5f7f20af36214f0f9060099 (diff) | |
download | mongo-a57f58a7d2a00a1b737978dae7a2f1485df4636c.tar.gz |
SERVER-21150 move basic init log messages earlier
Specifically, ahead of socket and storage engine initialisation
-rw-r--r-- | src/mongo/db/db.cpp | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index d41f1885b99..4f2d3676f19 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -404,6 +404,32 @@ static void repairDatabasesAndCheckVersion(OperationContext* txn) { static void _initAndListen(int listenPort) { Client::initThread("initandlisten"); + getGlobalServiceContext()->setOpObserver(stdx::make_unique<OpObserver>()); + + const repl::ReplSettings& replSettings = repl::getGlobalReplicationCoordinator()->getSettings(); + + { + ProcessId pid = ProcessId::getCurrent(); + LogstreamBuilder l = log(LogComponent::kControl); + l << "MongoDB starting : pid=" << pid << " port=" << serverGlobalParams.port + << " dbpath=" << storageGlobalParams.dbpath; + if (replSettings.master) + l << " master=" << replSettings.master; + if (replSettings.slave) + l << " slave=" << (int)replSettings.slave; + + const bool is32bit = sizeof(int*) == 4; + l << (is32bit ? " 32" : " 64") << "-bit host=" << getHostNameCached() << endl; + } + + DEV log(LogComponent::kControl) << "DEBUG build (which is slower)" << endl; + +#if defined(_WIN32) + printTargetMinOS(); +#endif + + logProcessDetails(); + // Due to SERVER-15389, we must setupSockets first thing at startup in order to avoid // obtaining too high a file descriptor for our calls to select(). MessageServer::Options options; @@ -461,10 +487,6 @@ static void _initAndListen(int listenPort) { } } - getGlobalServiceContext()->setOpObserver(stdx::make_unique<OpObserver>()); - - const repl::ReplSettings& replSettings = repl::getGlobalReplicationCoordinator()->getSettings(); - if (!getGlobalServiceContext()->getGlobalStorageEngine()->getSnapshotManager()) { if (moe::startupOptionsParsed.count("replication.enableMajorityReadConcern")) { // Note: we are intentionally only erroring if the user explicitly requested that we @@ -479,29 +501,8 @@ static void _initAndListen(int listenPort) { } } - { - ProcessId pid = ProcessId::getCurrent(); - LogstreamBuilder l = log(LogComponent::kControl); - l << "MongoDB starting : pid=" << pid << " port=" << serverGlobalParams.port - << " dbpath=" << storageGlobalParams.dbpath; - if (replSettings.master) - l << " master=" << replSettings.master; - if (replSettings.slave) - l << " slave=" << (int)replSettings.slave; - - const bool is32bit = sizeof(int*) == 4; - l << (is32bit ? " 32" : " 64") << "-bit host=" << getHostNameCached() << endl; - } - - DEV log(LogComponent::kControl) << "DEBUG build (which is slower)" << endl; logMongodStartupWarnings(storageGlobalParams, serverGlobalParams); -#if defined(_WIN32) - printTargetMinOS(); -#endif - - logProcessDetails(); - { stringstream ss; ss << endl; |