summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2022-08-22 15:43:30 +0200
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-23 07:35:13 +0000
commit1b7901911131fd073092ff5833214b12eea4a0c3 (patch)
tree8d2ecb9988c0082d39ecc547c0182a7a7448746b /src
parentb99b5c3e242ff690b5127c5d672d226f7eaf5754 (diff)
downloadmongo-1b7901911131fd073092ff5833214b12eea4a0c3.tar.gz
SERVER-68826 Fold tenant_id into the server_base library
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/SConscript127
-rw-r--r--src/mongo/db/auth/SConscript3
-rw-r--r--src/mongo/db/catalog/SConscript2
-rw-r--r--src/mongo/db/commands/SConscript24
-rw-r--r--src/mongo/db/dbcommands.idl1
-rw-r--r--src/mongo/db/op_observer/SConscript4
-rw-r--r--src/mongo/db/op_observer/op_observer_impl_test.cpp6
-rw-r--r--src/mongo/db/op_observer/user_write_block_mode_op_observer_test.cpp42
-rw-r--r--src/mongo/db/repl/SConscript21
-rw-r--r--src/mongo/db/server_options_helpers.cpp19
-rw-r--r--src/mongo/db/serverless/SConscript2
-rw-r--r--src/mongo/idl/SConscript111
-rw-r--r--src/mongo/idl/cluster_server_parameter_initializer_test.cpp9
-rw-r--r--src/mongo/idl/cluster_server_parameter_op_observer_test.cpp7
-rw-r--r--src/mongo/idl/cluster_server_parameter_test_util.cpp114
-rw-r--r--src/mongo/idl/cluster_server_parameter_test_util.h84
-rw-r--r--src/mongo/idl/feature_flag.cpp2
-rw-r--r--src/mongo/idl/feature_flag.h1
-rw-r--r--src/mongo/idl/server_parameter.h37
-rw-r--r--src/mongo/idl/server_parameter_with_storage.h35
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.cpp2
-rw-r--r--src/mongo/s/SConscript1
22 files changed, 318 insertions, 336 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 0dc1c73cca7..f88ea43bac2 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -66,11 +66,25 @@ env.Library(
'namespace_string.cpp',
'shard_id.cpp',
'shutdown_in_progress_quiesce_info.cpp',
+ 'tenant_id.cpp',
], LIBDEPS=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/idl/idl_parser',
'$BUILD_DIR/mongo/idl/server_parameter',
+ 'logical_time',
])
+env.Library(
+ target='logical_time',
+ source=[
+ 'logical_time.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/idl/idl_parser',
+ ],
+)
+
#
# The db/'common' lib has the abstractions that are shared by components of the
# server. Ideally, many of the object in 'coredb' should be moved here when their dependencies
@@ -88,8 +102,8 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/db/catalog/cannot_convert_index_to_unique_info',
'$BUILD_DIR/mongo/db/repl/tenant_migration_errors',
- '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/write_concern_options',
+ 'server_base',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/catalog/collection_uuid_mismatch_info',
@@ -104,8 +118,8 @@ env.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/auth/security_token',
- '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/feature_flag',
+ 'server_base',
'server_feature_flags',
],
)
@@ -222,16 +236,6 @@ env.Library(
)
env.Library(
- target='tenant_id',
- source=[
- 'tenant_id.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- ],
-)
-
-env.Library(
target='update_index_data',
source=[
'update_index_data.cpp',
@@ -249,7 +253,7 @@ env.Library(
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/commands/server_status_core',
- '$BUILD_DIR/mongo/db/server_base',
+ 'server_base',
],
)
@@ -455,8 +459,9 @@ env.Library(
source=[
'change_stream_options.idl',
],
- LIBDEPS=[
+ LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/idl/cluster_server_parameter',
+ 'server_base',
],
)
@@ -474,17 +479,23 @@ env.Library(
env.Library(
target='change_streams_cluster_parameter',
- source=['change_streams_cluster_parameter.idl', 'change_streams_cluster_parameter.cpp'],
- LIBDEPS=[
+ source=[
+ 'change_streams_cluster_parameter.idl',
+ 'change_streams_cluster_parameter.cpp',
+ ],
+ LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/idl/cluster_server_parameter',
+ 'server_base',
],
)
env.Library(
target='change_stream_state',
- source=['change_stream_state.idl'],
- LIBDEPS=[
- '$BUILD_DIR/mongo/idl/idl_parser',
+ source=[
+ 'change_stream_state.idl',
+ ],
+ LIBDEPS_PRIVATE=[
+ 'server_base',
],
)
@@ -721,7 +732,7 @@ env.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/auth/authprivilege',
'$BUILD_DIR/mongo/db/timeseries/timeseries_options',
- '$BUILD_DIR/mongo/idl/idl_parser',
+ 'server_base',
],
)
@@ -730,12 +741,9 @@ env.Library(
source=[
'dbcommands.idl',
],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- ],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/pipeline/document_sources_idl',
- '$BUILD_DIR/mongo/idl/idl_parser',
+ 'server_base',
],
)
@@ -1126,21 +1134,21 @@ env.Library(
env.Library(
target='index_build_entry_helpers',
source=[
- "index_build_entry_helpers.cpp",
+ 'index_build_entry_helpers.cpp',
],
LIBDEPS_PRIVATE=[
- "$BUILD_DIR/mongo/base",
- "$BUILD_DIR/mongo/db/catalog/collection_crud",
- "$BUILD_DIR/mongo/db/catalog/commit_quorum_options",
- "$BUILD_DIR/mongo/db/catalog/index_build_entry_idl",
- "$BUILD_DIR/mongo/db/catalog/local_oplog_info",
- "$BUILD_DIR/mongo/db/concurrency/exception_util",
- "$BUILD_DIR/mongo/db/storage/write_unit_of_work",
- "catalog_raii",
- "db_raii",
- "dbhelpers",
- "server_base",
- "service_context",
+ '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/catalog/collection_crud',
+ '$BUILD_DIR/mongo/db/catalog/commit_quorum_options',
+ '$BUILD_DIR/mongo/db/catalog/index_build_entry_idl',
+ '$BUILD_DIR/mongo/db/catalog/local_oplog_info',
+ '$BUILD_DIR/mongo/db/concurrency/exception_util',
+ '$BUILD_DIR/mongo/db/storage/write_unit_of_work',
+ 'catalog_raii',
+ 'db_raii',
+ 'dbhelpers',
+ 'server_base',
+ 'service_context',
],
)
@@ -1671,7 +1679,7 @@ env.Library(
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/auth/authprivilege',
'$BUILD_DIR/mongo/db/catalog/commit_quorum_options',
- '$BUILD_DIR/mongo/idl/idl_parser',
+ 'server_base',
],
)
@@ -1725,24 +1733,12 @@ env.Library(
)
env.Library(
- target='logical_time',
- source=[
- 'logical_time.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/idl/idl_parser',
- ],
-)
-
-env.Library(
target='operation_time_tracker',
source=[
'operation_time_tracker.cpp',
],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- 'logical_time',
+ LIBDEPS_PRIVATE=[
+ 'server_base',
'service_context',
],
)
@@ -1753,12 +1749,12 @@ env.Library(
'operation_killer.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'service_context',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/auth/authprivilege',
+ 'server_base',
],
)
@@ -1789,9 +1785,9 @@ env.Library(
source=[
'signed_logical_time.cpp',
],
- LIBDEPS=[
+ LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/crypto/sha1_block',
- 'logical_time',
+ 'server_base',
],
)
@@ -1800,9 +1796,9 @@ env.Library(
source=[
'time_proof_service.cpp',
],
- LIBDEPS=[
+ LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/crypto/sha_block_${MONGO_CRYPTO}',
- 'logical_time',
+ 'server_base',
],
)
@@ -1822,8 +1818,8 @@ env.Library(
source=[
'keys_collection_document.idl',
],
- LIBDEPS=[
- 'logical_time',
+ LIBDEPS_PRIVATE=[
+ 'server_base',
'time_proof_service',
],
)
@@ -1834,13 +1830,13 @@ env.Library(
'keys_collection_client_direct.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client',
- '$BUILD_DIR/mongo/s/client/shard_interface',
'keys_collection_document',
- 'logical_time',
],
LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/s/catalog/sharding_catalog_client',
+ '$BUILD_DIR/mongo/s/client/shard_interface',
'rs_local_client',
+ 'server_base',
],
)
@@ -1852,7 +1848,6 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/s/catalog/sharding_catalog_client',
'keys_collection_document',
- 'logical_time',
'server_base',
],
)
@@ -1876,13 +1871,13 @@ env.Library(
'global_settings',
'keys_collection_client_sharded',
'keys_collection_document',
- 'logical_time',
'repl/repl_coordinator_interface',
'service_context',
'signed_logical_time',
'time_proof_service',
],
LIBDEPS_PRIVATE=[
+ 'server_base',
'server_options_core',
],
)
@@ -2060,7 +2055,6 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/repl/optime',
- '$BUILD_DIR/mongo/idl/idl_parser',
'server_base',
'service_context',
],
@@ -2581,8 +2575,6 @@ if wiredtiger:
'$BUILD_DIR/mongo/db/transaction/transaction',
'$BUILD_DIR/mongo/db/transaction/transaction_api',
'$BUILD_DIR/mongo/executor/async_timer_mock',
- '$BUILD_DIR/mongo/idl/idl_parser',
- '$BUILD_DIR/mongo/idl/server_parameter',
'$BUILD_DIR/mongo/rpc/command_status',
'$BUILD_DIR/mongo/rpc/rpc',
'$BUILD_DIR/mongo/transport/transport_layer_mock',
@@ -2603,7 +2595,6 @@ if wiredtiger:
'index_builds_coordinator_mongod',
'keys_collection_client_direct',
'keys_collection_document',
- 'logical_time',
'mirror_maestro',
'multitenancy',
'operation_time_tracker',
diff --git a/src/mongo/db/auth/SConscript b/src/mongo/db/auth/SConscript
index 2c1b7b228f1..02b87103153 100644
--- a/src/mongo/db/auth/SConscript
+++ b/src/mongo/db/auth/SConscript
@@ -17,7 +17,6 @@ env.Library(
'$BUILD_DIR/mongo/db/server_feature_flags',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/idl/feature_flag',
- '$BUILD_DIR/mongo/idl/idl_parser',
],
)
@@ -227,7 +226,6 @@ env.Library(
'$BUILD_DIR/mongo/db/audit', # audit:logLogout in AuthZSession.
'$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/stats/counters',
- '$BUILD_DIR/mongo/idl/server_parameter',
'$BUILD_DIR/mongo/util/caching',
'auth_types',
'auth_umc',
@@ -254,7 +252,6 @@ env.Library(
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/audit',
- '$BUILD_DIR/mongo/idl/server_parameter',
],
)
diff --git a/src/mongo/db/catalog/SConscript b/src/mongo/db/catalog/SConscript
index d8a180dd3c0..5c78a61f615 100644
--- a/src/mongo/db/catalog/SConscript
+++ b/src/mongo/db/catalog/SConscript
@@ -500,9 +500,9 @@ env.Library(
'local_oplog_info.cpp',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/db/logical_time',
'$BUILD_DIR/mongo/db/repl/optime',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/storage/flow_control',
'$BUILD_DIR/mongo/db/storage/record_store_base',
'$BUILD_DIR/mongo/db/vector_clock_mutable',
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index d058ade3878..56fc590f96f 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -197,6 +197,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/read_write_concern_defaults',
+ '$BUILD_DIR/mongo/db/server_base',
],
)
@@ -213,6 +214,7 @@ env.Library(
'$BUILD_DIR/mongo/db/auth/authentication_session',
'$BUILD_DIR/mongo/db/auth/cluster_auth_mode',
'$BUILD_DIR/mongo/db/commands',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/rpc/client_metadata',
'$BUILD_DIR/mongo/util/net/ssl_manager',
'test_commands_enabled',
@@ -269,8 +271,8 @@ env.Library(
'list_databases.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/auth/authprivilege',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/idl_parser',
],
)
@@ -281,8 +283,8 @@ env.Library(
'list_databases_for_all_tenants.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/auth/authprivilege',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/idl_parser',
],
)
@@ -293,13 +295,13 @@ env.Library(
'create.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/crypto/encrypted_field_config',
'$BUILD_DIR/mongo/db/auth/authprivilege',
'$BUILD_DIR/mongo/db/catalog/clustered_collection_options',
'$BUILD_DIR/mongo/db/catalog/collection_options',
'$BUILD_DIR/mongo/db/pipeline/change_stream_pre_and_post_images_options',
'$BUILD_DIR/mongo/db/query/query_knobs',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/server_options',
'$BUILD_DIR/mongo/db/timeseries/timeseries_options',
'$BUILD_DIR/mongo/idl/basic_types',
@@ -314,7 +316,7 @@ env.Library(
'validate_db_metadata.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/idl_parser',
],
)
@@ -325,7 +327,7 @@ env.Library(
'cluster_server_parameter_cmds.idl',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/cluster_server_parameter',
],
)
@@ -481,6 +483,7 @@ env.Library(
'set_user_write_block_mode.idl',
],
LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/idl_parser',
],
)
@@ -502,7 +505,7 @@ env.Library(
'set_feature_compatibility_version.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/idl/idl_parser',
+ '$BUILD_DIR/mongo/db/server_base',
'feature_compatibility_parsers',
],
)
@@ -514,7 +517,8 @@ env.Library(
'shutdown.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/idl/idl_parser',
+ '$BUILD_DIR/mongo/bson/bson_validate',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/util/fail_point',
],
)
@@ -559,7 +563,6 @@ env.Library(
'vote_commit_index_build.idl',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/client/clientdriver_minimal',
'$BUILD_DIR/mongo/crypto/fle_crypto',
'$BUILD_DIR/mongo/db/auth/address_restriction',
@@ -604,10 +607,10 @@ env.Library(
'$BUILD_DIR/mongo/db/s/sharding_runtime_d',
'$BUILD_DIR/mongo/db/s/transaction_coordinator',
'$BUILD_DIR/mongo/db/s/user_writes_recoverable_critical_section',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/server_options_core',
'$BUILD_DIR/mongo/db/serverless/shard_split_donor_service',
'$BUILD_DIR/mongo/db/set_change_stream_state_coordinator',
- '$BUILD_DIR/mongo/db/tenant_id',
'$BUILD_DIR/mongo/db/timeseries/timeseries_conversion_util',
'$BUILD_DIR/mongo/db/transaction/transaction_api',
'$BUILD_DIR/mongo/idl/idl_parser',
@@ -738,8 +741,8 @@ env.Library(
"txn_two_phase_commit_cmds.idl",
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/auth/authprivilege',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/idl_parser',
],
)
@@ -751,6 +754,7 @@ env.Library(
'map_reduce.idl',
],
LIBDEPS=[
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/write_concern_options',
'$BUILD_DIR/mongo/idl/idl_parser',
],
diff --git a/src/mongo/db/dbcommands.idl b/src/mongo/db/dbcommands.idl
index ce02d54cfbf..9717c066b3d 100644
--- a/src/mongo/db/dbcommands.idl
+++ b/src/mongo/db/dbcommands.idl
@@ -213,7 +213,6 @@ commands:
type: safeBool
default: false
-
repairDatabase:
description: |-
This command has been removed. If you would like to compact your data, use the 'compact' command.
diff --git a/src/mongo/db/op_observer/SConscript b/src/mongo/db/op_observer/SConscript
index 36cb605336f..e8470d90922 100644
--- a/src/mongo/db/op_observer/SConscript
+++ b/src/mongo/db/op_observer/SConscript
@@ -52,9 +52,9 @@ env.Library(
)
env.Library(
- target="op_observer_impl",
+ target='op_observer_impl',
source=[
- "op_observer_impl.cpp",
+ 'op_observer_impl.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/change_stream_pre_images_collection_manager',
diff --git a/src/mongo/db/op_observer/op_observer_impl_test.cpp b/src/mongo/db/op_observer/op_observer_impl_test.cpp
index 3dd8e485f33..6d46e174d88 100644
--- a/src/mongo/db/op_observer/op_observer_impl_test.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl_test.cpp
@@ -96,7 +96,7 @@ void beginRetryableWriteWithTxnNumber(
{*opCtx->getTxnNumber()},
boost::none /* autocommit */,
boost::none /* startTransaction */);
-};
+}
void beginNonRetryableTransactionWithTxnNumber(
OperationContext* opCtx,
@@ -110,7 +110,7 @@ void beginNonRetryableTransactionWithTxnNumber(
auto txnParticipant = TransactionParticipant::get(opCtx);
txnParticipant.beginOrContinue(
opCtx, {*opCtx->getTxnNumber()}, false /* autocommit */, true /* startTransaction */);
-};
+}
void beginRetryableInternalTransactionWithTxnNumber(
OperationContext* opCtx,
@@ -124,7 +124,7 @@ void beginRetryableInternalTransactionWithTxnNumber(
auto txnParticipant = TransactionParticipant::get(opCtx);
txnParticipant.beginOrContinue(
opCtx, {*opCtx->getTxnNumber()}, false /* autocommit */, true /* startTransaction */);
-};
+}
template <typename OpObserverType>
void commitUnpreparedTransaction(OperationContext* opCtx, OpObserverType& opObserver) {
diff --git a/src/mongo/db/op_observer/user_write_block_mode_op_observer_test.cpp b/src/mongo/db/op_observer/user_write_block_mode_op_observer_test.cpp
index ef82dda4aba..fcc62b5c39b 100644
--- a/src/mongo/db/op_observer/user_write_block_mode_op_observer_test.cpp
+++ b/src/mongo/db/op_observer/user_write_block_mode_op_observer_test.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/op_observer/user_write_block_mode_op_observer.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
@@ -68,6 +66,8 @@ protected:
const NamespaceString& nss,
bool shouldSucceed,
bool fromMigrate) {
+ ASSERT(nss.isValid());
+
UserWriteBlockModeOpObserver opObserver;
std::vector<InsertStatement> inserts;
CollectionUpdateArgs collectionUpdateArgs;
@@ -106,7 +106,7 @@ protected:
runCUD(opCtx, nss, shouldSucceed, fromMigrate);
UserWriteBlockModeOpObserver opObserver;
auto uuid = UUID::gen();
- NamespaceString adminNss = NamespaceString("admin");
+ NamespaceString adminNss = NamespaceString("admin.collForRename");
if (shouldSucceed) {
try {
@@ -193,10 +193,10 @@ TEST_F(UserWriteBlockModeOpObserverTest, WriteBlockingDisabledNoBypass) {
ASSERT(!WriteBlockBypass::get(opCtx.get()).isWriteBlockBypassEnabled());
// Ensure writes succeed
- runCheckedOps(opCtx.get(), NamespaceString("a.b"), true);
- runCheckedOps(opCtx.get(), NamespaceString("admin"), true);
- runCheckedOps(opCtx.get(), NamespaceString("local"), true);
- runCheckedOps(opCtx.get(), NamespaceString("config"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("userDB.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("admin.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("local.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("config.coll"), true);
}
TEST_F(UserWriteBlockModeOpObserverTest, WriteBlockingDisabledWithBypass) {
@@ -213,10 +213,10 @@ TEST_F(UserWriteBlockModeOpObserverTest, WriteBlockingDisabledWithBypass) {
ASSERT(WriteBlockBypass::get(opCtx.get()).isWriteBlockBypassEnabled());
// Ensure writes succeed
- runCheckedOps(opCtx.get(), NamespaceString("a.b"), true);
- runCheckedOps(opCtx.get(), NamespaceString("admin"), true);
- runCheckedOps(opCtx.get(), NamespaceString("local"), true);
- runCheckedOps(opCtx.get(), NamespaceString("config"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("userDB.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("admin.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("local.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("config.coll"), true);
}
TEST_F(UserWriteBlockModeOpObserverTest, WriteBlockingEnabledNoBypass) {
@@ -228,17 +228,17 @@ TEST_F(UserWriteBlockModeOpObserverTest, WriteBlockingEnabledNoBypass) {
ASSERT(!WriteBlockBypass::get(opCtx.get()).isWriteBlockBypassEnabled());
// Ensure user writes now fail, while non-user writes still succeed
- runCheckedOps(opCtx.get(), NamespaceString("a.b"), false);
- runCheckedOps(opCtx.get(), NamespaceString("admin"), true);
- runCheckedOps(opCtx.get(), NamespaceString("local"), true);
- runCheckedOps(opCtx.get(), NamespaceString("config"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("userDB.coll"), false);
+ runCheckedOps(opCtx.get(), NamespaceString("admin.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("local.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("config.coll"), true);
// Ensure that CUD ops from migrations succeed
- runCUD(opCtx.get(), NamespaceString("a.b"), true, true /* fromMigrate */);
+ runCUD(opCtx.get(), NamespaceString("userDB.coll"), true, true /* fromMigrate */);
// Ensure that writes to the <db>.system.profile collections are always allowed
runCUD(opCtx.get(),
- NamespaceString("a.system.profile"),
+ NamespaceString("userDB.system.profile"),
true /* shouldSucceed */,
false /* fromMigrate */);
}
@@ -258,10 +258,10 @@ TEST_F(UserWriteBlockModeOpObserverTest, WriteBlockingEnabledWithBypass) {
// Ensure user writes succeed
- runCheckedOps(opCtx.get(), NamespaceString("a.b"), true);
- runCheckedOps(opCtx.get(), NamespaceString("admin"), true);
- runCheckedOps(opCtx.get(), NamespaceString("local"), true);
- runCheckedOps(opCtx.get(), NamespaceString("config"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("userDB.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("admin.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("local.coll"), true);
+ runCheckedOps(opCtx.get(), NamespaceString("config.coll"), true);
}
} // namespace
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 86375b32dd2..3b679cf43ce 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -841,21 +841,20 @@ env.Library(
env.Library(
'read_concern_args',
- [
+ source=[
'read_concern_args.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/bson/util/bson_extract',
- '$BUILD_DIR/mongo/db/logical_time',
'$BUILD_DIR/mongo/db/read_write_concern_provenance',
+ '$BUILD_DIR/mongo/db/server_base',
'optime',
],
)
env.Library(
'speculative_majority_read_info',
- [
+ source=[
'speculative_majority_read_info.cpp',
],
LIBDEPS=[
@@ -1267,16 +1266,14 @@ env.Library(
)
env.Library(
- target="hello_command",
+ target='hello_command',
source=[
- "hello.idl",
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
+ 'hello.idl',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/auth/authprivilege',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/idl/idl_parser',
'$BUILD_DIR/mongo/rpc/metadata',
'optime',
@@ -1489,7 +1486,6 @@ env.Library(
'sync_source_feedback.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/client/clientdriver_network',
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/change_stream_pre_images_collection_manager',
@@ -1497,10 +1493,10 @@ env.Library(
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/curop',
'$BUILD_DIR/mongo/db/free_mon/free_mon_mongod',
- '$BUILD_DIR/mongo/db/logical_time',
'$BUILD_DIR/mongo/db/not_primary_error_tracker',
'$BUILD_DIR/mongo/db/op_observer/op_observer',
'$BUILD_DIR/mongo/db/query_exec',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/session/kill_sessions_local',
'$BUILD_DIR/mongo/db/stats/counters',
@@ -1696,7 +1692,6 @@ if wiredtiger:
'tenant_migration_recipient_service_test.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/bson/mutable/mutable_bson',
'$BUILD_DIR/mongo/client/replica_set_monitor_protocol_test_util',
'$BUILD_DIR/mongo/db/auth/authmocks',
@@ -1711,13 +1706,13 @@ if wiredtiger:
'$BUILD_DIR/mongo/db/index/index_access_methods',
'$BUILD_DIR/mongo/db/index_build_entry_helpers',
'$BUILD_DIR/mongo/db/index_builds_coordinator_mongod',
- '$BUILD_DIR/mongo/db/logical_time',
'$BUILD_DIR/mongo/db/multitenancy',
'$BUILD_DIR/mongo/db/op_observer/op_observer_impl',
'$BUILD_DIR/mongo/db/op_observer/oplog_writer_impl',
'$BUILD_DIR/mongo/db/pipeline/change_stream_expired_pre_image_remover',
'$BUILD_DIR/mongo/db/query/command_request_response',
'$BUILD_DIR/mongo/db/s/sharding_runtime_d',
+ '$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/service_context_d_test_fixture',
'$BUILD_DIR/mongo/db/service_context_test_fixture',
'$BUILD_DIR/mongo/db/session/logical_session_id_helpers',
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index 9d19006ee7a..a7f583b4a28 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -27,7 +27,6 @@
* it in the license file.
*/
-
#include "mongo/db/server_options_helpers.h"
#ifdef _WIN32
@@ -63,10 +62,6 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl
-
-using std::endl;
-using std::string;
-
namespace mongo {
/*
@@ -311,7 +306,8 @@ Status storeBaseOptions(const moe::Environment& params) {
if (component == logv2::LogComponent::kDefault) {
continue;
}
- const string dottedName = "systemLog.component." + component.getDottedName() + ".verbosity";
+ const std::string dottedName =
+ "systemLog.component." + component.getDottedName() + ".verbosity";
if (params.count(dottedName)) {
int verbosity = params[dottedName].as<int>();
// Clear existing log level if log level is negative.
@@ -339,7 +335,7 @@ Status storeBaseOptions(const moe::Environment& params) {
}
if (params.count("systemLog.timeStampFormat")) {
- std::string formatterName = params["systemLog.timeStampFormat"].as<string>();
+ std::string formatterName = params["systemLog.timeStampFormat"].as<std::string>();
if (formatterName == "iso8601-utc") {
serverGlobalParams.logTimestampFormat = logv2::LogTimestampFormat::kISO8601UTC;
setDateFormatIsLocalTimezone(false);
@@ -386,7 +382,7 @@ Status storeBaseOptions(const moe::Environment& params) {
#ifndef _WIN32
if (params.count("systemLog.syslogFacility")) {
- std::string facility = params["systemLog.syslogFacility"].as<string>();
+ std::string facility = params["systemLog.syslogFacility"].as<std::string>();
bool set = false;
// match facility string to facility value
size_t facilitynamesLength = sizeof(facilitynames) / sizeof(facilitynames[0]);
@@ -413,7 +409,7 @@ Status storeBaseOptions(const moe::Environment& params) {
}
if (params.count("systemLog.logRotate")) {
- std::string logRotateParam = params["systemLog.logRotate"].as<string>();
+ std::string logRotateParam = params["systemLog.logRotate"].as<std::string>();
if (logRotateParam == "reopen") {
serverGlobalParams.logRenameOnRotate = false;
@@ -434,11 +430,12 @@ Status storeBaseOptions(const moe::Environment& params) {
}
if (params.count("processManagement.pidFilePath")) {
- serverGlobalParams.pidFile = params["processManagement.pidFilePath"].as<string>();
+ serverGlobalParams.pidFile = params["processManagement.pidFilePath"].as<std::string>();
}
if (params.count("processManagement.timeZoneInfo")) {
- serverGlobalParams.timeZoneInfoPath = params["processManagement.timeZoneInfo"].as<string>();
+ serverGlobalParams.timeZoneInfoPath =
+ params["processManagement.timeZoneInfo"].as<std::string>();
}
if (params.count("setParameter")) {
diff --git a/src/mongo/db/serverless/SConscript b/src/mongo/db/serverless/SConscript
index d5095b1e091..c58adf801ac 100644
--- a/src/mongo/db/serverless/SConscript
+++ b/src/mongo/db/serverless/SConscript
@@ -69,7 +69,6 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/repl/primary_only_service',
- '$BUILD_DIR/mongo/db/repl/replica_set_messages',
'shard_split_state_machine',
],
LIBDEPS_PRIVATE=[
@@ -79,6 +78,7 @@ env.Library(
'$BUILD_DIR/mongo/db/dbhelpers',
'$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
'$BUILD_DIR/mongo/db/repl/oplog',
+ '$BUILD_DIR/mongo/db/repl/replica_set_messages',
'$BUILD_DIR/mongo/db/repl/tenant_migration_access_blocker',
'$BUILD_DIR/mongo/db/server_base',
'shard_split_utils',
diff --git a/src/mongo/idl/SConscript b/src/mongo/idl/SConscript
index 9c3bf56494a..b9392845fab 100644
--- a/src/mongo/idl/SConscript
+++ b/src/mongo/idl/SConscript
@@ -3,34 +3,27 @@ Import("env")
env = env.Clone()
-env.Command(
- target=[
- 'feature_flag_test.idl',
- ],
+env.Library(
+ target='idl_parser',
source=[
- '#buildscripts/cheetah_source_generator.py',
- 'feature_flag_test.idl.tpl',
- '$BUILD_DIR/mongo/util/version/releases.yml',
+ 'command_generic_argument.cpp',
+ 'generic_argument.idl',
+ 'idl_parser.cpp',
],
- action=[
- '$PYTHON ${SOURCES[0]} -o ${TARGETS[0]} ${SOURCES[1]} ${SOURCES[2]} ${MONGO_VERSION}',
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/commands/server_status_core',
],
- # Ensure that that SCons is used to produce this file rather than Ninja, to avoid spurious
- # dependency cycles due to how we manage generated sources with Ninja.
- NINJA_TEMPLATE=True,
)
env.Library(
- target="idl_parser",
+ target='basic_types',
source=[
- 'command_generic_argument.cpp',
- 'generic_argument.idl',
- 'idl_parser.cpp',
+ 'basic_types.idl',
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
- '$BUILD_DIR/mongo/db/commands/server_status_core',
- '$BUILD_DIR/mongo/db/tenant_id',
+ 'idl_parser',
],
)
@@ -39,13 +32,12 @@ env.Library(
source=[
'server_parameter.cpp',
'server_parameter.idl',
- 'server_parameter_with_storage.cpp',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/logical_time',
],
LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/util/options_parser/options_parser',
],
)
@@ -54,9 +46,10 @@ env.Library(
target='cluster_server_parameter',
source=[
'cluster_server_parameter.idl',
+ 'server_parameter_with_storage.cpp',
],
- LIBDEPS=[
- '$BUILD_DIR/mongo/db/logical_time',
+ LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/db/server_base',
'feature_flag',
],
)
@@ -107,43 +100,15 @@ env.Library(
],
)
-env.Library(
- target='cluster_server_parameter_test_parameter',
- source=[
- 'cluster_server_parameter_test.idl',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- 'cluster_server_parameter',
- ],
-)
-
-env.CppUnitTest(
- target='cluster_server_parameter_op_observer_test',
- source=[
- 'cluster_server_parameter_op_observer_test.cpp',
- ],
- LIBDEPS=[
- '$BUILD_DIR/mongo/db/auth/authmocks',
- '$BUILD_DIR/mongo/db/change_stream_options_manager',
- '$BUILD_DIR/mongo/db/repl/oplog',
- '$BUILD_DIR/mongo/db/repl/oplog_interface_local',
- '$BUILD_DIR/mongo/db/repl/replmocks',
- '$BUILD_DIR/mongo/db/repl/storage_interface_impl',
- '$BUILD_DIR/mongo/db/service_context_d_test_fixture',
- '$BUILD_DIR/mongo/util/signal_handlers',
- 'cluster_server_parameter_op_observer',
- 'cluster_server_parameter_test_parameter',
- ],
-)
-
env.CppUnitTest(
- target='cluster_server_parameter_initializer_test',
+ target='cluster_server_parameter_test',
source=[
'cluster_server_parameter_initializer_test.cpp',
+ 'cluster_server_parameter_op_observer_test.cpp',
+ 'cluster_server_parameter_test_util.cpp',
+ 'cluster_server_parameter_test.idl',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/db/audit',
'$BUILD_DIR/mongo/db/auth/authmocks',
'$BUILD_DIR/mongo/db/change_stream_options_manager',
'$BUILD_DIR/mongo/db/repl/oplog',
@@ -152,8 +117,9 @@ env.CppUnitTest(
'$BUILD_DIR/mongo/db/repl/storage_interface_impl',
'$BUILD_DIR/mongo/db/service_context_d_test_fixture',
'$BUILD_DIR/mongo/util/signal_handlers',
+ 'cluster_server_parameter',
'cluster_server_parameter_initializer',
- 'cluster_server_parameter_test_parameter',
+ 'cluster_server_parameter_op_observer',
],
)
@@ -161,52 +127,57 @@ env.Library(
target='feature_flag',
source=[
'feature_flag.cpp',
- 'feature_flag_test.idl',
],
LIBDEPS=[
- '$BUILD_DIR/mongo/base',
'server_parameter',
],
LIBDEPS_PRIVATE=[
+ '$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/commands/feature_compatibility_parsers',
'$BUILD_DIR/mongo/util/options_parser/options_parser',
],
)
-env.Library(
- target='basic_types',
+env.Command(
+ target=[
+ 'feature_flag_test.idl',
+ ],
source=[
- 'basic_types.idl',
+ '#buildscripts/cheetah_source_generator.py',
+ 'feature_flag_test.idl.tpl',
+ '$BUILD_DIR/mongo/util/version/releases.yml',
],
- LIBDEPS=[
- '$BUILD_DIR/mongo/base',
- 'idl_parser',
+ action=[
+ '$PYTHON ${SOURCES[0]} -o ${TARGETS[0]} ${SOURCES[1]} ${SOURCES[2]} ${MONGO_VERSION}',
],
+ # Ensure that that SCons is used to produce this file rather than Ninja, to avoid spurious
+ # dependency cycles due to how we manage generated sources with Ninja.
+ NINJA_TEMPLATE=True,
)
env.CppUnitTest(
target='idl_test',
source=[
- 'config_option_test.cpp',
'command_generic_argument_test.cpp',
+ 'config_option_no_init_test.idl',
+ 'config_option_test.cpp',
+ 'config_option_test.idl',
'feature_flag_test.cpp',
+ 'feature_flag_test.idl',
'idl_test.cpp',
'server_parameter_specialized_test.cpp',
- 'server_parameter_with_storage_test.cpp',
- 'config_option_no_init_test.idl',
- 'config_option_test.idl',
'server_parameter_specialized_test.idl',
- 'server_parameter_with_storage_test.idl',
'server_parameter_with_storage_test_structs.idl',
- 'unittest.idl',
+ 'server_parameter_with_storage_test.cpp',
+ 'server_parameter_with_storage_test.idl',
'unittest_import.idl',
+ 'unittest.idl',
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/auth/authprivilege',
'$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/db/server_options_core',
'$BUILD_DIR/mongo/db/service_context',
- '$BUILD_DIR/mongo/idl/idl_parser',
'$BUILD_DIR/mongo/util/cmdline_utils/cmdline_utils',
'$BUILD_DIR/mongo/util/options_parser/options_parser',
'basic_types',
diff --git a/src/mongo/idl/cluster_server_parameter_initializer_test.cpp b/src/mongo/idl/cluster_server_parameter_initializer_test.cpp
index 4c02966bf98..dbaa34e9071 100644
--- a/src/mongo/idl/cluster_server_parameter_initializer_test.cpp
+++ b/src/mongo/idl/cluster_server_parameter_initializer_test.cpp
@@ -27,23 +27,16 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/idl/cluster_server_parameter_test_util.h"
-
#include "mongo/db/change_stream_options_manager.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/repl/storage_interface_mock.h"
#include "mongo/db/service_context_d_test_fixture.h"
-#include "mongo/idl/cluster_server_parameter_gen.h"
#include "mongo/idl/cluster_server_parameter_initializer.h"
-#include "mongo/idl/cluster_server_parameter_test_gen.h"
+#include "mongo/idl/cluster_server_parameter_test_util.h"
#include "mongo/idl/server_parameter.h"
#include "mongo/logv2/log.h"
#include "mongo/s/write_ops/batched_command_response.h"
-#include "mongo/unittest/unittest.h"
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl
diff --git a/src/mongo/idl/cluster_server_parameter_op_observer_test.cpp b/src/mongo/idl/cluster_server_parameter_op_observer_test.cpp
index f748f4f345b..817ea0033f4 100644
--- a/src/mongo/idl/cluster_server_parameter_op_observer_test.cpp
+++ b/src/mongo/idl/cluster_server_parameter_op_observer_test.cpp
@@ -27,17 +27,12 @@
* it in the license file.
*/
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/idl/cluster_server_parameter_test_util.h"
-
#include "mongo/idl/cluster_server_parameter_op_observer.h"
+#include "mongo/idl/cluster_server_parameter_test_util.h"
#include "mongo/logv2/log.h"
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl
-
namespace mongo {
namespace {
using namespace cluster_server_parameter_test_util;
diff --git a/src/mongo/idl/cluster_server_parameter_test_util.cpp b/src/mongo/idl/cluster_server_parameter_test_util.cpp
new file mode 100644
index 00000000000..11555e7cbb9
--- /dev/null
+++ b/src/mongo/idl/cluster_server_parameter_test_util.cpp
@@ -0,0 +1,114 @@
+/**
+ * Copyright (C) 2022-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
+ * <http://www.mongodb.com/licensing/server-side-public-license>.
+ *
+ * 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/idl/cluster_server_parameter_test_util.h"
+
+namespace mongo {
+namespace cluster_server_parameter_test_util {
+
+void upsert(BSONObj doc) {
+ const auto kMajorityWriteConcern = BSON("writeConcern" << BSON("w"
+ << "majority"));
+
+ auto uniqueOpCtx = cc().makeOperationContext();
+ auto* opCtx = uniqueOpCtx.get();
+
+ BSONObj res;
+ DBDirectClient client(opCtx);
+
+ client.runCommand(
+ kConfigDB.toString(),
+ [&] {
+ write_ops::UpdateCommandRequest updateOp(NamespaceString::kClusterParametersNamespace);
+ updateOp.setUpdates({[&] {
+ write_ops::UpdateOpEntry entry;
+ entry.setQ(BSON(ClusterServerParameter::k_idFieldName << kCSPTest));
+ entry.setU(
+ write_ops::UpdateModification::parseFromClassicUpdate(BSON("$set" << doc)));
+ entry.setMulti(false);
+ entry.setUpsert(true);
+ return entry;
+ }()});
+ return updateOp.toBSON(kMajorityWriteConcern);
+ }(),
+ res);
+
+ BatchedCommandResponse response;
+ std::string errmsg;
+ if (!response.parseBSON(res, &errmsg)) {
+ uasserted(ErrorCodes::FailedToParse, str::stream() << "Failure: " << errmsg);
+ }
+
+ uassertStatusOK(response.toStatus());
+ uassert(ErrorCodes::OperationFailed, "No documents upserted", response.getN());
+}
+
+void remove() {
+ auto uniqueOpCtx = cc().makeOperationContext();
+ auto* opCtx = uniqueOpCtx.get();
+
+ BSONObj res;
+ DBDirectClient(opCtx).runCommand(
+ kConfigDB.toString(),
+ [] {
+ write_ops::DeleteCommandRequest deleteOp(NamespaceString::kClusterParametersNamespace);
+ deleteOp.setDeletes({[] {
+ write_ops::DeleteOpEntry entry;
+ entry.setQ(BSON(ClusterServerParameter::k_idFieldName << kCSPTest));
+ entry.setMulti(true);
+ return entry;
+ }()});
+ return deleteOp.toBSON({});
+ }(),
+ res);
+
+ BatchedCommandResponse response;
+ std::string errmsg;
+ if (!response.parseBSON(res, &errmsg)) {
+ uasserted(ErrorCodes::FailedToParse,
+ str::stream() << "Failed to parse reply to delete command: " << errmsg);
+ }
+ uassertStatusOK(response.toStatus());
+}
+
+BSONObj makeClusterParametersDoc(const LogicalTime& cpTime, int intValue, StringData strValue) {
+ ClusterServerParameter csp;
+ csp.set_id(kCSPTest);
+ csp.setClusterParameterTime(cpTime);
+
+ ClusterServerParameterTest cspt;
+ cspt.setClusterServerParameter(std::move(csp));
+ cspt.setIntValue(intValue);
+ cspt.setStrValue(strValue);
+
+ return cspt.toBSON();
+}
+
+} // namespace cluster_server_parameter_test_util
+} // namespace mongo
diff --git a/src/mongo/idl/cluster_server_parameter_test_util.h b/src/mongo/idl/cluster_server_parameter_test_util.h
index 095dbf213b3..0cbd4dd4967 100644
--- a/src/mongo/idl/cluster_server_parameter_test_util.h
+++ b/src/mongo/idl/cluster_server_parameter_test_util.h
@@ -29,8 +29,6 @@
#pragma once
-#include "mongo/platform/basic.h"
-
#include "mongo/db/change_stream_options_manager.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
@@ -48,84 +46,6 @@ constexpr auto kCSPTest = "cspTest"_sd;
constexpr auto kConfigDB = "config"_sd;
const auto kNilCPT = LogicalTime::kUninitialized;
-void upsert(BSONObj doc) {
- const auto kMajorityWriteConcern = BSON("writeConcern" << BSON("w"
- << "majority"));
-
- auto uniqueOpCtx = cc().makeOperationContext();
- auto* opCtx = uniqueOpCtx.get();
-
- BSONObj res;
- DBDirectClient client(opCtx);
-
- client.runCommand(
- kConfigDB.toString(),
- [&] {
- write_ops::UpdateCommandRequest updateOp(NamespaceString::kClusterParametersNamespace);
- updateOp.setUpdates({[&] {
- write_ops::UpdateOpEntry entry;
- entry.setQ(BSON(ClusterServerParameter::k_idFieldName << kCSPTest));
- entry.setU(
- write_ops::UpdateModification::parseFromClassicUpdate(BSON("$set" << doc)));
- entry.setMulti(false);
- entry.setUpsert(true);
- return entry;
- }()});
- return updateOp.toBSON(kMajorityWriteConcern);
- }(),
- res);
-
- BatchedCommandResponse response;
- std::string errmsg;
- if (!response.parseBSON(res, &errmsg)) {
- uasserted(ErrorCodes::FailedToParse, str::stream() << "Failure: " << errmsg);
- }
-
- uassertStatusOK(response.toStatus());
- uassert(ErrorCodes::OperationFailed, "No documents upserted", response.getN());
-}
-
-void remove() {
- auto uniqueOpCtx = cc().makeOperationContext();
- auto* opCtx = uniqueOpCtx.get();
-
- BSONObj res;
- DBDirectClient(opCtx).runCommand(
- kConfigDB.toString(),
- [] {
- write_ops::DeleteCommandRequest deleteOp(NamespaceString::kClusterParametersNamespace);
- deleteOp.setDeletes({[] {
- write_ops::DeleteOpEntry entry;
- entry.setQ(BSON(ClusterServerParameter::k_idFieldName << kCSPTest));
- entry.setMulti(true);
- return entry;
- }()});
- return deleteOp.toBSON({});
- }(),
- res);
-
- BatchedCommandResponse response;
- std::string errmsg;
- if (!response.parseBSON(res, &errmsg)) {
- uasserted(ErrorCodes::FailedToParse,
- str::stream() << "Failed to parse reply to delete command: " << errmsg);
- }
- uassertStatusOK(response.toStatus());
-}
-
-BSONObj makeClusterParametersDoc(const LogicalTime& cpTime, int intValue, StringData strValue) {
- ClusterServerParameter csp;
- csp.set_id(kCSPTest);
- csp.setClusterParameterTime(cpTime);
-
- ClusterServerParameterTest cspt;
- cspt.setClusterServerParameter(std::move(csp));
- cspt.setIntValue(intValue);
- cspt.setStrValue(strValue);
-
- return cspt.toBSON();
-}
-
class ClusterServerParameterTestBase : public ServiceContextMongoDTest {
public:
virtual void setUp() override {
@@ -164,5 +84,9 @@ private:
}
};
+void upsert(BSONObj doc);
+void remove();
+BSONObj makeClusterParametersDoc(const LogicalTime& cpTime, int intValue, StringData strValue);
+
} // namespace cluster_server_parameter_test_util
} // namespace mongo
diff --git a/src/mongo/idl/feature_flag.cpp b/src/mongo/idl/feature_flag.cpp
index a6c7a44c994..8b2c72b8711 100644
--- a/src/mongo/idl/feature_flag.cpp
+++ b/src/mongo/idl/feature_flag.cpp
@@ -28,7 +28,9 @@
*/
#include "mongo/idl/feature_flag.h"
+
#include "mongo/db/commands/feature_compatibility_version_parser.h"
+#include "mongo/idl/server_parameter.h"
#include "mongo/util/debug_util.h"
#include "mongo/util/version/releases.h"
diff --git a/src/mongo/idl/feature_flag.h b/src/mongo/idl/feature_flag.h
index caba5eb3a67..eb415800d2b 100644
--- a/src/mongo/idl/feature_flag.h
+++ b/src/mongo/idl/feature_flag.h
@@ -35,7 +35,6 @@
#include "mongo/db/commands/feature_compatibility_version_parser.h"
#include "mongo/db/server_options.h"
#include "mongo/idl/server_parameter.h"
-#include "mongo/idl/server_parameter_with_storage.h"
#include "mongo/util/version/releases.h"
namespace mongo {
diff --git a/src/mongo/idl/server_parameter.h b/src/mongo/idl/server_parameter.h
index 3df716a146b..71960aa91a6 100644
--- a/src/mongo/idl/server_parameter.h
+++ b/src/mongo/idl/server_parameter.h
@@ -310,4 +310,41 @@ inline IDLServerParameterDeprecatedAlias* makeIDLServerParameterDeprecatedAlias(
return p.release();
}
+namespace idl_server_parameter_detail {
+
+template <typename T>
+inline StatusWith<T> coerceFromString(StringData str) {
+ T value;
+ Status status = NumberParser{}(str, &value);
+ if (!status.isOK()) {
+ return status;
+ }
+ return value;
+}
+
+template <>
+inline StatusWith<bool> coerceFromString<bool>(StringData str) {
+ if ((str == "1") || (str == "true")) {
+ return true;
+ }
+ if ((str == "0") || (str == "false")) {
+ return false;
+ }
+ return {ErrorCodes::BadValue, "Value is not a valid boolean"};
+}
+
+template <>
+inline StatusWith<std::string> coerceFromString<std::string>(StringData str) {
+ return str.toString();
+}
+
+template <>
+inline StatusWith<std::vector<std::string>> coerceFromString<std::vector<std::string>>(
+ StringData str) {
+ std::vector<std::string> v;
+ str::splitStringDelim(str.toString(), &v, ',');
+ return v;
+}
+
+} // namespace idl_server_parameter_detail
} // namespace mongo
diff --git a/src/mongo/idl/server_parameter_with_storage.h b/src/mongo/idl/server_parameter_with_storage.h
index 7db27ba1291..787eb49b135 100644
--- a/src/mongo/idl/server_parameter_with_storage.h
+++ b/src/mongo/idl/server_parameter_with_storage.h
@@ -66,41 +66,8 @@ using TenantIdMap = std::map<boost::optional<TenantId>, U>;
namespace idl_server_parameter_detail {
-template <typename T>
-inline StatusWith<T> coerceFromString(StringData str) {
- T value;
- Status status = NumberParser{}(str, &value);
- if (!status.isOK()) {
- return status;
- }
- return value;
-}
-
-template <>
-inline StatusWith<bool> coerceFromString<bool>(StringData str) {
- if ((str == "1") || (str == "true")) {
- return true;
- }
- if ((str == "0") || (str == "false")) {
- return false;
- }
- return {ErrorCodes::BadValue, "Value is not a valid boolean"};
-}
-
-template <>
-inline StatusWith<std::string> coerceFromString<std::string>(StringData str) {
- return str.toString();
-}
-
-template <>
-inline StatusWith<std::vector<std::string>> coerceFromString<std::vector<std::string>>(
- StringData str) {
- std::vector<std::string> v;
- str::splitStringDelim(str.toString(), &v, ',');
- return v;
-}
+// Predicate rules for bounds conditions
-// Predicate rules for bounds conditions.
struct GT {
static constexpr StringData description = "greater than"_sd;
template <typename T, typename U>
diff --git a/src/mongo/idl/server_parameter_with_storage_test.cpp b/src/mongo/idl/server_parameter_with_storage_test.cpp
index 877bdc0dea6..ed71093eb67 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.cpp
+++ b/src/mongo/idl/server_parameter_with_storage_test.cpp
@@ -27,8 +27,6 @@
* it in the license file.
*/
-#include "mongo/platform/basic.h"
-
#include "mongo/idl/server_parameter_test_util.h"
#include "mongo/idl/server_parameter_with_storage.h"
#include "mongo/idl/server_parameter_with_storage_test_gen.h"
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 4f0f856d29d..190b6df6c7d 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -208,7 +208,6 @@ env.Library(
'$BUILD_DIR/mongo/db/query/query_request',
'$BUILD_DIR/mongo/db/repl/optime',
'$BUILD_DIR/mongo/db/server_options',
- '$BUILD_DIR/mongo/idl/idl_parser',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/server_base',