diff --git a/jstests/noPassthrough/startup_logging.js b/jstests/noPassthrough/startup_logging.js new file mode 100644 index 00000000000..6056085a963 --- /dev/null +++ b/jstests/noPassthrough/startup_logging.js @@ -0,0 +1,37 @@ +/** + * Tests that normal startup writes to the log files as expected. + */ + +(function() { + + 'use strict'; + + function makeRegExMatchFn(pattern) { + return function(text) { + return pattern.test(text); + }; + } + + function testStartupLogging(launcher, matchFn, expectedExitCode) { + assert(matchFn(rawMongoProgramOutput())); + } + + function validateWaitingMessage(launcher) { + clearRawMongoProgramOutput(); + var conn = launcher.start({}); + testStartupLogging(launcher, makeRegExMatchFn(/waiting for connections on port/)); + launcher.stop(conn, undefined, {}); + } + + print("********************\nTesting startup logging in mongod\n********************"); + + validateWaitingMessage({ + start: function(opts) { + var actualOpts = {nojournal: ""}; + Object.extend(actualOpts, opts); + return MongoRunner.runMongod(actualOpts); + }, + stop: MongoRunner.stopMongod + }); + +}()); diff --git a/jstests/noPassthrough/transportlayer_boot_cmdline.js b/jstests/noPassthrough/transportlayer_boot_cmdline.js new file mode 100644 index 00000000000..29064893f99 --- /dev/null +++ b/jstests/noPassthrough/transportlayer_boot_cmdline.js @@ -0,0 +1,30 @@ +/** + * Tests the valid combinations to start a mongod works properly + * + */ + +(function() { + 'use strict'; + + var baseDir = "jstests_transportlayer_boot_cmdline"; + var dbpath = MongoRunner.dataPath + baseDir + "/"; + + var m = MongoRunner.runMongod({dbpath: dbpath, transportLayer: 'legacy'}); + assert(m, 'MongoDB with transportLayer=legacy failed to start up'); + MongoRunner.stopMongod(m); + + m = MongoRunner.runMongod( + {dbpath: dbpath, transportLayer: 'legacy', serviceExecutor: 'synchronous'}); + assert(m, + 'MongoDB with transportLayer=legacy and serviceExecutor=synchronous failed to start up'); + MongoRunner.stopMongod(m); + + m = MongoRunner.runMongod( + {dbpath: dbpath, transportLayer: 'legacy', serviceExecutor: 'fixedForTesting'}); + assert.isnull( + m, + 'MongoDB with transportLayer=legacy and serviceExecutor=fixedForTesting managed to startup which is an unsupported combination'); + if (m) { + MongoRunner.stopMongod(m); + } +}()); diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp index 52bf5e2022c..7cbd6013d32 100644 --- a/src/mongo/db/server_options_helpers.cpp +++ b/src/mongo/db/server_options_helpers.cpp @@ -817,14 +817,18 @@ Status storeServerOptions(const moe::Environment& params) { } if (params.count("net.serviceExecutor")) { - if (serverGlobalParams.transportLayer == "legacy") { - return {ErrorCodes::BadValue, - "Cannot specify a serviceExecutor with the legacy transportLayer"}; - } - const auto valid = {"synchronous"_sd, "fixedForTesting"_sd}; auto value = params["net.serviceExecutor"].as(); - if (std::find(valid.begin(), valid.end(), value) == valid.end()) { - return {ErrorCodes::BadValue, "Unsupported value for serviceExecutor"}; + if (serverGlobalParams.transportLayer == "legacy") { + if (value != "synchronous"_sd) { + return {ErrorCodes::BadValue, + "Unsupported value for serviceExecutor with the legacy transportLayer, " + "must be \"synchronous\""}; + } + } else { + const auto valid = {"synchronous"_sd, "fixedForTesting"_sd}; + if (std::find(valid.begin(), valid.end(), value) == valid.end()) { + return {ErrorCodes::BadValue, "Unsupported value for serviceExecutor"}; + } } serverGlobalParams.serviceExecutor = value; } else { diff --git a/src/mongo/transport/transport_layer_asio.cpp b/src/mongo/transport/transport_layer_asio.cpp index 9d0b894071d..b3d0f0e5c9f 100644 --- a/src/mongo/transport/transport_layer_asio.cpp +++ b/src/mongo/transport/transport_layer_asio.cpp @@ -251,6 +251,14 @@ Status TransportLayerASIO::start() { _acceptConnection(acceptor); } + const char* ssl = ""; +#ifdef MONGO_CONFIG_SSL + if (_sslMode != SSLParams::SSLMode_disabled) { + ssl = " ssl"; + } +#endif + log() << "waiting for connections on port " << _listenerOptions.port << ssl; + return Status::OK(); }