From 99ec5dabaf1286a5440da0bb561e32d3aa79466a Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Mon, 26 Nov 2018 18:43:04 -0500 Subject: SERVER-30815 Remove the mongodmain library --- src/mongo/SConscript | 48 ++++++++----------- src/mongo/db/commands/SConscript | 4 +- src/mongo/db/commands/clone_collection.cpp | 1 - src/mongo/db/commands/fsync.cpp | 1 - src/mongo/db/commands/mr.cpp | 1 - src/mongo/db/db.cpp | 24 ++++++++-- src/mongo/db/db.h | 46 ------------------ src/mongo/db/dbmain.cpp | 54 ---------------------- src/mongo/db/dbmain.h | 36 --------------- src/mongo/db/mongod_options.cpp | 1 - src/mongo/db/storage/SConscript | 8 ++-- src/mongo/db/storage/mobile/SConscript | 10 ++-- src/mongo/db/storage/wiredtiger/SConscript | 4 +- src/mongo/dbtests/counttests.cpp | 1 - src/mongo/dbtests/directclienttests.cpp | 1 - src/mongo/dbtests/indexcatalogtests.cpp | 1 - src/mongo/dbtests/pdfiletests.cpp | 1 - src/mongo/dbtests/repltests.cpp | 1 - src/mongo/dbtests/storage_timestamp_tests.cpp | 1 - src/mongo/dbtests/updatetests.cpp | 1 - .../embedded/mongo_embedded/mongo_embedded.cpp | 1 - src/mongo/util/SConscript | 4 +- 22 files changed, 49 insertions(+), 201 deletions(-) delete mode 100644 src/mongo/db/db.h delete mode 100644 src/mongo/db/dbmain.cpp delete mode 100644 src/mongo/db/dbmain.h (limited to 'src/mongo') diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 938568b9fa7..8dff7dd8bc4 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -293,12 +293,26 @@ env.Library( ] ) -env.Library( - target="mongodmain", +if env.TargetOSIs('windows'): + generatedDbManifest = env.Substfile( + 'db/db.manifest.in', + SUBST_DICT=[ + ('@mongo_version_major@', version_parts[0]), + ('@mongo_version_minor@', version_parts[1]), + ('@mongo_version_patch@', version_parts[2]), + ('@mongo_version_extra@', version_parts[3]), + ('@mongo_version_extra_str@', version_extra), + ]) + + env.Alias('generated-sources', generatedDbManifest) + env.Depends("db/db.res", generatedDbManifest) + +mongod = env.Program( + target="mongod", source=[ "db/db.cpp", - ], - LIBDEPS_PRIVATE=[ + ] + env.WindowsResourceFile("db/db.rc"), + LIBDEPS=[ '$BUILD_DIR/third_party/shim_snappy', 'base', 'db/auth/authmongod', @@ -403,32 +417,6 @@ env.Library( 'util/periodic_runner_factory', 'util/version_impl', ], -) - - -if env.TargetOSIs('windows'): - generatedDbManifest = env.Substfile( - 'db/db.manifest.in', - SUBST_DICT=[ - ('@mongo_version_major@', version_parts[0]), - ('@mongo_version_minor@', version_parts[1]), - ('@mongo_version_patch@', version_parts[2]), - ('@mongo_version_extra@', version_parts[3]), - ('@mongo_version_extra_str@', version_extra), - ]) - - env.Alias('generated-sources', generatedDbManifest) - env.Depends("db/db.res", generatedDbManifest) - -mongod = env.Program( - target="mongod", - source=[ - "db/dbmain.cpp", - ] + env.WindowsResourceFile("db/db.rc"), - LIBDEPS=[ - 'base', - 'mongodmain', - ], INSTALL_ALIAS=[ 'core', 'default', diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript index a052f431093..da130e2ee00 100644 --- a/src/mongo/db/commands/SConscript +++ b/src/mongo/db/commands/SConscript @@ -494,7 +494,7 @@ if has_option('use-cpu-profiler'): '$BUILD_DIR/mongo/db/commands', '$BUILD_DIR/mongo/db/db_raii', ], - LIBDEPS_DEPENDENTS=[ - '$BUILD_DIR/mongo/mongodmain', + PROGDEPS_DEPENDENTS=[ + '$BUILD_DIR/mongo/mongod', ], ) diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp index a8112395099..3dc087ae97f 100644 --- a/src/mongo/db/commands/clone_collection.cpp +++ b/src/mongo/db/commands/clone_collection.cpp @@ -44,7 +44,6 @@ #include "mongo/db/cloner.h" #include "mongo/db/commands.h" #include "mongo/db/commands/rename_collection.h" -#include "mongo/db/db.h" #include "mongo/db/index_builder.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 51ad036348c..88b0bec4635 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -47,7 +47,6 @@ #include "mongo/db/commands/fsync_locked.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/concurrency/write_conflict_exception.h" -#include "mongo/db/db.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/backup_cursor_hooks.h" #include "mongo/db/storage/storage_engine.h" diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index a3a94166619..0c3110cb97b 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -49,7 +49,6 @@ #include "mongo/db/clientcursor.h" #include "mongo/db/commands.h" #include "mongo/db/concurrency/write_conflict_exception.h" -#include "mongo/db/db.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbhelpers.h" #include "mongo/db/exec/working_set_common.h" diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 37c555ed167..edaa8416ab8 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -32,8 +32,6 @@ #include "mongo/platform/basic.h" -#include "mongo/db/dbmain.h" - #include #include #include @@ -985,9 +983,6 @@ void shutdownTask() { audit::logShutdown(client); } - -} // namespace - int mongoDbMain(int argc, char* argv[], char** envp) { registerShutdownTask(shutdownTask); @@ -1038,4 +1033,23 @@ int mongoDbMain(int argc, char* argv[], char** envp) { return 0; } +} // namespace } // namespace mongo + +#if defined(_WIN32) +// In Windows, wmain() is an alternate entry point for main(), and receives the same parameters +// as main() but encoded in Windows Unicode (UTF-16); "wide" 16-bit wchar_t characters. The +// WindowsCommandLine object converts these wide character strings to a UTF-8 coded equivalent +// and makes them available through the argv() and envp() members. This enables mongoDbMain() +// to process UTF-8 encoded arguments and environment variables without regard to platform. +int wmain(int argc, wchar_t* argvW[], wchar_t* envpW[]) { + mongo::WindowsCommandLine wcl(argc, argvW, envpW); + int exitCode = mongo::mongoDbMain(argc, wcl.argv(), wcl.envp()); + mongo::quickExit(exitCode); +} +#else +int main(int argc, char* argv[], char** envp) { + int exitCode = mongo::mongoDbMain(argc, argv, envp); + mongo::quickExit(exitCode); +} +#endif diff --git a/src/mongo/db/db.h b/src/mongo/db/db.h deleted file mode 100644 index 324391fb9cd..00000000000 --- a/src/mongo/db/db.h +++ /dev/null @@ -1,46 +0,0 @@ - - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include "mongo/platform/basic.h" - -#include "mongo/db/catalog/database_holder.h" -#include "mongo/db/client.h" -#include "mongo/db/curop.h" - -namespace mongo { - -namespace repl { -class ReplSettings; -} // namespace repl - -} // namespace mongo diff --git a/src/mongo/db/dbmain.cpp b/src/mongo/db/dbmain.cpp deleted file mode 100644 index 2df80727485..00000000000 --- a/src/mongo/db/dbmain.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/db/dbmain.h" - -#include "mongo/util/quick_exit.h" -#include "mongo/util/text.h" - -#if defined(_WIN32) -// In Windows, wmain() is an alternate entry point for main(), and receives the same parameters -// as main() but encoded in Windows Unicode (UTF-16); "wide" 16-bit wchar_t characters. The -// WindowsCommandLine object converts these wide character strings to a UTF-8 coded equivalent -// and makes them available through the argv() and envp() members. This enables mongoDbMain() -// to process UTF-8 encoded arguments and environment variables without regard to platform. -int wmain(int argc, wchar_t* argvW[], wchar_t* envpW[]) { - mongo::WindowsCommandLine wcl(argc, argvW, envpW); - int exitCode = mongo::mongoDbMain(argc, wcl.argv(), wcl.envp()); - mongo::quickExit(exitCode); -} -#else -int main(int argc, char* argv[], char** envp) { - int exitCode = mongo::mongoDbMain(argc, argv, envp); - mongo::quickExit(exitCode); -} -#endif diff --git a/src/mongo/db/dbmain.h b/src/mongo/db/dbmain.h deleted file mode 100644 index 435b75f253e..00000000000 --- a/src/mongo/db/dbmain.h +++ /dev/null @@ -1,36 +0,0 @@ - -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -namespace mongo { - -int mongoDbMain(int argc, char* argv[], char** envp); -} // namespace mongo diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 735b023ad0b..510bf89e7a8 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -41,7 +41,6 @@ #include "mongo/bson/json.h" #include "mongo/bson/util/builder.h" #include "mongo/config.h" -#include "mongo/db/db.h" #include "mongo/db/global_settings.h" #include "mongo/db/repl/repl_settings.h" #include "mongo/db/server_options.h" diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript index f25c138ced7..ddc14d00616 100644 --- a/src/mongo/db/storage/SConscript +++ b/src/mongo/db/storage/SConscript @@ -97,10 +97,8 @@ env.Library( ], LIBDEPS= ['$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/service_context'], - LIBDEPS_DEPENDENTS=[ - '$BUILD_DIR/mongo/mongodmain', - ], PROGDEPS_DEPENDENTS=[ + '$BUILD_DIR/mongo/mongod', '$BUILD_DIR/mongo/mongos', ], ) @@ -114,8 +112,8 @@ env.Library( '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/service_context', ], - LIBDEPS_DEPENDENTS=[ - '$BUILD_DIR/mongo/mongodmain', + PROGDEPS_DEPENDENTS=[ + '$BUILD_DIR/mongo/mongod', ], ) diff --git a/src/mongo/db/storage/mobile/SConscript b/src/mongo/db/storage/mobile/SConscript index 5d627509ffd..2ce89806410 100644 --- a/src/mongo/db/storage/mobile/SConscript +++ b/src/mongo/db/storage/mobile/SConscript @@ -34,11 +34,11 @@ env.Library( ] ) -serveronlyLibDepsDependents = [] +serveronlyProgDepsDependents = [] if mobile_se: - serveronlyLibDepsDependents = [ - '$BUILD_DIR/mongo/mongodmain', - '$BUILD_DIR/mongo/dbtests/testframework', + serveronlyProgDepsDependents = [ + '$BUILD_DIR/mongo/mongod', + '$BUILD_DIR/mongo/dbtests/dbtest', ] env.Library( @@ -46,7 +46,7 @@ env.Library( source=[ 'mobile_init.cpp', ], - LIBDEPS_DEPENDENTS=serveronlyLibDepsDependents, + PROGDEPS_DEPENDENTS=serveronlyProgDepsDependents, LIBDEPS=[ 'storage_mobile_core', '$BUILD_DIR/mongo/db/storage/kv/kv_engine' diff --git a/src/mongo/db/storage/wiredtiger/SConscript b/src/mongo/db/storage/wiredtiger/SConscript index ec8f2597126..f574fbc10be 100644 --- a/src/mongo/db/storage/wiredtiger/SConscript +++ b/src/mongo/db/storage/wiredtiger/SConscript @@ -18,10 +18,8 @@ env.Library( ], LIBDEPS= ['$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/service_context'], - LIBDEPS_DEPENDENTS=[ - '$BUILD_DIR/mongo/mongodmain', - ], PROGDEPS_DEPENDENTS=[ + '$BUILD_DIR/mongo/mongod', '$BUILD_DIR/mongo/mongos', ], ) diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp index 098b3a6f08c..a591320a4d4 100644 --- a/src/mongo/dbtests/counttests.cpp +++ b/src/mongo/dbtests/counttests.cpp @@ -32,7 +32,6 @@ #include "mongo/db/catalog/collection.h" #include "mongo/db/client.h" -#include "mongo/db/db.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/json.h" diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp index 3493268e20a..7d03c76e530 100644 --- a/src/mongo/dbtests/directclienttests.cpp +++ b/src/mongo/dbtests/directclienttests.cpp @@ -36,7 +36,6 @@ #include #include "mongo/db/client.h" -#include "mongo/db/db.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/json.h" #include "mongo/db/lasterror.h" diff --git a/src/mongo/dbtests/indexcatalogtests.cpp b/src/mongo/dbtests/indexcatalogtests.cpp index 7e82884edda..568026dd9ee 100644 --- a/src/mongo/dbtests/indexcatalogtests.cpp +++ b/src/mongo/dbtests/indexcatalogtests.cpp @@ -36,7 +36,6 @@ #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/client.h" -#include "mongo/db/db.h" #include "mongo/db/db_raii.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/dbtests/dbtests.h" diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp index be7576c76cb..c11fd2ac7d8 100644 --- a/src/mongo/dbtests/pdfiletests.cpp +++ b/src/mongo/dbtests/pdfiletests.cpp @@ -35,7 +35,6 @@ #include "mongo/db/catalog/collection.h" #include "mongo/db/client.h" -#include "mongo/db/db.h" #include "mongo/db/db_raii.h" #include "mongo/db/json.h" #include "mongo/db/ops/insert.h" diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index 702fda73690..a365c476b30 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -41,7 +41,6 @@ #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/client.h" #include "mongo/db/concurrency/write_conflict_exception.h" -#include "mongo/db/db.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/json.h" diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index a70c5570f8e..576732c5aea 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -44,7 +44,6 @@ #include "mongo/db/catalog/uuid_catalog.h" #include "mongo/db/client.h" #include "mongo/db/concurrency/write_conflict_exception.h" -#include "mongo/db/db.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/dbhelpers.h" diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp index 50767ace7e7..b1549bcb978 100644 --- a/src/mongo/dbtests/updatetests.cpp +++ b/src/mongo/dbtests/updatetests.cpp @@ -39,7 +39,6 @@ #include "mongo/client/dbclient_cursor.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/client.h" -#include "mongo/db/db.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/json.h" #include "mongo/db/lasterror.h" diff --git a/src/mongo/embedded/mongo_embedded/mongo_embedded.cpp b/src/mongo/embedded/mongo_embedded/mongo_embedded.cpp index 2fb44058843..dfa2e456f58 100644 --- a/src/mongo/embedded/mongo_embedded/mongo_embedded.cpp +++ b/src/mongo/embedded/mongo_embedded/mongo_embedded.cpp @@ -39,7 +39,6 @@ #include #include "mongo/db/client.h" -#include "mongo/db/dbmain.h" #include "mongo/db/service_context.h" #include "mongo/embedded/embedded.h" #include "mongo/embedded/embedded_log_appender.h" diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript index 82fd88b1b9f..32461b1369e 100644 --- a/src/mongo/util/SConscript +++ b/src/mongo/util/SConscript @@ -377,10 +377,8 @@ if env['MONGO_ALLOCATOR'] == 'tcmalloc': '$BUILD_DIR/mongo/db/commands/server_status', 'processinfo', ], - LIBDEPS_DEPENDENTS=[ - '$BUILD_DIR/mongo/mongodmain', - ], PROGDEPS_DEPENDENTS=[ + '$BUILD_DIR/mongo/mongod', '$BUILD_DIR/mongo/mongos', ], ) -- cgit v1.2.1