summaryrefslogtreecommitdiff
path: root/src/mongo/SConscript
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2020-05-17 16:41:54 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-27 16:10:48 +0000
commit17d9094752fec7dd29c9eedac9bd7cccb8cf8f6e (patch)
treee0e00f22fde4e42b99c92db6353e9fcde91b46f6 /src/mongo/SConscript
parent2de03a25a0a3dc8f7e675c33ff9e1b1370532d41 (diff)
downloadmongo-17d9094752fec7dd29c9eedac9bd7cccb8cf8f6e.tar.gz
SERVER-48272 Reduce startup time for dynamically linked binaries
Minimizing the list of NEEDED entries directly attached to the core programs reduces startup time for dynamically linked binaries by approximately 40 percent.
Diffstat (limited to 'src/mongo/SConscript')
-rw-r--r--src/mongo/SConscript396
1 files changed, 295 insertions, 101 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 346879db8b6..80447a02e6a 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -336,7 +336,7 @@ env.Library(
if env.TargetOSIs('windows'):
generatedDbManifest = env.Substfile(
- 'db/db.manifest.in',
+ 'db/mongod.manifest.in',
SUBST_DICT=[
('@mongo_version_major@', version_parts[0]),
('@mongo_version_minor@', version_parts[1]),
@@ -346,16 +346,45 @@ if env.TargetOSIs('windows'):
])
env.Alias('generated-sources', generatedDbManifest)
- env.Depends("db/db.res", generatedDbManifest)
+ env.Depends("db/mongod.res", generatedDbManifest)
mongod = env.Program(
target="mongod",
source=[
- 'db/db.cpp',
- 'db/logical_session_cache_factory_mongod.cpp',
- 'db/read_write_concern_defaults_cache_lookup_mongod.cpp',
- ] + env.WindowsResourceFile("db/db.rc"),
+ 'db/mongod.cpp'
+ ] + env.WindowsResourceFile("db/mongod.rc"),
+ LIBDEPS=[
+ # NOTE: Do not add new libdeps (public or private) here unless
+ # required by the linker to satisfy symbol dependencies from
+ # the files listed above in `sources`. If you need to add a
+ # library to inject a static or mongo initializer to mongod,
+ # please add that library as a private libdep of
+ # mongod_initializers.
+ 'base',
+ 'mongod_main',
+ 'util/quick_exit',
+ ],
+ AIB_COMPONENT="mongod",
+ AIB_COMPONENTS_EXTRA=[
+ "core",
+ "default",
+ "dist",
+ "dist-test",
+ "servers",
+ "integration-tests",
+ ],
+)
+
+env.Library(
+ target="mongod_initializers",
+ source=[
+ # NOTE: If you add an additional source file here, please delete
+ # the file db/mongod_initializers.cpp.
+ "db/mongod_initializers.cpp",
+ ],
LIBDEPS_PRIVATE=[
+ # NOTE: If you need to add a static or mongo initializer to mongod startup,
+ # please add that library here, as a private library dependency.
'$BUILD_DIR/third_party/shim_snappy',
'base',
'db/auth/auth_op_observer',
@@ -473,14 +502,90 @@ mongod = env.Program(
'util/version_impl',
'watchdog/watchdog_mongod',
],
- AIB_COMPONENT="mongod",
- AIB_COMPONENTS_EXTRA=[
- "core",
- "default",
- "dist",
- "dist-test",
- "servers",
- "integration-tests",
+ LIBDEPS=[
+ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE
+ ],
+)
+
+env.Library(
+ target="mongod_main",
+ source=[
+ 'db/mongod_main.cpp',
+ 'db/logical_session_cache_factory_mongod.cpp',
+ 'db/read_write_concern_defaults_cache_lookup_mongod.cpp',
+ ],
+ LIBDEPS_PRIVATE=[
+ # NOTE: Do not add new libdeps (public or private) here unless
+ # required by the linker to satisfy symbol dependencies from
+ # the files listed above in `sources`. If you need to add a
+ # library to inject a static or mongo initializer to mongod,
+ # please add that library as a private libdep of
+ # mongod_initializers.
+ 'base',
+ 'client/clientdriver_minimal',
+ 'db/auth/auth_op_observer',
+ 'db/catalog/catalog_impl',
+ 'db/catalog/collection',
+ 'db/catalog/health_log',
+ 'db/commands/mongod',
+ 'db/concurrency/flow_control_ticketholder',
+ 'db/concurrency/lock_manager',
+ 'db/free_mon/free_mon_mongod',
+ 'db/ftdc/ftdc_mongod',
+ 'db/index/index_access_method_factory',
+ 'db/index/index_access_methods',
+ 'db/index_builds_coordinator_mongod',
+ 'db/initialize_server_security_state',
+ 'db/initialize_snmp',
+ 'db/keys_collection_client_direct',
+ 'db/kill_sessions',
+ 'db/kill_sessions_local',
+ 'db/log_process_details',
+ 'db/logical_clock',
+ 'db/mirror_maestro',
+ 'db/mongod_options',
+ 'db/op_observer',
+ 'db/periodic_runner_job_abort_expired_transactions',
+ 'db/pipeline/process_interface/mongod_process_interface_factory',
+ 'db/repair_database_and_check_version',
+ 'db/repl/drop_pending_collection_reaper',
+ 'db/repl/repl_coordinator_impl',
+ 'db/repl/replication_recovery',
+ 'db/repl/serveronly_repl',
+ 'db/repl/storage_interface_impl',
+ 'db/repl/topology_coordinator',
+ 'db/s/op_observer_sharding_impl',
+ 'db/s/sessions_collection_config_server',
+ 'db/s/sharding_runtime_d',
+ 'db/serverinit',
+ 'db/service_context_d',
+ 'db/service_liaison_mongod',
+ 'db/sessions_collection_rs',
+ 'db/sessions_collection_standalone',
+ 'db/startup_warnings_mongod',
+ 'db/storage/backup_cursor_hooks',
+ 'db/storage/flow_control',
+ 'db/storage/flow_control_parameters',
+ 'db/storage/storage_control',
+ 'db/storage/storage_engine_common',
+ 'db/system_index',
+ 'db/ttl_d',
+ 'mongod_initializers',
+ 's/grid',
+ 's/sessions_collection_sharded',
+ 's/sessions_collection_sharded',
+ 'scripting/scripting',
+ 'transport/service_entry_point',
+ 'transport/transport_layer_manager',
+ 'util/cmdline_utils/cmdline_utils',
+ 'util/concurrency/thread_pool',
+ 'util/latch_analyzer' if get_option('use-diagnostic-latches') == 'on' else [],
+ 'util/net/ssl_manager',
+ 'util/signal_handlers',
+ 'watchdog/watchdog_mongod',
+ ],
+ LIBDEPS=[
+ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE
],
)
@@ -491,7 +596,7 @@ if not hygienic:
if env.TargetOSIs('windows'):
generatedServerManifest = env.Substfile(
- 's/server.manifest.in',
+ 's/mongos.manifest.in',
SUBST_DICT=[
('@mongo_version_major@', version_parts[0]),
('@mongo_version_minor@', version_parts[1]),
@@ -501,7 +606,7 @@ if env.TargetOSIs('windows'):
])
env.Alias('generated-sources', generatedServerManifest)
- env.Depends("s/server.res", generatedServerManifest)
+ env.Depends("s/mongos.res", generatedServerManifest)
mongotrafficreader = env.Program(
@@ -524,19 +629,39 @@ if not hygienic:
mongos = env.Program(
target='mongos',
source=[
- "db/read_write_concern_defaults_cache_lookup_mongos.cpp",
+ 's/mongos.cpp',
+ ] + env.WindowsResourceFile("s/mongos.rc"),
+ LIBDEPS=[
+ # NOTE: Do not add new libdeps (public or private) here unless
+ # required by the linker to satisfy symbol dependencies from
+ # the files listed above in `sources`. If you need to add a
+ # library to inject a static or mongo initializer to mongos,
+ # please add that library as a private libdep of
+ # mongos_initializers.
+ 'base',
+ 'mongos_main',
+ 'util/quick_exit'
+ ],
+ AIB_COMPONENT="mongos",
+ AIB_COMPONENTS_EXTRA=[
+ "core",
+ "dist",
+ "dist-test",
+ "servers",
+ "integration-tests",
+ ],
+)
+
+env.Library(
+ target='mongos_initializers',
+ source=[
's/cluster_cursor_stats.cpp',
- 's/mongos_options.cpp',
- 's/mongos_options_init.cpp',
- env.Idlc('s/mongos_options.idl')[0],
's/router_transactions_server_status.cpp',
's/s_sharding_server_status.cpp',
- 's/server.cpp',
- 's/service_entry_point_mongos.cpp',
- 's/sharding_uptime_reporter.cpp',
- 's/version_mongos.cpp',
- ] + env.WindowsResourceFile("s/server.rc"),
- LIBDEPS=[
+ ],
+ LIBDEPS_PRIVATE=[
+ # NOTE: If you need to add a static or mongo initializer to mongos startup,
+ # please add that library here, as a private library dependency.
'db/audit',
'db/auth/authmongos',
'db/commands/server_status',
@@ -576,76 +701,81 @@ mongos = env.Program(
'util/latch_analyzer' if get_option('use-diagnostic-latches') == 'on' else [],
'util/net/ssl_options_server' if get_option('ssl') == 'on' else '',
'util/ntservice',
+ 'util/options_parser/options_parser',
+ 'util/options_parser/options_parser_init',
'util/version_impl',
],
+ LIBDEPS=[
+ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE
+ ],
+)
+
+env.Library(
+ target='mongos_main',
+ source=[
+ 'db/read_write_concern_defaults_cache_lookup_mongos.cpp',
+ 's/mongos_main.cpp',
+ 's/mongos_options.cpp',
+ 's/mongos_options_init.cpp',
+ env.Idlc('s/mongos_options.idl')[0],
+ 's/service_entry_point_mongos.cpp',
+ 's/sharding_uptime_reporter.cpp',
+ 's/version_mongos.cpp',
+ ],
LIBDEPS_PRIVATE=[
- 'util/options_parser/options_parser_init',
- 'util/options_parser/options_parser',
+ # NOTE: Do not add new libdeps (public or private) here unless
+ # required by the linker to satisfy symbol dependencies from
+ # the files listed above in `sources`. If you need to add a
+ # library to inject a static or mongo initializer to mongos,
+ # please add that library as a private libdep of
+ # mongos_initializers.
+ 'db/audit',
+ 'db/auth/authmongos',
+ 'db/ftdc/ftdc_mongos',
+ 'db/initialize_server_security_state',
+ 'db/log_process_details',
+ 'db/read_write_concern_defaults',
+ 'db/serverinit',
+ 'db/service_liaison_mongos',
+ 'db/session_catalog',
+ 'db/startup_warnings_common',
+ 'mongos_initializers',
+ 's/client/sharding_client',
+ 's/cluster_last_error_info',
+ 's/commands/cluster_commands',
+ 's/committed_optime_metadata_hook',
+ 's/common_s',
+ 's/mongos_topology_coordinator',
+ 's/query/cluster_cursor_cleanup_job',
+ 's/sessions_collection_sharded',
+ 's/sharding_egress_metadata_hook_for_mongos',
+ 's/sharding_initialization',
+ 's/sharding_router_api',
+ 'transport/service_entry_point',
+ 'transport/transport_layer_manager',
+ 'util/latch_analyzer' if get_option('use-diagnostic-latches') == 'on' else [],
+ 'util/net/ssl_manager',
+ 'util/periodic_runner_factory',
+ 'util/signal_handlers',
+ ],
+ LIBDEPS=[
+ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE
],
- AIB_COMPONENT="mongos",
- AIB_COMPONENTS_EXTRA=[
- "core",
- "dist",
- "dist-test",
- "servers",
- "integration-tests",
- ]
)
+
if not hygienic:
env.Install('#/', mongos)
-env.Library("linenoise_utf8",
- source=[
- "shell/linenoise_utf8.cpp",
- ])
-
# --- shell ---
if not has_option('noshell') and usemozjs:
- shell_core_env = env.Clone()
- if has_option("safeshell"):
- shell_core_env.Append(CPPDEFINES=["MONGO_SAFE_SHELL"])
- shell_core_env.Library("shell_core",
- source=[
- "shell/linenoise.cpp",
- "shell/mk_wcwidth.cpp"
- ],
- LIBDEPS=[
- 'client/clientdriver_network',
- 'db/catalog/index_key_validate',
- 'db/logical_session_id_helpers',
- 'db/mongohasher',
- 'db/query/command_request_response',
- 'db/query/query_request',
- 'db/server_options_core',
- 'db/traffic_reader',
- 'linenoise_utf8',
- 'rpc/protocol',
- 'scripting/scripting',
- 'shell/benchrun',
- 'shell/mongojs',
- 'shell/shell_utils',
- 'transport/message_compressor',
- 'transport/transport_layer_manager',
- 'util/net/network',
- 'util/options_parser/options_parser_init',
- 'util/password',
- 'util/processinfo',
- 'util/signal_handlers',
- 'util/version_impl',
- 'executor/thread_pool_task_executor',
- 'executor/network_interface_thread_pool',
- 'executor/network_interface_factory'
- ],
- )
-
shellEnv = env.Clone()
if env.TargetOSIs('windows'):
shellEnv.Append(LIBS=["winmm.lib"])
generatedMongoManifest = shellEnv.Substfile(
- 'shell/shell.manifest.in',
+ 'shell/mongo.manifest.in',
SUBST_DICT=[
('@mongo_version_major@', version_parts[0]),
('@mongo_version_minor@', version_parts[1]),
@@ -654,31 +784,22 @@ if not has_option('noshell') and usemozjs:
('@mongo_version_extra_str@', version_extra),
])
shellEnv.Alias('generated-sources', generatedMongoManifest)
- shellEnv.Depends("shell/shell.res", generatedMongoManifest)
+ shellEnv.Depends("shell/mongo.res", generatedMongoManifest)
mongo_shell = shellEnv.Program(
- "mongo",
- [
- "shell/dbshell.cpp",
- "shell/mongodbcr.cpp",
- "shell/shell_options_init.cpp",
- ] + env.WindowsResourceFile("shell/shell.rc"),
+ target="mongo",
+ source=[
+ "shell/mongo.cpp",
+ ] + env.WindowsResourceFile("shell/mongo.rc"),
LIBDEPS=[
- "$BUILD_DIR/third_party/shim_pcrecpp",
- "shell_core",
- "db/server_options_core",
- "client/clientdriver_network",
- "shell/kms_shell" if get_option('ssl') == 'on' else '',
- "shell/encrypted_dbclient" if get_option('ssl') == 'on' else '',
- "$BUILD_DIR/mongo/util/password",
- '$BUILD_DIR/mongo/db/storage/duplicate_key_error_info',
- "$BUILD_DIR/mongo/db/views/resolved_view",
- ],
- LIBDEPS_PRIVATE=[
- 'shell/shell_options_register',
- 'transport/message_compressor_options_client',
- "$BUILD_DIR/mongo/client/connection_string",
- '$BUILD_DIR/mongo/util/net/ssl_options_client' if get_option('ssl') == 'on' else '',
+ # NOTE: Do not add new libdeps (public or private) here unless
+ # required by the linker to satisfy symbol dependencies from
+ # the files listed above in `sources`. If you need to add a
+ # library to inject a static or mongo initializer to mongo,
+ # please add that library as a private libdep of
+ # mongo_initializers.
+ 'base',
+ 'mongo_main',
],
AIB_COMPONENT="mongo",
AIB_COMPONENTS_EXTRA=[
@@ -690,6 +811,79 @@ if not has_option('noshell') and usemozjs:
],
)
+ env.Library(
+ target="mongo_initializers",
+ source=[
+ "shell/mongodbcr.cpp",
+ "shell/shell_options_init.cpp",
+ ],
+ LIBDEPS_PRIVATE=[
+ # NOTE: If you need to add a static or mongo initializer to mongo startup,
+ # please add that library here, as a private library dependency.
+ "$BUILD_DIR/third_party/shim_pcrecpp",
+ "client/clientdriver_network",
+ "client/connection_string",
+ "db/catalog/index_key_validate",
+ "db/logical_session_id_helpers",
+ "db/mongohasher",
+ "db/query/command_request_response",
+ "db/query/query_request",
+ "db/server_options_core",
+ "db/storage/duplicate_key_error_info",
+ "db/traffic_reader",
+ "db/views/resolved_view",
+ "executor/network_interface_factory",
+ "executor/network_interface_thread_pool",
+ "executor/thread_pool_task_executor",
+ "rpc/protocol",
+ "scripting/scripting",
+ "shell/benchrun",
+ "shell/encrypted_dbclient" if get_option('ssl') == 'on' else '',
+ "shell/kms_shell" if get_option('ssl') == 'on' else '',
+ "shell/mongojs",
+ "shell/shell_options_register",
+ "shell/shell_utils",
+ "transport/message_compressor",
+ "transport/message_compressor_options_client",
+ "transport/transport_layer_manager",
+ "util/net/network",
+ "util/net/ssl_options_client" if get_option('ssl') == 'on' else '',
+ "util/options_parser/options_parser_init",
+ "util/password",
+ "util/processinfo",
+ "util/signal_handlers",
+ "util/version_impl",
+ ],
+ LIBDEPS=[
+ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE
+ ],
+
+ )
+
+ env.Library(
+ target="mongo_main",
+ source=[
+ "shell/mongo_main.cpp",
+ ],
+ LIBDEPS_PRIVATE=[
+ # NOTE: Do not add new libdeps (public or private) here unless
+ # required by the linker to satisfy symbol dependencies from
+ # the files listed above in `sources`. If you need to add a
+ # library to inject a static or mongo initializer to mongo,
+ # please add that library as a private libdep of
+ # mongo_initializers.
+ "mongo_initializers",
+ "shell/linenoise",
+ "shell/shell_utils",
+ "transport/transport_layer",
+ "util/net/ssl_manager",
+ "util/signal_handlers",
+ ],
+ LIBDEPS=[
+ # NOTE: This list must remain empty. Please only add to LIBDEPS_PRIVATE
+ ],
+ )
+
if not hygienic:
shellEnv.Install( '#/', mongo_shell )
else: