diff options
author | Amirsaman Memaripour <amirsaman.memaripour@mongodb.com> | 2020-06-08 16:21:34 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-19 02:10:48 +0000 |
commit | a81703ed333939ffa67b3c19786329c8b101dc8b (patch) | |
tree | fd347914c2eed97181743ca5b88b05b389fa0309 | |
parent | 4a4f6d705d2ba6b71a17e43634b12cb807025e66 (diff) | |
download | mongo-a81703ed333939ffa67b3c19786329c8b101dc8b.tar.gz |
SERVER-46726 Using testing proctor to control diagnostics
(cherry picked from commit 674a5f6015ca455f47af4a3b0ebed4b8a9281b8d)
-rw-r--r-- | src/mongo/db/free_mon/free_mon_mongod.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/s/txn_two_phase_commit_cmds.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 1 | ||||
-rw-r--r-- | src/mongo/executor/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/executor/network_interface.h | 2 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_integration_test.cpp | 1 | ||||
-rw-r--r-- | src/mongo/rpc/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/rpc/metadata.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_command_test_fixture.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_multicast.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/commands/strategy.cpp | 1 | ||||
-rw-r--r-- | src/mongo/util/latch_analyzer_test.cpp | 1 |
14 files changed, 7 insertions, 17 deletions
diff --git a/src/mongo/db/free_mon/free_mon_mongod.cpp b/src/mongo/db/free_mon/free_mon_mongod.cpp index f755e2f58da..bc33c921855 100644 --- a/src/mongo/db/free_mon/free_mon_mongod.cpp +++ b/src/mongo/db/free_mon/free_mon_mongod.cpp @@ -45,7 +45,6 @@ #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/bsontypes.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/db_raii.h" #include "mongo/db/free_mon/free_mon_controller.h" #include "mongo/db/free_mon/free_mon_message.h" @@ -66,6 +65,7 @@ #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/future.h" #include "mongo/util/net/http_client.h" +#include "mongo/util/testing_proctor.h" namespace mongo { @@ -90,7 +90,7 @@ public: _executor = makeTaskExecutor(serviceContext); _executor->startup(); _client = HttpClient::create(); - _client->allowInsecureHTTP(getTestCommandsEnabled()); + _client->allowInsecureHTTP(TestingProctor::instance().isEnabled()); _client->setHeaders({"Content-Type: application/octet-stream", "Accept: application/octet-stream", "Expect:"}); @@ -312,8 +312,7 @@ void startFreeMonitoring(ServiceContext* serviceContext) { return; } - // Check for http, not https here because testEnabled may not be set yet - if (!getTestCommandsEnabled()) { + if (!TestingProctor::instance().isEnabled()) { uassert(50774, "ExportedFreeMonEndpointURL only supports https:// URLs", FreeMonEndpointURL.compare(0, 5, "https") == 0); diff --git a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp index 9cc24d5a948..81da126ff96 100644 --- a/src/mongo/db/s/txn_two_phase_commit_cmds.cpp +++ b/src/mongo/db/s/txn_two_phase_commit_cmds.cpp @@ -33,6 +33,7 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" +#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/commands/txn_two_phase_commit_cmds_gen.h" #include "mongo/db/repl/repl_client_info.h" #include "mongo/db/s/sharding_state.h" diff --git a/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp b/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp index 04a0e6dce92..ff470884b98 100644 --- a/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp +++ b/src/mongo/db/s/wait_for_ongoing_chunk_splits_command.cpp @@ -32,7 +32,6 @@ #include "mongo/platform/basic.h" #include "mongo/db/commands.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/s/chunk_splitter.h" namespace mongo { diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 96b101b6aca..1a4c7fdf239 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -43,7 +43,6 @@ #include "mongo/db/client.h" #include "mongo/db/command_can_run_here.h" #include "mongo/db/commands.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/commands/txn_cmds_gen.h" #include "mongo/db/curop.h" #include "mongo/db/curop_failpoint_helpers.h" diff --git a/src/mongo/executor/SConscript b/src/mongo/executor/SConscript index e477317a616..ace76a3c1d6 100644 --- a/src/mongo/executor/SConscript +++ b/src/mongo/executor/SConscript @@ -289,7 +289,6 @@ env.CppIntegrationTest( ], LIBDEPS=[ '$BUILD_DIR/mongo/client/clientdriver_network', - '$BUILD_DIR/mongo/db/commands/test_commands_enabled', '$BUILD_DIR/mongo/db/wire_version', '$BUILD_DIR/mongo/executor/network_interface_factory', '$BUILD_DIR/mongo/executor/network_interface_thread_pool', diff --git a/src/mongo/executor/network_interface.h b/src/mongo/executor/network_interface.h index 19a36482d04..e15b0d66ea8 100644 --- a/src/mongo/executor/network_interface.h +++ b/src/mongo/executor/network_interface.h @@ -134,7 +134,7 @@ public: }; /* * Returns a copy of the operation counters (see struct Counters above). This method should - * only be used in tests, and will invariant if getTestCommands() returns false. + * only be used in tests, and will invariant if testing diagnostics are not enabled. */ virtual Counters getCounters() const = 0; diff --git a/src/mongo/executor/network_interface_integration_test.cpp b/src/mongo/executor/network_interface_integration_test.cpp index db9b4c3a089..15d903dd087 100644 --- a/src/mongo/executor/network_interface_integration_test.cpp +++ b/src/mongo/executor/network_interface_integration_test.cpp @@ -37,7 +37,6 @@ #include "mongo/base/status_with.h" #include "mongo/client/connection_string.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/wire_version.h" #include "mongo/executor/connection_pool_stats.h" #include "mongo/executor/network_connection_hook.h" diff --git a/src/mongo/rpc/SConscript b/src/mongo/rpc/SConscript index d9814e5345b..0c010580aa1 100644 --- a/src/mongo/rpc/SConscript +++ b/src/mongo/rpc/SConscript @@ -108,7 +108,6 @@ env.Library( '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/bson/util/bson_extract', '$BUILD_DIR/mongo/client/read_preference', - '$BUILD_DIR/mongo/db/commands/test_commands_enabled', '$BUILD_DIR/mongo/db/logical_time_validator', '$BUILD_DIR/mongo/db/repl/optime', '$BUILD_DIR/mongo/db/signed_logical_time', diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp index ab65025a725..abf49055888 100644 --- a/src/mongo/rpc/metadata.cpp +++ b/src/mongo/rpc/metadata.cpp @@ -33,7 +33,6 @@ #include "mongo/client/read_preference.h" #include "mongo/db/auth/authorization_session.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" #include "mongo/db/logical_clock.h" @@ -45,6 +44,7 @@ #include "mongo/rpc/metadata/sharding_metadata.h" #include "mongo/rpc/metadata/tracking_metadata.h" #include "mongo/util/string_map.h" +#include "mongo/util/testing_proctor.h" namespace mongo { namespace rpc { @@ -84,7 +84,7 @@ void readRequestMetadata(OperationContext* opCtx, const BSONObj& metadataObj, bo AuthorizationSession* authSession = AuthorizationSession::get(opCtx->getClient()); if (clientOperationKeyElem && - (getTestCommandsEnabled() || + (TestingProctor::instance().isEnabled() || authSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(), ActionType::internal))) { auto opKey = uassertStatusOK(UUID::parse(clientOperationKeyElem)); diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript index c0da811ac99..052addaf11e 100644 --- a/src/mongo/s/SConscript +++ b/src/mongo/s/SConscript @@ -287,7 +287,6 @@ env.Library( ], LIBDEPS=[ '$BUILD_DIR/mongo/base', - '$BUILD_DIR/mongo/db/commands/test_commands_enabled', '$BUILD_DIR/mongo/executor/thread_pool_task_executor', '$BUILD_DIR/mongo/s/client/sharding_client', 'cluster_last_error_info', diff --git a/src/mongo/s/commands/cluster_command_test_fixture.cpp b/src/mongo/s/commands/cluster_command_test_fixture.cpp index 60575f966c9..ba4c5ebdcf2 100644 --- a/src/mongo/s/commands/cluster_command_test_fixture.cpp +++ b/src/mongo/s/commands/cluster_command_test_fixture.cpp @@ -34,7 +34,6 @@ #include "mongo/s/commands/cluster_command_test_fixture.h" #include "mongo/db/commands.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/commands/txn_cmds_gen.h" #include "mongo/db/keys_collection_client_sharded.h" #include "mongo/db/keys_collection_manager.h" diff --git a/src/mongo/s/commands/cluster_multicast.cpp b/src/mongo/s/commands/cluster_multicast.cpp index 278d9c6ef19..d9d8f5a6f58 100644 --- a/src/mongo/s/commands/cluster_multicast.cpp +++ b/src/mongo/s/commands/cluster_multicast.cpp @@ -33,7 +33,6 @@ #include "mongo/base/init.h" #include "mongo/db/commands.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/executor/async_multicaster.h" #include "mongo/executor/task_executor_pool.h" #include "mongo/s/catalog/sharding_catalog_client.h" diff --git a/src/mongo/s/commands/strategy.cpp b/src/mongo/s/commands/strategy.cpp index 984c7410727..7d4e5912fa3 100644 --- a/src/mongo/s/commands/strategy.cpp +++ b/src/mongo/s/commands/strategy.cpp @@ -44,7 +44,6 @@ #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/curop.h" #include "mongo/db/error_labels.h" #include "mongo/db/initialize_operation_session_info.h" diff --git a/src/mongo/util/latch_analyzer_test.cpp b/src/mongo/util/latch_analyzer_test.cpp index 8105925597a..7f9b21602b5 100644 --- a/src/mongo/util/latch_analyzer_test.cpp +++ b/src/mongo/util/latch_analyzer_test.cpp @@ -27,7 +27,6 @@ * it in the license file. */ -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/platform/mutex.h" #include "mongo/platform/source_location.h" |