0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-29920 Restore missing message once listening

Also, fix some broken parameter handling for the legacy transport
This commit is contained in:
Andrew Morrow 2017-07-28 09:46:34 -04:00
parent 2318942c2e
commit a402b45dfb
4 changed files with 86 additions and 7 deletions

View File

@ -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
});
}());

View File

@ -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);
}
}());

View File

@ -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<std::string>();
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 {

View File

@ -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();
}