diff options
author | Matt Cotter <matt.cotter@mongodb.com> | 2016-11-30 17:40:07 -0500 |
---|---|---|
committer | Matt Cotter <matt.cotter@mongodb.com> | 2016-12-07 18:46:46 -0500 |
commit | 7e606d787608a866ecbff87deced8c9072af265d (patch) | |
tree | b1088d3bfc3e05816e97d5d26011f6fec5b2a2db | |
parent | 02fa55abc653d1356ade3f6365d9d02de7f6113f (diff) | |
download | mongo-7e606d787608a866ecbff87deced8c9072af265d.tar.gz |
SERVER-27238 de-dup symbol logProcessDetailsForLogRotate
-rw-r--r-- | src/mongo/shell/dbshell.cpp | 5 | ||||
-rw-r--r-- | src/mongo/tools/bridge.cpp | 4 | ||||
-rw-r--r-- | src/mongo/util/SConscript | 5 | ||||
-rw-r--r-- | src/mongo/util/signal_handlers.cpp | 10 | ||||
-rw-r--r-- | src/mongo/util/signal_handlers.h | 7 |
5 files changed, 14 insertions, 17 deletions
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp index df3b37db1c3..5c33596b5ce 100644 --- a/src/mongo/shell/dbshell.cpp +++ b/src/mongo/shell/dbshell.cpp @@ -189,11 +189,6 @@ void killOps() { !shellGlobalParams.autoKillOp); } -// Stubs for signal_handlers.cpp -namespace mongo { -void logProcessDetailsForLogRotate() {} -} - void quitNicely(int sig) { shutdown(EXIT_CLEAN); } diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp index 6299e26b81c..9f5bff2ae1b 100644 --- a/src/mongo/tools/bridge.cpp +++ b/src/mongo/tools/bridge.cpp @@ -383,8 +383,6 @@ MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) { } // namespace -void logProcessDetailsForLogRotate() {} - int bridgeMain(int argc, char** argv, char** envp) { static StaticObserver staticObserver; @@ -398,7 +396,7 @@ int bridgeMain(int argc, char** argv, char** envp) { setupSignalHandlers(); runGlobalInitializersOrDie(argc, argv, envp); - startSignalProcessingThread(); + startSignalProcessingThread(LogFileStatus::kNoLogFileToRotate); listener = stdx::make_unique<BridgeListener>(); listener->setupSockets(); diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript index 3346a596763..b3a2add1a8a 100644 --- a/src/mongo/util/SConscript +++ b/src/mongo/util/SConscript @@ -429,13 +429,10 @@ env.Library( ], LIBDEPS=[ "$BUILD_DIR/mongo/base", + "$BUILD_DIR/mongo/db/log_process_details", "$BUILD_DIR/mongo/db/service_context", "$BUILD_DIR/mongo/db/server_options_core", ], - LIBDEPS_TAGS=[ - # Depends on logProcessDetailsForLogRotate and exitCleanly - 'incomplete', - ] ) env.CppUnitTest( diff --git a/src/mongo/util/signal_handlers.cpp b/src/mongo/util/signal_handlers.cpp index ce01fede77f..4122d3b48de 100644 --- a/src/mongo/util/signal_handlers.cpp +++ b/src/mongo/util/signal_handlers.cpp @@ -160,7 +160,7 @@ void eventProcessingThread() { // ensure the db and log mutexes aren't held. Because this is run in a different thread, it does // not need to be safe to call in signal context. sigset_t asyncSignals; -void signalProcessingThread() { +void signalProcessingThread(LogFileStatus rotate) { setThreadName("signalProcessingThread"); while (true) { @@ -171,7 +171,9 @@ void signalProcessingThread() { case SIGUSR1: // log rotate signal fassert(16782, rotateLogs(serverGlobalParams.logRenameOnRotate)); - logProcessDetailsForLogRotate(); + if (rotate == LogFileStatus::kNeedToRotateLogFile) { + logProcessDetailsForLogRotate(); + } break; default: // interrupt/terminate signal @@ -203,14 +205,14 @@ void setupSignalHandlers() { #endif } -void startSignalProcessingThread() { +void startSignalProcessingThread(LogFileStatus rotate) { #ifdef _WIN32 stdx::thread(eventProcessingThread).detach(); #else // Mask signals in the current (only) thread. All new threads will inherit this mask. invariant(pthread_sigmask(SIG_SETMASK, &asyncSignals, 0) == 0); // Spawn a thread to capture the signals we just masked off. - stdx::thread(signalProcessingThread).detach(); + stdx::thread(signalProcessingThread, rotate).detach(); #endif } diff --git a/src/mongo/util/signal_handlers.h b/src/mongo/util/signal_handlers.h index a6bbae805e2..cd753452efc 100644 --- a/src/mongo/util/signal_handlers.h +++ b/src/mongo/util/signal_handlers.h @@ -32,6 +32,11 @@ namespace mongo { +enum class LogFileStatus { + kNeedToRotateLogFile, + kNoLogFileToRotate, +}; + /** * Sets up handlers for signals and other events like terminate and new_handler. * @@ -45,7 +50,7 @@ void setupSignalHandlers(); * This must be the first thread started from the main thread. Call this immediately after * initializeServerGlobalState(). */ -void startSignalProcessingThread(); +void startSignalProcessingThread(LogFileStatus rotate = LogFileStatus::kNeedToRotateLogFile); /* * Uninstall the Control-C handler |