From 2ac7a199fdeb08e64651c407041f53c35abe83a4 Mon Sep 17 00:00:00 2001 From: Ivan Fefer Date: Tue, 19 Mar 2024 08:41:25 +0100 Subject: [PATCH] SERVER-87974 Enable modernize-use-override and apply fixes (#20075) GitOrigin-RevId: c69dc68af83faf399b2e82454ce27d95379c094c --- .clang-tidy.in | 1 + src/mongo/base/clonable_ptr_test.cpp | 4 +- .../bson/mutable/mutable_bson_algo_test.cpp | 6 +- .../async_remote_command_targeter_adapter.h | 4 +- ...c_remote_command_targeter_adapter_test.cpp | 2 +- src/mongo/client/authenticate.cpp | 2 +- src/mongo/client/connpool.h | 16 +- src/mongo/client/cyrus_sasl_client_session.h | 8 +- src/mongo/client/dbclient_connection.h | 4 +- src/mongo/client/dbclient_mockcursor.h | 2 +- src/mongo/client/dbclient_rs_test.cpp | 22 +- src/mongo/client/dbclient_session.h | 6 +- src/mongo/client/native_sasl_client_session.h | 6 +- .../remote_command_retry_scheduler_test.cpp | 2 +- .../remote_command_targeter_factory_impl.h | 2 +- .../remote_command_targeter_factory_mock.h | 2 +- .../client/remote_command_targeter_mock.h | 2 +- .../client/replica_set_monitor_manager.h | 2 +- ...ica_set_monitor_server_parameters_test.cpp | 4 +- .../client/sasl_aws_client_conversation.h | 2 +- .../client/sasl_plain_client_conversation.h | 4 +- .../server_selection_json_test_runner.cpp | 14 +- src/mongo/client/sdam/topology_listener.h | 8 +- .../client/sdam/topology_listener_mock.h | 2 +- src/mongo/client/server_discovery_monitor.h | 2 +- src/mongo/client/server_ping_monitor.h | 6 +- src/mongo/client/server_ping_monitor_test.cpp | 4 +- src/mongo/crypto/fle_crypto_test.cpp | 2 +- src/mongo/crypto/jwks_fetcher_mock.h | 2 +- src/mongo/db/admission/throughput_probing.h | 4 +- src/mongo/db/admission/ticketholder_manager.h | 4 +- src/mongo/db/audit_interface.h | 107 +++--- src/mongo/db/auth/auth_op_observer.h | 2 +- .../db/auth/authorization_manager_impl.h | 2 +- .../db/auth/authorization_manager_test.cpp | 2 +- .../auth/authorization_session_test_fixture.h | 4 +- .../db/auth/authz_manager_external_state_d.h | 2 +- .../auth/authz_manager_external_state_local.h | 2 +- .../auth/authz_manager_external_state_mock.h | 2 +- .../db/auth/authz_session_external_state_d.h | 8 +- .../auth/authz_session_external_state_mock.h | 8 +- .../db/auth/authz_session_external_state_s.h | 4 +- ...thz_session_external_state_server_common.h | 8 +- src/mongo/db/auth/restriction_mock.h | 4 +- src/mongo/db/auth/sasl_commands.cpp | 4 +- src/mongo/db/auth/sasl_mechanism_registry.h | 6 +- .../db/auth/sasl_scram_server_conversation.h | 2 +- .../db/auth/user_document_parser_test.cpp | 2 +- src/mongo/db/baton.cpp | 2 +- src/mongo/db/baton.h | 2 +- src/mongo/db/catalog/collection.h | 4 +- .../db/catalog/collection_catalog_test.cpp | 10 +- src/mongo/db/catalog/collection_impl.h | 4 +- src/mongo/db/catalog/collection_mock.h | 197 +++++----- src/mongo/db/catalog/database.h | 2 +- src/mongo/db/catalog/index_catalog_mock.h | 2 +- .../db/catalog/virtual_collection_impl.h | 4 +- src/mongo/db/client_out_of_line_executor.cpp | 8 +- src/mongo/db/client_out_of_line_executor.h | 2 +- src/mongo/db/clientcursor.cpp | 4 +- src/mongo/db/clientcursor.h | 2 +- src/mongo/db/cluster_transaction_api.h | 2 +- .../db/commands/collection_to_capped.cpp | 2 +- src/mongo/db/commands/count_cmd.cpp | 2 +- src/mongo/db/commands/cpuload.cpp | 2 +- src/mongo/db/commands/create_indexes_cmd.cpp | 2 +- src/mongo/db/commands/current_op.cpp | 6 +- src/mongo/db/commands/current_op_common.h | 2 +- src/mongo/db/commands/dbcheck_command.cpp | 12 +- src/mongo/db/commands/dbcommands.cpp | 4 +- src/mongo/db/commands/dbhash.cpp | 2 +- src/mongo/db/commands/distinct.cpp | 2 +- src/mongo/db/commands/drop_indexes_cmd.cpp | 2 +- src/mongo/db/commands/explain_cmd.cpp | 2 +- src/mongo/db/commands/find_cmd.cpp | 4 +- src/mongo/db/commands/fle_compact_test.cpp | 6 +- src/mongo/db/commands/getmore_cmd.cpp | 2 +- src/mongo/db/commands/isself.cpp | 2 +- .../kill_all_sessions_by_pattern_command.cpp | 8 +- .../db/commands/kill_all_sessions_command.cpp | 8 +- src/mongo/db/commands/kill_op_cmd_base.h | 2 +- .../db/commands/kill_sessions_command.cpp | 8 +- src/mongo/db/commands/list_collections.cpp | 2 +- .../db/commands/map_reduce_command_base.h | 8 +- src/mongo/db/commands/oplog_note.cpp | 12 +- src/mongo/db/commands/pipeline_command.cpp | 4 +- src/mongo/db/commands/profile_common.h | 2 +- .../db/commands/rename_collection_cmd.cpp | 2 +- src/mongo/db/commands/resize_oplog.cpp | 4 +- .../set_cluster_parameter_invocation_test.cpp | 13 +- src/mongo/db/commands/shutdown.h | 2 +- src/mongo/db/commands/sleep_command.cpp | 6 +- src/mongo/db/commands/snapshot_management.cpp | 12 +- .../commands/tenant_migration_donor_cmds.cpp | 8 +- .../tenant_migration_recipient_cmds.cpp | 8 +- .../commands/test_api_version_2_commands.cpp | 10 +- .../db/commands/test_deprecation_command.cpp | 4 +- src/mongo/db/commands/validate.cpp | 4 +- .../db/commands/validate_db_metadata_cmd.cpp | 2 +- src/mongo/db/commands/whats_my_uri_cmd.cpp | 2 +- .../db/concurrency/resource_catalog_test.cpp | 2 +- src/mongo/db/cst/parser_gen.hpp | 2 +- src/mongo/db/default_baton.h | 2 +- .../db/exec/add_fields_projection_executor.h | 2 +- src/mongo/db/exec/batched_delete_stage.h | 4 +- src/mongo/db/exec/count.h | 2 +- src/mongo/db/exec/delete_stage.h | 10 +- .../exec/document_value/document_internal.h | 2 +- .../document_value/document_value_test.cpp | 168 ++++---- src/mongo/db/exec/eof.h | 4 +- .../db/exec/exclusion_projection_executor.h | 4 +- src/mongo/db/exec/fetch.h | 4 +- src/mongo/db/exec/filter.h | 4 +- src/mongo/db/exec/idhack.h | 4 +- src/mongo/db/exec/limit.h | 2 +- src/mongo/db/exec/merge_sort.h | 2 +- src/mongo/db/exec/near.h | 2 +- src/mongo/db/exec/plan_stats.h | 74 ++-- .../db/exec/requires_all_indices_stage.h | 6 +- src/mongo/db/exec/requires_collection_stage.h | 2 +- src/mongo/db/exec/requires_index_stage.h | 6 +- .../db/exec/sample_from_timeseries_bucket.h | 2 +- src/mongo/db/exec/sbe/abt/sbe_abt_test_util.h | 2 +- .../db/exec/sbe/sbe_hash_lookup_test.cpp | 2 +- .../exec/sbe/sbe_hash_lookup_unwind_test.cpp | 2 +- .../exec/sbe/sbe_pattern_value_cmp_test.cpp | 2 +- src/mongo/db/exec/sbe/stages/block_hashagg.h | 2 +- src/mongo/db/exec/sbe/stages/block_to_row.h | 2 +- src/mongo/db/exec/sbe/stages/filter.h | 2 +- src/mongo/db/exec/sbe/stages/hash_agg.h | 2 +- src/mongo/db/exec/sbe/stages/plan_stats.h | 6 +- src/mongo/db/exec/sbe/stages/search_cursor.h | 2 +- src/mongo/db/exec/sbe/stages/sort.h | 4 +- src/mongo/db/exec/sbe/stages/spool.h | 20 +- src/mongo/db/exec/sbe/stages/stage_visitors.h | 2 +- .../exec/sbe/util/stage_results_printer.cpp | 2 +- .../db/exec/sbe/values/block_interface.h | 4 +- src/mongo/db/exec/sbe/values/block_test.cpp | 2 +- src/mongo/db/exec/sbe/values/bson_block.cpp | 5 +- src/mongo/db/exec/sbe/values/slot.h | 4 +- src/mongo/db/exec/shard_filter.h | 2 +- src/mongo/db/exec/skip.h | 2 +- src/mongo/db/exec/sort.h | 14 +- src/mongo/db/exec/spool.h | 8 +- src/mongo/db/exec/stagedebug_cmd.cpp | 4 +- src/mongo/db/exec/subplan.h | 2 +- src/mongo/db/exec/text_match.h | 2 +- src/mongo/db/exec/timeseries_modify.h | 10 +- src/mongo/db/exec/unpack_timeseries_bucket.h | 2 +- src/mongo/db/exec/working_set_test.cpp | 4 +- src/mongo/db/field_parser_test.cpp | 4 +- src/mongo/db/fle_crud_mongod.cpp | 4 +- src/mongo/db/fle_crud_test.cpp | 10 +- src/mongo/db/fle_query_interface_mock.h | 2 +- src/mongo/db/ftdc/controller_test.cpp | 2 +- src/mongo/db/geo/big_polygon.h | 20 +- src/mongo/db/geo/geometry_container.cpp | 8 +- src/mongo/db/geo/r2_region_coverer_test.cpp | 6 +- src/mongo/db/geo/shapes.h | 6 +- src/mongo/db/index/bulk_builder_common.h | 2 +- src/mongo/db/index/s2_access_method.h | 2 +- .../db/index_build_entry_helpers_test.cpp | 2 +- .../db/matcher/expression_always_boolean.h | 2 +- src/mongo/db/matcher/expression_arity.h | 2 +- src/mongo/db/matcher/expression_array.h | 32 +- src/mongo/db/matcher/expression_expr.h | 2 +- src/mongo/db/matcher/expression_geo.h | 16 +- .../expression_internal_bucket_geo_within.h | 2 +- .../expression_internal_expr_comparison.h | 2 +- src/mongo/db/matcher/expression_leaf.h | 44 +-- src/mongo/db/matcher/expression_path.h | 4 +- src/mongo/db/matcher/expression_text_base.h | 2 +- src/mongo/db/matcher/expression_tree.h | 44 +-- src/mongo/db/matcher/expression_type.h | 9 +- src/mongo/db/matcher/expression_where_base.h | 2 +- .../db/matcher/extensions_callback_real.h | 2 +- src/mongo/db/matcher/matchable.h | 8 +- src/mongo/db/matcher/path.h | 16 +- ...nternal_schema_all_elem_match_from_index.h | 2 +- ...ssion_internal_schema_allowed_properties.h | 2 +- ...ession_internal_schema_match_array_index.h | 2 +- ...xpression_internal_schema_max_properties.h | 2 +- ...xpression_internal_schema_min_properties.h | 2 +- ...pression_internal_schema_num_array_items.h | 2 +- ...xpression_internal_schema_num_properties.h | 2 +- .../expression_internal_schema_object_match.h | 2 +- .../expression_internal_schema_root_doc_eq.h | 2 +- .../expression_internal_schema_str_length.h | 2 +- .../expression_internal_schema_unique_items.h | 2 +- .../schema/expression_internal_schema_xor.h | 2 +- .../op_observer/batched_write_policy_test.cpp | 4 +- .../change_stream_pre_images_op_observer.h | 2 +- .../db/op_observer/fallback_op_observer.h | 2 +- src/mongo/db/op_observer/fcv_op_observer.h | 2 +- .../find_and_modify_images_op_observer.h | 2 +- src/mongo/db/op_observer/op_observer_impl.h | 2 +- .../db/op_observer/op_observer_impl_test.cpp | 2 +- .../db/op_observer/op_observer_registry.h | 6 +- .../op_observer/op_observer_registry_test.cpp | 6 +- .../db/op_observer/operation_logger_impl.h | 2 +- .../db/op_observer/operation_logger_mock.h | 2 +- .../operation_logger_transaction_proxy.h | 2 +- .../user_write_block_mode_op_observer.h | 2 +- src/mongo/db/operation_context.h | 2 +- src/mongo/db/operation_context_test.cpp | 2 +- src/mongo/db/operation_cpu_timer.cpp | 2 +- src/mongo/db/operation_cpu_timer_test.cpp | 2 +- src/mongo/db/ops/write_ops_exec_test.cpp | 2 +- .../abt/abt_fallback_mechanism_cq_bm.cpp | 5 +- .../abt_fallback_mechanism_pipeline_bm.cpp | 5 +- .../db/pipeline/abt/abt_translate_cq_bm.cpp | 5 +- .../abt/abt_translate_pipeline_bm.cpp | 5 +- .../pipeline/abt/agg_expression_visitor.cpp | 299 ++++++++------- .../accumulator_for_window_functions.h | 2 +- src/mongo/db/pipeline/accumulator_js_reduce.h | 6 +- src/mongo/db/pipeline/accumulator_multi.h | 4 +- .../db/pipeline/accumulator_percentile.h | 8 +- ...hange_stream_expired_pre_image_remover.cpp | 4 +- src/mongo/db/pipeline/document_source.h | 2 +- .../db/pipeline/document_source_bucket_auto.h | 2 +- .../pipeline/document_source_change_stream.h | 7 +- ...ment_source_change_stream_add_post_image.h | 4 +- ...ument_source_change_stream_add_pre_image.h | 4 +- ...nt_source_change_stream_check_invalidate.h | 2 +- ...urce_change_stream_check_topology_change.h | 2 +- ...hange_stream_ensure_resume_token_present.h | 2 +- ...rce_change_stream_handle_topology_change.h | 2 +- ...ocument_source_change_stream_oplog_match.h | 2 +- ...t_source_change_stream_split_large_event.h | 2 +- .../document_source_change_stream_test.cpp | 4 +- .../document_source_change_stream_transform.h | 2 +- ..._source_change_stream_unwind_transaction.h | 4 +- ...ocument_source_check_resume_token_test.cpp | 4 +- .../db/pipeline/document_source_coll_stats.h | 4 +- .../db/pipeline/document_source_current_op.h | 6 +- .../document_source_current_op_test.cpp | 4 +- .../db/pipeline/document_source_cursor.h | 4 +- .../db/pipeline/document_source_densify.h | 2 +- .../db/pipeline/document_source_exchange.h | 2 +- .../document_source_exchange_test.cpp | 4 +- src/mongo/db/pipeline/document_source_facet.h | 4 +- ...ment_source_find_and_modify_image_lookup.h | 4 +- ...urce_find_and_modify_image_lookup_test.cpp | 2 +- .../db/pipeline/document_source_geo_near.h | 2 +- .../document_source_geo_near_cursor.h | 4 +- .../pipeline/document_source_graph_lookup.h | 11 +- .../db/pipeline/document_source_group_base.h | 4 +- .../pipeline/document_source_group_test.cpp | 136 +++---- ...ent_source_internal_all_collection_stats.h | 7 +- ...ument_source_internal_apply_oplog_update.h | 2 +- ...ource_internal_compute_geo_near_distance.h | 2 +- ...urce_internal_convert_bucket_index_stats.h | 2 +- ...ent_source_internal_inhibit_optimization.h | 2 +- .../document_source_internal_projection.h | 2 +- .../document_source_internal_replace_root.h | 2 +- .../document_source_internal_shard_filter.h | 4 +- ...ment_source_internal_shard_filter_test.cpp | 2 +- ...ocument_source_internal_shardserver_info.h | 2 +- .../document_source_internal_split_pipeline.h | 2 +- .../document_source_internal_unpack_bucket.h | 10 +- src/mongo/db/pipeline/document_source_limit.h | 2 +- ...ment_source_list_cached_and_active_users.h | 4 +- .../pipeline/document_source_list_catalog.h | 2 +- .../document_source_list_local_sessions.h | 7 +- .../document_source_list_sampled_queries.h | 6 +- .../pipeline/document_source_list_sessions.h | 6 +- .../db/pipeline/document_source_lookup.h | 14 +- src/mongo/db/pipeline/document_source_match.h | 6 +- src/mongo/db/pipeline/document_source_merge.h | 4 +- .../document_source_merge_cursors_test.cpp | 2 +- src/mongo/db/pipeline/document_source_mock.h | 7 +- .../document_source_operation_metrics.h | 2 +- src/mongo/db/pipeline/document_source_out.h | 9 +- .../document_source_plan_cache_stats.h | 14 +- .../pipeline/document_source_query_settings.h | 4 +- .../db/pipeline/document_source_query_stats.h | 6 +- .../db/pipeline/document_source_redact.h | 2 +- .../db/pipeline/document_source_sample.h | 2 +- ...ocument_source_sample_from_random_cursor.h | 2 +- ...ocument_source_sequential_document_cache.h | 4 +- ...ent_source_set_variable_from_subpipeline.h | 4 +- .../document_source_set_window_fields.h | 8 +- ...nt_source_single_document_transformation.h | 6 +- src/mongo/db/pipeline/document_source_skip.h | 2 +- src/mongo/db/pipeline/document_source_sort.h | 7 +- .../pipeline/document_source_tee_consumer.h | 2 +- .../document_source_test_optimizations.h | 13 +- .../db/pipeline/document_source_union_with.h | 6 +- .../db/pipeline/document_source_unwind.h | 2 +- .../pipeline/document_source_unwind_test.cpp | 2 +- .../db/pipeline/document_source_writer.h | 2 +- src/mongo/db/pipeline/expression.cpp | 4 +- src/mongo/db/pipeline/expression.h | 34 +- src/mongo/db/pipeline/expression_and_test.cpp | 98 ++--- src/mongo/db/pipeline/expression_bm.cpp | 2 +- .../db/pipeline/expression_compare_test.cpp | 106 +++--- .../db/pipeline/expression_dependencies.cpp | 282 +++++++------- .../pipeline/expression_field_path_test.cpp | 2 +- src/mongo/db/pipeline/expression_hasher.h | 4 +- .../db/pipeline/expression_nary_test.cpp | 18 +- src/mongo/db/pipeline/expression_or_test.cpp | 98 ++--- src/mongo/db/pipeline/expression_test.cpp | 244 ++++++------ .../db/pipeline/expression_trigonometric.h | 6 +- src/mongo/db/pipeline/granularity_rounder.h | 12 +- .../db/pipeline/lite_parsed_document_source.h | 9 +- src/mongo/db/pipeline/pipeline_test.cpp | 3 +- .../db/pipeline/plan_executor_pipeline.h | 4 +- .../common_mongod_process_interface.h | 4 +- .../common_process_interface.h | 6 +- .../mongos_process_interface.h | 2 +- .../non_shardsvr_process_interface.h | 5 +- .../replica_set_node_process_interface.h | 27 +- .../standalone_process_interface.h | 2 +- ...lookup_single_document_process_interface.h | 4 +- .../stub_mongo_process_interface.h | 18 +- ...ocument_source_internal_search_id_lookup.h | 2 +- ...ent_source_internal_search_mongot_remote.h | 6 +- .../document_source_list_search_indexes.h | 7 +- .../pipeline/search/document_source_search.h | 7 +- .../search/document_source_search_meta.h | 5 +- .../db/pipeline/search/lite_parsed_search.h | 4 +- .../window_function/window_function_avg.h | 2 +- .../window_function/window_function_exec.h | 2 +- .../window_function_exec_first_last.h | 4 +- .../window_function/window_function_stddev.h | 6 +- .../window_function/window_function_sum.h | 2 +- .../config_server_health_observer.cpp | 2 +- .../db/process_health/fault_facet_mock.h | 2 +- .../db/process_health/fault_facet_test.cpp | 6 +- .../db/process_health/health_observer_base.h | 2 +- .../db/process_health/health_observer_mock.h | 2 +- src/mongo/db/process_health/state_machine.h | 4 +- src/mongo/db/query/ce/benchmark_utils.h | 4 +- src/mongo/db/query/ce/heuristic_estimator.h | 2 +- src/mongo/db/query/ce/hinted_estimator.h | 2 +- src/mongo/db/query/ce/histogram_estimator.h | 2 +- src/mongo/db/query/ce/sampling_estimator.h | 2 +- src/mongo/db/query/ce/sampling_executor.h | 2 +- .../planner_interface.h | 2 +- .../db/query/classic_stage_builder_test.cpp | 4 +- .../db/query/collation/collator_interface.h | 4 +- .../db/query/cost_model/cost_estimator_impl.h | 2 +- src/mongo/db/query/cqf_command_utils.cpp | 299 ++++++++------- src/mongo/db/query/cqf_fast_paths.cpp | 10 +- .../fle/encrypted_predicate_test_fixtures.h | 4 +- .../db/query/fle/equality_predicate_test.cpp | 2 +- src/mongo/db/query/fle/server_rewrite.cpp | 4 +- src/mongo/db/query/get_executor.cpp | 6 +- src/mongo/db/query/index_entry.h | 4 +- src/mongo/db/query/index_tag.h | 14 +- src/mongo/db/query/mock_yield_policies.h | 4 +- .../cascades/logical_props_derivation.h | 2 +- src/mongo/db/query/optimizer/explain.h | 8 +- .../query/plan_cache_key_encoding_agg_bm.cpp | 5 +- .../query/plan_cache_key_encoding_find_bm.cpp | 5 +- .../db/query/plan_cache_parse_encode_bm.cpp | 5 +- .../plan_cache_parse_encode_pipeline_bm.cpp | 5 +- src/mongo/db/query/plan_cache_test.cpp | 2 +- src/mongo/db/query/plan_executor_impl.h | 8 +- src/mongo/db/query/plan_executor_sbe.h | 22 +- src/mongo/db/query/plan_explainer_express.h | 2 +- src/mongo/db/query/plan_ranker.cpp | 2 +- .../db/query/plan_summary_stats_visitor.h | 22 +- src/mongo/db/query/projection_ast.h | 16 +- .../db/query/query_planner_test_fixture.h | 2 +- .../db/query/query_shape/agg_cmd_shape.h | 2 +- .../query_shape/cmd_with_let_shape_test.cpp | 2 +- .../query_shape/distinct_cmd_shape_test.cpp | 2 +- .../db/query/query_shape/query_shape_test.cpp | 4 +- src/mongo/db/query/query_solution.h | 324 ++++++++-------- src/mongo/db/query/query_stats/agg_key.h | 4 +- src/mongo/db/query/query_stats/find_key.h | 4 +- src/mongo/db/query/query_stats/key_test.cpp | 10 +- .../db/query/query_stats/query_stats.cpp | 2 +- src/mongo/db/query/sbe_expression_bm.cpp | 2 +- src/mongo/db/query/sbe_planner_interfaces.h | 4 +- .../search/mongotmock/mongotmock_commands.cpp | 2 +- .../query/stats/collection_statistics_impl.h | 2 +- .../query/stats/collection_statistics_mock.h | 2 +- .../db/query/stats/stats_cache_loader_mock.h | 2 +- .../db/query/yield_policy_callbacks_impl.h | 2 +- src/mongo/db/read_write_concern_defaults.h | 2 +- .../db/read_write_concern_defaults_test.cpp | 2 +- src/mongo/db/repl/all_database_cloner.h | 2 +- src/mongo/db/repl/base_cloner.h | 2 +- .../db/repl/check_quorum_for_config_change.h | 10 +- .../check_quorum_for_config_change_test.cpp | 6 +- .../db/repl/collection_bulk_loader_impl.h | 12 +- src/mongo/db/repl/collection_cloner.h | 2 +- src/mongo/db/repl/collection_cloner_test.cpp | 2 +- .../data_replicator_external_state_impl.h | 2 +- src/mongo/db/repl/database_cloner.h | 2 +- src/mongo/db/repl/idempotency_test_fixture.h | 2 +- src/mongo/db/repl/initial_sync_base_cloner.h | 8 +- src/mongo/db/repl/initial_syncer.h | 2 +- src/mongo/db/repl/oplog_applier_impl.cpp | 2 +- src/mongo/db/repl/oplog_applier_impl.h | 3 +- .../db/repl/oplog_buffer_batched_queue.h | 6 +- src/mongo/db/repl/oplog_buffer_proxy_test.cpp | 2 +- src/mongo/db/repl/oplog_fetcher.h | 4 +- src/mongo/db/repl/oplog_fetcher_mock.h | 2 +- src/mongo/db/repl/oplog_interface_mock.cpp | 2 +- .../db/repl/oplog_writer_batcher_test.cpp | 38 +- src/mongo/db/repl/oplog_writer_impl_test.cpp | 4 +- src/mongo/db/repl/primary_only_service.h | 6 +- .../repl/primary_only_service_op_observer.h | 2 +- .../db/repl/primary_only_service_test.cpp | 2 +- src/mongo/db/repl/primary_only_service_util.h | 2 +- .../repl/primary_only_service_util_test.cpp | 2 +- src/mongo/db/repl/repl_set_command.h | 2 +- src/mongo/db/repl/repl_set_commands.cpp | 88 ++--- src/mongo/db/repl/repl_set_tag_test.cpp | 2 +- src/mongo/db/repl/replica_set_aware_service.h | 6 +- .../repl/replica_set_aware_service_test.cpp | 8 +- ...eplication_consistency_markers_impl_bm.cpp | 2 +- ...lication_consistency_markers_impl_test.cpp | 4 +- src/mongo/db/repl/replication_coordinator.h | 2 +- ...lication_coordinator_external_state_impl.h | 82 ++-- ...lication_coordinator_external_state_mock.h | 86 ++--- .../db/repl/replication_coordinator_impl.h | 360 +++++++++--------- ...ion_coordinator_impl_heartbeat_v1_test.cpp | 2 +- .../replication_coordinator_impl_test.cpp | 2 +- .../db/repl/replication_coordinator_mock.h | 356 ++++++++--------- .../db/repl/replication_coordinator_noop.h | 24 +- .../replication_coordinator_test_fixture.h | 2 +- .../db/repl/replication_recovery_test.cpp | 2 +- src/mongo/db/repl/reporter_test.cpp | 12 +- src/mongo/db/repl/rollback_impl.h | 2 +- src/mongo/db/repl/rollback_test_fixture.h | 2 +- src/mongo/db/repl/scatter_gather_test.cpp | 4 +- .../repl/shard_merge_recipient_op_observer.h | 2 +- ...shard_merge_recipient_op_observer_test.cpp | 4 +- .../db/repl/shard_merge_recipient_service.cpp | 4 +- .../db/repl/shard_merge_recipient_service.h | 2 +- .../shard_merge_recipient_service_test.cpp | 2 +- src/mongo/db/repl/storage_interface_mock.h | 2 +- src/mongo/db/repl/storage_timestamp_test.cpp | 4 +- src/mongo/db/repl/sync_source_selector_mock.h | 2 +- .../db/repl/tenant_all_database_cloner.h | 2 +- src/mongo/db/repl/tenant_base_cloner.h | 4 +- src/mongo/db/repl/tenant_collection_cloner.h | 2 +- src/mongo/db/repl/tenant_database_cloner.h | 2 +- src/mongo/db/repl/tenant_file_cloner.h | 2 +- .../db/repl/tenant_file_importer_service.h | 20 +- ...migration_access_blocker_registry_test.cpp | 4 +- ...ant_migration_access_blocker_util_test.cpp | 8 +- .../repl/tenant_migration_donor_op_observer.h | 2 +- .../repl/tenant_migration_donor_service.cpp | 2 +- .../db/repl/tenant_migration_donor_service.h | 4 +- .../tenant_migration_recipient_op_observer.h | 2 +- .../tenant_migration_recipient_service.cpp | 4 +- .../repl/tenant_migration_recipient_service.h | 2 +- src/mongo/db/repl/tenant_oplog_applier.h | 2 +- src/mongo/db/repl/tenant_oplog_batcher.h | 2 +- .../db/repl/topology_coordinator_v1_test.cpp | 16 +- .../repl/topology_version_observer_test.cpp | 4 +- src/mongo/db/repl/vote_requester.h | 10 +- src/mongo/db/repl/vote_requester_test.cpp | 8 +- .../db/replica_set_endpoint_util_test.cpp | 2 +- src/mongo/db/s/auto_split_vector_test.cpp | 4 +- src/mongo/db/s/balancer/auto_merger_policy.h | 2 +- src/mongo/db/s/balancer/balancer.h | 4 +- .../balancer_commands_scheduler_impl.h | 2 +- .../balancer_defragmentation_policy.h | 2 +- .../db/s/balancer/cluster_statistics_impl.h | 2 +- .../db/s/balancer/cluster_statistics_mock.h | 2 +- .../db/s/balancer/move_unsharded_policy.h | 2 +- src/mongo/db/s/balancer_stats_registry.h | 21 +- src/mongo/db/s/clone_catalog_data_command.cpp | 6 +- .../db/s/config/config_server_test_fixture.h | 2 +- src/mongo/db/s/config/configsvr_coordinator.h | 8 +- .../s/config/configsvr_coordinator_service.h | 2 +- .../config/configsvr_remove_shard_command.cpp | 2 +- .../config/configsvr_run_restore_command.cpp | 2 +- .../config/configsvr_split_chunk_command.cpp | 2 +- .../db/s/config/placement_history_cleaner.h | 2 +- ...ction_version_and_change_metadata_test.cpp | 4 +- src/mongo/db/s/config_server_op_observer.h | 2 +- .../db/s/create_collection_coordinator.h | 4 +- ...nalyze_shard_key_read_write_distribution.h | 6 +- src/mongo/db/s/drop_collection_coordinator.h | 2 +- src/mongo/db/s/drop_database_coordinator.h | 2 +- .../flush_database_cache_updates_command.cpp | 2 +- ...x_cumulative_metrics_field_name_provider.h | 4 +- .../global_index_cumulative_metrics_test.cpp | 3 +- .../db/s/global_index/global_index_metrics.h | 2 +- src/mongo/db/s/metadata_manager.cpp | 4 +- ..._copy_approximation_field_name_overrides.h | 4 +- ...document_copy_count_field_name_overrides.h | 4 +- ...g_data_transform_instance_metrics_test.cpp | 2 +- ...ding_data_transform_metrics_test_fixture.h | 16 +- ...migration_blocking_operation_coordinator.h | 8 +- .../multi_update_coordinator_external_state.h | 4 +- .../multi_update_coordinator_test.cpp | 2 +- .../db/s/migration_chunk_cloner_source.h | 8 +- ...migration_chunk_cloner_source_commands.cpp | 14 +- .../s/migration_chunk_cloner_source_test.cpp | 10 +- .../db/s/migration_destination_manager.h | 4 +- src/mongo/db/s/move_primary_coordinator.h | 2 +- src/mongo/db/s/op_observer_sharding_test.cpp | 2 +- src/mongo/db/s/placement_history_bm.cpp | 2 +- src/mongo/db/s/query_analysis_coordinator.h | 23 +- src/mongo/db/s/query_analysis_op_observer.h | 36 +- .../s/query_analysis_op_observer_configsvr.h | 2 +- .../db/s/query_analysis_op_observer_rs.h | 2 +- .../s/query_analysis_op_observer_shardsvr.h | 2 +- src/mongo/db/s/query_analysis_writer.h | 25 +- src/mongo/db/s/query_analysis_writer_test.cpp | 4 +- src/mongo/db/s/range_deleter_service.h | 9 +- .../db/s/range_deleter_service_op_observer.h | 2 +- .../db/s/read_only_catalog_cache_loader.h | 2 +- ...fresh_query_analyzer_configuration_cmd.cpp | 2 +- .../s/rename_collection_participant_service.h | 8 +- ...document_source_resharding_add_resume_id.h | 4 +- ...nt_source_resharding_iterate_transaction.h | 4 +- ...cument_source_resharding_ownership_match.h | 2 +- .../db/s/resharding/resharding_agg_test.cpp | 12 +- .../resharding_coordinator_service.h | 4 +- .../resharding_cumulative_metrics.h | 6 +- .../resharding_cumulative_metrics_test.cpp | 5 +- .../resharding/resharding_data_replication.h | 2 +- .../s/resharding/resharding_donor_service.cpp | 2 +- .../s/resharding/resharding_donor_service.h | 4 +- .../db/s/resharding/resharding_metrics.h | 4 +- .../s/resharding/resharding_metrics_test.cpp | 5 +- .../resharding_oplog_applier_metrics_test.cpp | 3 +- .../resharding_oplog_applier_test.cpp | 2 +- .../s/resharding/resharding_oplog_fetcher.h | 2 +- .../resharding_oplog_fetcher_test.cpp | 2 +- .../resharding/resharding_recipient_service.h | 4 +- .../resharding_recipient_service_test.cpp | 2 +- .../resharding/resharding_txn_cloner_test.cpp | 6 +- ...ed_operation_completion_sharding_actions.h | 2 +- src/mongo/db/s/shard_local.h | 12 +- src/mongo/db/s/shard_local_test.cpp | 2 +- .../db/s/shard_server_catalog_cache_loader.h | 4 +- src/mongo/db/s/shard_server_op_observer.h | 2 +- .../db/s/shard_server_op_observer_test.cpp | 2 +- src/mongo/db/s/shard_server_test_fixture.h | 4 +- src/mongo/db/s/sharding_ddl_coordinator.h | 8 +- .../sharding_ddl_coordinator_external_state.h | 24 +- ..._ddl_coordinator_external_state_for_test.h | 24 +- .../db/s/sharding_ddl_coordinator_service.h | 2 +- .../db/s/sharding_ddl_coordinator_test.cpp | 6 +- .../db/s/sharding_initialization_mongod.h | 23 +- src/mongo/db/s/sharding_mongod_test_fixture.h | 2 +- src/mongo/db/s/sharding_recovery_service.h | 19 +- src/mongo/db/s/sharding_util_refresh_test.cpp | 2 +- ...primary_enter_critical_section_command.cpp | 2 +- ..._primary_exit_critical_section_command.cpp | 2 +- src/mongo/db/s/split_vector_test.cpp | 6 +- .../db/s/transaction_coordinator_test.cpp | 8 +- ...tes_recoverable_critical_section_service.h | 21 +- src/mongo/db/server_options_test.cpp | 4 +- .../db/serverless/shard_split_commands.cpp | 8 +- .../shard_split_donor_op_observer.h | 2 +- .../db/serverless/shard_split_donor_service.h | 4 +- src/mongo/db/service_context.h | 4 +- src/mongo/db/service_context_d_test_fixture.h | 2 +- src/mongo/db/service_entry_point_mongod.h | 2 +- .../internal_transactions_reap_service.h | 19 +- .../db/session/logical_session_cache_impl.h | 2 +- src/mongo/db/session/session.h | 2 +- src/mongo/db/session/session_catalog_mongod.h | 6 +- .../db/set_change_stream_state_coordinator.h | 4 +- src/mongo/db/sorter/sorter.cpp | 40 +- src/mongo/db/sorter/sorter.h | 16 +- src/mongo/db/sorter/sorter_test.cpp | 76 ++-- .../db/stats/api_version_metrics_test.cpp | 4 +- .../resource_consumption_metrics_test.cpp | 2 +- .../db/storage/collection_truncate_markers.h | 26 +- .../collection_truncate_markers_test.cpp | 10 +- .../db/storage/control/journal_flusher.h | 4 +- .../db/storage/deferred_drop_record_store.h | 2 +- src/mongo/db/storage/devnull/devnull_init.cpp | 14 +- .../db/storage/devnull/devnull_kv_engine.cpp | 108 +++--- .../db/storage/devnull/devnull_kv_engine.h | 2 +- .../ephemeral_catalog_record_store.cpp | 12 +- .../devnull/ephemeral_catalog_record_store.h | 42 +- src/mongo/db/storage/durable_catalog.cpp | 4 +- src/mongo/db/storage/external_record_store.h | 2 +- src/mongo/db/storage/flow_control_test.cpp | 4 +- src/mongo/db/storage/key_string.h | 4 +- .../kv/kv_drop_pending_ident_reaper_test.cpp | 4 +- .../db/storage/kv/storage_engine_test.cpp | 12 +- .../db/storage/multi_bson_stream_cursor.h | 4 +- .../db/storage/oplog_cap_maintainer_thread.h | 4 +- .../db/storage/recovery_unit_test_harness.h | 2 +- src/mongo/db/storage/storage_engine_impl.h | 83 ++-- src/mongo/db/storage/storage_engine_mock.h | 5 +- .../db/storage/storage_engine_test_fixture.h | 2 +- .../storage/storage_repair_observer_test.cpp | 4 +- src/mongo/db/storage/test_harness_helper.h | 2 +- .../wiredtiger/wiredtiger_column_store.h | 2 +- .../storage/wiredtiger/wiredtiger_import.cpp | 4 +- .../storage/wiredtiger/wiredtiger_index.cpp | 8 +- .../db/storage/wiredtiger/wiredtiger_index.h | 44 +-- .../db/storage/wiredtiger/wiredtiger_init.cpp | 20 +- .../wiredtiger/wiredtiger_init_test.cpp | 4 +- .../wiredtiger/wiredtiger_kv_engine.cpp | 12 +- .../storage/wiredtiger/wiredtiger_kv_engine.h | 9 +- .../wiredtiger_kv_engine_no_fixture_test.cpp | 2 +- .../wiredtiger/wiredtiger_kv_engine_test.cpp | 6 +- .../wiredtiger/wiredtiger_record_store.cpp | 2 +- .../wiredtiger/wiredtiger_record_store.h | 2 +- ...iger_record_store_oplog_truncate_markers.h | 4 +- .../wiredtiger_record_store_test_harness.h | 17 +- .../wiredtiger/wiredtiger_recovery_unit.h | 6 +- .../wiredtiger_recovery_unit_test.cpp | 8 +- .../wiredtiger_standard_record_store_test.cpp | 4 +- .../timeseries/bucket_compression_failure.h | 2 +- .../db/timeseries/timeseries_op_observer.h | 2 +- .../timeseries_update_delete_util_test.cpp | 2 +- ...atalog_mongod_transaction_interface_impl.h | 2 +- src/mongo/db/transaction/transaction_api.h | 33 +- .../db/transaction/transaction_api_test.cpp | 73 ++-- .../transaction_history_iterator.h | 2 +- ...tion_participant_retryable_writes_test.cpp | 6 +- .../db/transaction_resources_init_mongod.cpp | 2 +- .../transaction_resources_init_non_mongod.cpp | 2 +- src/mongo/db/ttl.cpp | 2 +- src/mongo/db/ttl.h | 4 +- .../db/update/document_diff_serialization.h | 2 +- src/mongo/db/update/path_support_test.cpp | 6 +- src/mongo/db/update/pattern_cmp_test.cpp | 2 +- src/mongo/db/update/pipeline_executor.h | 2 +- src/mongo/db/update/rename_node.cpp | 3 +- src/mongo/db/vector_clock.cpp | 8 +- src/mongo/db/vector_clock_mongod.h | 4 +- src/mongo/db/vector_clock_mutable.h | 2 +- src/mongo/db/vector_clock_test_fixture.h | 2 +- src/mongo/db/vector_clock_trivial.cpp | 2 +- src/mongo/dbtests/basictests.cpp | 6 +- src/mongo/dbtests/catalogtests.cpp | 2 +- src/mongo/dbtests/clienttests.cpp | 2 +- src/mongo/dbtests/commandtests.cpp | 2 +- src/mongo/dbtests/counttests.cpp | 2 +- src/mongo/dbtests/dbhelper_tests.cpp | 2 +- src/mongo/dbtests/deferred_writer.cpp | 20 +- src/mongo/dbtests/directclienttests.cpp | 2 +- src/mongo/dbtests/documentsourcetests.cpp | 2 +- src/mongo/dbtests/indexcatalogtests.cpp | 2 +- src/mongo/dbtests/indexupdatetests.cpp | 2 +- src/mongo/dbtests/jsobjtests.cpp | 90 ++--- src/mongo/dbtests/jstests.cpp | 2 +- src/mongo/dbtests/logical_sessions_tests.cpp | 2 +- src/mongo/dbtests/matchertests.cpp | 2 +- src/mongo/dbtests/mock/mock_conn_registry.h | 2 +- .../dbtests/mock/mock_dbclient_connection.h | 2 +- src/mongo/dbtests/pdfiletests.cpp | 2 +- src/mongo/dbtests/plan_ranking.cpp | 4 +- src/mongo/dbtests/query_plan_executor.cpp | 2 +- src/mongo/dbtests/query_stage_and.cpp | 2 +- .../dbtests/query_stage_batched_delete.cpp | 2 +- src/mongo/dbtests/query_stage_cached_plan.cpp | 2 +- src/mongo/dbtests/query_stage_collscan.cpp | 2 +- src/mongo/dbtests/query_stage_count.cpp | 10 +- src/mongo/dbtests/query_stage_count_scan.cpp | 2 +- src/mongo/dbtests/query_stage_delete.cpp | 2 +- src/mongo/dbtests/query_stage_distinct.cpp | 6 +- src/mongo/dbtests/query_stage_fetch.cpp | 2 +- src/mongo/dbtests/query_stage_ixscan.cpp | 2 +- src/mongo/dbtests/query_stage_limit_skip.cpp | 2 +- src/mongo/dbtests/query_stage_merge_sort.cpp | 2 +- src/mongo/dbtests/query_stage_multiplan.cpp | 8 +- src/mongo/dbtests/query_stage_near.cpp | 10 +- src/mongo/dbtests/query_stage_sort.cpp | 20 +- src/mongo/dbtests/query_stage_subplan.cpp | 2 +- src/mongo/dbtests/query_stage_tests.cpp | 12 +- src/mongo/dbtests/query_stage_update.cpp | 2 +- src/mongo/dbtests/querytests.cpp | 2 +- src/mongo/dbtests/replica_set_tests.cpp | 4 +- src/mongo/dbtests/repltests.cpp | 284 +++++++------- src/mongo/dbtests/rollbacktests.cpp | 2 +- src/mongo/dbtests/socktests.cpp | 2 +- src/mongo/dbtests/threadedtests.cpp | 14 +- src/mongo/dbtests/updatetests.cpp | 80 ++-- src/mongo/dbtests/validate_tests.cpp | 2 +- .../wildcard_multikey_persistence_test.cpp | 2 +- src/mongo/embedded/api_common.h | 4 +- src/mongo/embedded/embedded_ismaster.cpp | 10 +- .../index_builds_coordinator_embedded.h | 2 +- .../mongo_embedded/mongo_embedded_test.cpp | 4 +- .../embedded/operation_logger_embedded.h | 2 +- src/mongo/embedded/periodic_runner_embedded.h | 2 +- .../replication_coordinator_embedded.h | 30 +- .../embedded/service_entry_point_embedded.cpp | 8 +- .../embedded/service_entry_point_embedded.h | 2 +- .../transaction_resources_init_embedded.cpp | 2 +- src/mongo/executor/async_rpc_retry_policy.h | 8 +- src/mongo/executor/async_rpc_targeter.h | 8 +- src/mongo/executor/async_rpc_test_fixture.h | 14 +- src/mongo/executor/connection_pool.h | 4 +- src/mongo/executor/connection_pool_tl.cpp | 2 +- src/mongo/executor/connection_pool_tl.h | 4 +- .../executor/hedge_options_util_test.cpp | 2 +- src/mongo/executor/inline_executor.cpp | 2 +- src/mongo/executor/network_interface_mock.h | 2 +- .../network_interface_mock_test_fixture.h | 4 +- src/mongo/executor/network_interface_tl.h | 6 +- .../pinned_connection_task_executor.cpp | 2 +- .../pinned_connection_task_executor.h | 2 +- ...ed_connection_task_executor_test_fixture.h | 2 +- src/mongo/executor/scoped_task_executor.cpp | 4 +- src/mongo/executor/task_executor.h | 4 +- .../executor/task_executor_cursor_test.cpp | 2 +- .../executor/task_executor_test_fixture.h | 2 +- .../executor/test_network_connection_hook.h | 5 +- src/mongo/executor/thread_pool_mock.h | 2 +- .../executor/thread_pool_task_executor.cpp | 2 +- .../executor/thread_pool_task_executor.h | 6 +- .../cluster_server_parameter_initializer.h | 23 +- .../idl/cluster_server_parameter_test_util.h | 2 +- src/mongo/logv2/log_domain_global.h | 2 +- src/mongo/logv2/logv2_test.cpp | 2 +- src/mongo/platform/mutex.h | 2 +- .../egress_metadata_hook_list_test.cpp | 4 +- src/mongo/s/append_raw_responses_test.cpp | 2 +- src/mongo/s/async_requests_sender_test.cpp | 12 +- src/mongo/s/async_rpc_shard_retry_policy.h | 4 +- .../s/catalog/sharding_catalog_client_impl.h | 2 +- .../s/catalog/sharding_catalog_client_mock.h | 2 +- src/mongo/s/catalog_cache_loader_mock.h | 2 +- src/mongo/s/catalog_cache_mock.h | 4 +- src/mongo/s/client/config_shard_wrapper.h | 12 +- .../s/client/config_shard_wrapper_test.cpp | 12 +- src/mongo/s/client/shard_remote.h | 12 +- src/mongo/s/client/shard_remote_test.cpp | 2 +- .../client/sharding_network_connection_hook.h | 2 +- .../client_metadata_propagation_egress_hook.h | 2 +- src/mongo/s/cluster_identity_loader_test.cpp | 2 +- .../commands/cluster_abort_transaction_cmd.h | 2 +- .../s/commands/cluster_aggregate_test.cpp | 4 +- src/mongo/s/commands/cluster_build_info.cpp | 4 +- src/mongo/s/commands/cluster_bulk_write_cmd.h | 6 +- .../s/commands/cluster_collection_mod_cmd.cpp | 2 +- .../commands/cluster_commit_transaction_cmd.h | 2 +- src/mongo/s/commands/cluster_count_cmd.h | 2 +- src/mongo/s/commands/cluster_current_op.cpp | 6 +- .../s/commands/cluster_drop_indexes_cmd.cpp | 2 +- src/mongo/s/commands/cluster_explain_cmd.cpp | 2 +- src/mongo/s/commands/cluster_find_cmd.h | 8 +- src/mongo/s/commands/cluster_getmore_cmd.h | 2 +- .../s/commands/cluster_index_filter_cmd.cpp | 2 +- .../s/commands/cluster_move_chunk_cmd.cpp | 2 +- .../s/commands/cluster_oplog_note_cmd.cpp | 12 +- src/mongo/s/commands/cluster_pipeline_cmd.h | 6 +- .../commands/cluster_plan_cache_clear_cmd.cpp | 4 +- .../cluster_query_without_shard_key_cmd.cpp | 2 +- .../s/commands/cluster_remove_shard_cmd.cpp | 4 +- .../cluster_remove_shard_from_zone_cmd.cpp | 12 +- .../cluster_repl_set_get_status_cmd.cpp | 14 +- .../cluster_update_zone_key_range_cmd.cpp | 12 +- .../cluster_validate_db_metadata_cmd.cpp | 2 +- .../s/commands/cluster_whats_my_uri_cmd.cpp | 2 +- src/mongo/s/commands/cluster_write_cmd.h | 6 +- .../cluster_write_without_shard_key_cmd.cpp | 2 +- .../s/config_server_catalog_cache_loader.h | 2 +- .../s/mongos_topology_coordinator_test.cpp | 4 +- .../s/query/blocking_results_merger_test.cpp | 8 +- .../s/query/cluster_client_cursor_mock.h | 2 +- .../s/query/cluster_cursor_manager_test.cpp | 2 +- .../s/query/document_source_merge_cursors.h | 2 +- src/mongo/s/query/router_stage_merge.h | 2 +- src/mongo/s/query/sharded_agg_test_fixture.h | 2 +- src/mongo/s/resource_yielders.h | 6 +- ...routing_table_cache_gossip_metadata_hook.h | 2 +- .../s/sessions_collection_sharded_test.cpp | 2 +- ...nnot_refresh_due_to_locks_held_exception.h | 2 +- src/mongo/s/sharding_mongos_test_fixture.h | 2 +- src/mongo/s/sharding_task_executor_test.cpp | 2 +- src/mongo/s/sharding_test_fixture_common.h | 2 +- src/mongo/s/stale_exception.h | 4 +- .../s/write_ops/batch_write_exec_test.cpp | 4 +- .../s/write_ops/batched_command_response.h | 2 +- .../s/write_ops/bulk_write_exec_test.cpp | 2 +- src/mongo/scripting/engine.cpp | 86 +++-- src/mongo/scripting/engine.h | 2 +- src/mongo/scripting/mozjs/implscope.h | 5 +- src/mongo/scripting/mozjs/proxyscope.h | 5 +- src/mongo/shell/encrypted_dbclient_base.h | 3 +- src/mongo/shell/kms_local.cpp | 4 +- .../transport/asio/asio_networking_baton.h | 2 +- .../transport/asio/asio_transport_layer.cpp | 4 +- .../transport/service_executor_synchronous.h | 2 +- src/mongo/transport/service_executor_test.cpp | 2 +- src/mongo/transport/session.h | 2 +- src/mongo/transport/session_workflow_bm.cpp | 2 +- src/mongo/transport/test_fixtures.h | 2 +- src/mongo/transport/transport_layer.h | 4 +- .../transport/transport_layer_manager_impl.h | 4 +- src/mongo/transport/transport_layer_mock.h | 4 +- src/mongo/unittest/fixture_test.cpp | 4 +- src/mongo/unittest/task_executor_proxy.h | 2 +- src/mongo/util/admin_access.h | 4 +- src/mongo/util/alarm.h | 2 +- src/mongo/util/background.cpp | 4 +- src/mongo/util/background_job_test.cpp | 4 +- src/mongo/util/cancellation.h | 4 +- .../util/concurrency/priority_ticketholder.h | 16 +- .../util/concurrency/semaphore_ticketholder.h | 18 +- .../util/concurrency/thread_pool_interface.h | 2 +- src/mongo/util/concurrency/ticket_pool.h | 4 +- src/mongo/util/future_impl.h | 2 +- src/mongo/util/net/http_client_curl.cpp | 4 +- src/mongo/util/net/sock_test.cpp | 2 +- src/mongo/util/net/ssl/impl/error.ipp | 4 +- src/mongo/util/net/ssl_manager.h | 2 +- src/mongo/util/net/ssl_manager_openssl.cpp | 4 +- src/mongo/util/net/ssl_options_test.cpp | 4 +- .../options_parser/options_parser_test.cpp | 4 +- src/mongo/util/out_of_line_executor.h | 4 +- src/mongo/util/read_through_cache.h | 2 +- src/mongo/util/read_through_cache_test.cpp | 2 +- src/mongo/util/registry_list.h | 2 +- src/mongo/util/tracing_support.cpp | 4 +- src/mongo/watchdog/watchdog.h | 18 +- src/mongo/watchdog/watchdog_mock.h | 18 +- src/mongo/watchdog/watchdog_mongod.cpp | 5 +- 819 files changed, 4131 insertions(+), 4146 deletions(-) diff --git a/.clang-tidy.in b/.clang-tidy.in index 12193e5e5f4..68496a6b2d1 100644 --- a/.clang-tidy.in +++ b/.clang-tidy.in @@ -36,6 +36,7 @@ Checks: '-*, modernize-replace-random-shuffle, modernize-shrink-to-fit, modernize-unary-static-assert, + modernize-use-override, mongo-assert-check, mongo-cctype-check, mongo-config-header-check, diff --git a/src/mongo/base/clonable_ptr_test.cpp b/src/mongo/base/clonable_ptr_test.cpp index 0b2a07c055d..ff6019da772 100644 --- a/src/mongo/base/clonable_ptr_test.cpp +++ b/src/mongo/base/clonable_ptr_test.cpp @@ -922,7 +922,7 @@ private: const std::string root; int generation = 0; - GeneratorImplementation* clone_impl() const { + GeneratorImplementation* clone_impl() const override { return new GeneratorImplementation{*this}; } @@ -940,7 +940,7 @@ class StorageImplementation : public Interface { private: std::string store; - StorageImplementation* clone_impl() const { + StorageImplementation* clone_impl() const override { return new StorageImplementation{*this}; } diff --git a/src/mongo/bson/mutable/mutable_bson_algo_test.cpp b/src/mongo/bson/mutable/mutable_bson_algo_test.cpp index d8297da0ad0..15206d352e6 100644 --- a/src/mongo/bson/mutable/mutable_bson_algo_test.cpp +++ b/src/mongo/bson/mutable/mutable_bson_algo_test.cpp @@ -70,7 +70,7 @@ TEST_F(DocumentTest, FindInEmptyObject) { } class OneChildTest : public DocumentTest { - virtual void setUp() { + void setUp() override { ASSERT_EQUALS(Status::OK(), doc().root().appendBool("t", true)); } }; @@ -96,7 +96,7 @@ TEST_F(OneChildTest, FindMatch) { } class ManyChildrenTest : public DocumentTest { - virtual void setUp() { + void setUp() override { ASSERT_EQUALS(Status::OK(), doc().root().appendString("begin", "a")); ASSERT_EQUALS(Status::OK(), doc().root().appendString("repeated_sparse", "b")); ASSERT_EQUALS(Status::OK(), doc().root().appendString("repeated_dense", "c")); @@ -237,7 +237,7 @@ TEST_F(ManyChildrenTest, getNthSibling) { } class CountTest : public DocumentTest { - virtual void setUp() { + void setUp() override { Element root = doc().root(); ASSERT_OK(root.appendInt("leaf", 0)); diff --git a/src/mongo/client/async_remote_command_targeter_adapter.h b/src/mongo/client/async_remote_command_targeter_adapter.h index 65fed1388fa..d2d0f588017 100644 --- a/src/mongo/client/async_remote_command_targeter_adapter.h +++ b/src/mongo/client/async_remote_command_targeter_adapter.h @@ -59,12 +59,12 @@ public: std::shared_ptr targeter) : _readPref(readPref), _targeter(targeter) {} - SemiFuture> resolve(CancellationToken t) override final { + SemiFuture> resolve(CancellationToken t) final { return _targeter->findHosts(_readPref, t); } SemiFuture onRemoteCommandError(HostAndPort remoteHost, - Status remoteCommandStatus) override final { + Status remoteCommandStatus) final { _targeter->updateHostWithStatus(remoteHost, remoteCommandStatus); return SemiFuture::makeReady(); } diff --git a/src/mongo/client/async_remote_command_targeter_adapter_test.cpp b/src/mongo/client/async_remote_command_targeter_adapter_test.cpp index 7ffae94821b..e6b1520146d 100644 --- a/src/mongo/client/async_remote_command_targeter_adapter_test.cpp +++ b/src/mongo/client/async_remote_command_targeter_adapter_test.cpp @@ -54,7 +54,7 @@ public: const std::vector kHosts{HostAndPort("FakeHost1", 12345), HostAndPort("FakeHost2", 12345)}; - void setUp() { + void setUp() override { auto factory = RemoteCommandTargeterFactoryMock(); _targeter = factory.create(ConnectionString::forStandalones(kHosts)); diff --git a/src/mongo/client/authenticate.cpp b/src/mongo/client/authenticate.cpp index b37ac6832a6..50dfebd60db 100644 --- a/src/mongo/client/authenticate.cpp +++ b/src/mongo/client/authenticate.cpp @@ -158,7 +158,7 @@ Future authX509(RunCommandHook runCommand, const BSONObj& params, StringDa class DefaultInternalAuthParametersProvider : public InternalAuthParametersProvider { public: - ~DefaultInternalAuthParametersProvider() = default; + ~DefaultInternalAuthParametersProvider() override = default; BSONObj get(size_t index, StringData mechanism) final { return getInternalAuthParams(index, mechanism); diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h index da5bf79bd2a..bb0b3f96547 100644 --- a/src/mongo/client/connpool.h +++ b/src/mongo/client/connpool.h @@ -307,7 +307,7 @@ public: class DBConnectionPool : public PeriodicTask { public: DBConnectionPool(); - ~DBConnectionPool(); + ~DBConnectionPool() override; /** right now just controls some asserts. defaults to "dbconnectionpool" */ void setName(const std::string& name) { @@ -404,10 +404,10 @@ public: bool operator()(const std::string& a, const std::string& b) const; }; - virtual std::string taskName() const { + std::string taskName() const override { return "DBConnectionPool-cleaner"; } - virtual void taskDoWork(); + void taskDoWork() override; /** * Shuts down the connection pool, unblocking any waiters on connections. @@ -512,7 +512,7 @@ public: _setSocketTimeout(); } - ~ScopedDbConnection(); + ~ScopedDbConnection() override; static void clearPool(); @@ -529,16 +529,16 @@ public: } /** get the associated connection object */ - DBClientBase* get() { + DBClientBase* get() override { uassert(13102, "connection was returned to the pool already", _conn); return _conn; } - bool ok() const { + bool ok() const override { return _conn != nullptr; } - std::string getHost() const { + std::string getHost() const override { return _host; } @@ -553,7 +553,7 @@ public: we can't be sure we fully read all expected data of a reply on the socket. so we don't try to reuse the connection in that situation. */ - void done(); + void done() override; private: void _setSocketTimeout(); diff --git a/src/mongo/client/cyrus_sasl_client_session.h b/src/mongo/client/cyrus_sasl_client_session.h index f5ba4dce5cd..728deeede26 100644 --- a/src/mongo/client/cyrus_sasl_client_session.h +++ b/src/mongo/client/cyrus_sasl_client_session.h @@ -44,12 +44,12 @@ class CyrusSaslClientSession : public SaslClientSession { public: CyrusSaslClientSession(); - ~CyrusSaslClientSession(); + ~CyrusSaslClientSession() override; /** * Overriding to store the password data in sasl_secret_t format */ - virtual void setParameter(Parameter id, StringData value); + void setParameter(Parameter id, StringData value) override; /** * Returns the value of the parameterPassword parameter in the form of a sasl_secret_t, used @@ -59,9 +59,9 @@ public: */ sasl_secret_t* getPasswordAsSecret(); - virtual Status initialize(); + Status initialize() override; - virtual Status step(StringData inputData, std::string* outputData); + Status step(StringData inputData, std::string* outputData) override; bool isSuccess() const override { return _success; diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h index 597fcc26398..f30a6ce3a4b 100644 --- a/src/mongo/client/dbclient_connection.h +++ b/src/mongo/client/dbclient_connection.h @@ -80,7 +80,7 @@ public: const HandshakeValidationHook& hook = HandshakeValidationHook(), const ClientAPIVersionParameters* apiParameters = nullptr); - virtual ~DBClientConnection() { + ~DBClientConnection() override { _numConnections.fetchAndAdd(-1); } @@ -119,7 +119,7 @@ public: bool isUsingTransientSSLParams() const override; - bool isTLS(); + bool isTLS() override; #endif protected: diff --git a/src/mongo/client/dbclient_mockcursor.h b/src/mongo/client/dbclient_mockcursor.h index 9ec20766db0..8d634463bcf 100644 --- a/src/mongo/client/dbclient_mockcursor.h +++ b/src/mongo/client/dbclient_mockcursor.h @@ -45,7 +45,7 @@ public: bool provideResumeToken = false, unsigned long batchSize = 0); - virtual ~DBClientMockCursor() {} + ~DBClientMockCursor() override {} bool more() override; diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp index 0cd22486049..4ee99461f1e 100644 --- a/src/mongo/client/dbclient_rs_test.cpp +++ b/src/mongo/client/dbclient_rs_test.cpp @@ -98,7 +98,7 @@ public: } protected: - void setUp() { + void setUp() override { auto serviceContext = ServiceContext::make(); setGlobalServiceContext(std::move(serviceContext)); } @@ -116,7 +116,7 @@ private: */ class BasicRS : public DBClientRSTest { protected: - void setUp() { + void setUp() override { DBClientRSTest::setUp(); ReplicaSetMonitor::cleanup(); @@ -127,7 +127,7 @@ protected: ConnectionString::setConnectionHook(mongo::MockConnRegistry::get()->getConnStrHook()); } - void tearDown() { + void tearDown() override { _replSet.reset(); mongo::ScopedDbConnection::clearPool(); @@ -238,7 +238,7 @@ TEST_F(BasicRS, CommandSecondaryPreferred) { */ class AllNodesDown : public DBClientRSTest { protected: - void setUp() { + void setUp() override { DBClientRSTest::setUp(); ReplicaSetMonitor::cleanup(); @@ -255,7 +255,7 @@ protected: getTopologyManager()->setTopologyDescription(_replSet->getTopologyDescription(clock())); } - void tearDown() { + void tearDown() override { ReplicaSetMonitor::cleanup(); _replSet.reset(); @@ -358,7 +358,7 @@ TEST_F(AllNodesDown, CommandNearest) { */ class PrimaryDown : public DBClientRSTest { protected: - void setUp() { + void setUp() override { DBClientRSTest::setUp(); ReplicaSetMonitor::cleanup(); @@ -370,7 +370,7 @@ protected: getTopologyManager()->setTopologyDescription(_replSet->getTopologyDescription(clock())); } - void tearDown() { + void tearDown() override { ReplicaSetMonitor::cleanup(); _replSet.reset(); @@ -466,7 +466,7 @@ TEST_F(PrimaryDown, Nearest) { */ class SecondaryDown : public DBClientRSTest { protected: - void setUp() { + void setUp() override { DBClientRSTest::setUp(); ReplicaSetMonitor::cleanup(); @@ -479,7 +479,7 @@ protected: getTopologyManager()->setTopologyDescription(_replSet->getTopologyDescription(clock())); } - void tearDown() { + void tearDown() override { ReplicaSetMonitor::cleanup(); _replSet.reset(); @@ -576,7 +576,7 @@ TEST_F(SecondaryDown, CommandNearest) { */ class TaggedFiveMemberRS : public DBClientRSTest { protected: - void setUp() { + void setUp() override { DBClientRSTest::setUp(); // This shuts down the background RSMWatcher thread and prevents it from running. These @@ -681,7 +681,7 @@ protected: getTopologyManager()->setTopologyDescription(_replSet->getTopologyDescription(clock())); } - void tearDown() { + void tearDown() override { ConnectionString::setConnectionHook(_originalConnectionHook); ReplicaSetMonitor::cleanup(); _replSet.reset(); diff --git a/src/mongo/client/dbclient_session.h b/src/mongo/client/dbclient_session.h index 74485d56ab4..973d363decf 100644 --- a/src/mongo/client/dbclient_session.h +++ b/src/mongo/client/dbclient_session.h @@ -112,7 +112,7 @@ public: const HandshakeValidationHook& hook, const ClientAPIVersionParameters* apiParameters); - virtual ~DBClientSession() {} + ~DBClientSession() override {} /** * Connect to a Mongo database server. @@ -164,11 +164,11 @@ public: _maxWireVersion = maxWireVersion; } - virtual int getMinWireVersion() { + int getMinWireVersion() override { return _minWireVersion; } - virtual int getMaxWireVersion() { + int getMaxWireVersion() override { return _maxWireVersion; } diff --git a/src/mongo/client/native_sasl_client_session.h b/src/mongo/client/native_sasl_client_session.h index 2b6e2848eb0..b720023a39f 100644 --- a/src/mongo/client/native_sasl_client_session.h +++ b/src/mongo/client/native_sasl_client_session.h @@ -49,11 +49,11 @@ class NativeSaslClientSession : public SaslClientSession { public: NativeSaslClientSession(); - ~NativeSaslClientSession(); + ~NativeSaslClientSession() override; - virtual Status initialize(); + Status initialize() override; - virtual Status step(StringData inputData, std::string* outputData); + Status step(StringData inputData, std::string* outputData) override; bool isSuccess() const override { return _success; diff --git a/src/mongo/client/remote_command_retry_scheduler_test.cpp b/src/mongo/client/remote_command_retry_scheduler_test.cpp index da611335a19..1f6fe3082fe 100644 --- a/src/mongo/client/remote_command_retry_scheduler_test.cpp +++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp @@ -104,7 +104,7 @@ class TaskExecutorWithFailureInScheduleRemoteCommand : public unittest::TaskExec public: TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor) : unittest::TaskExecutorProxy(executor) {} - virtual StatusWith scheduleRemoteCommandOnAny( + StatusWith scheduleRemoteCommandOnAny( const executor::RemoteCommandRequestOnAny& request, const RemoteCommandOnAnyCallbackFn& cb, const BatonHandle& baton = nullptr) override { diff --git a/src/mongo/client/remote_command_targeter_factory_impl.h b/src/mongo/client/remote_command_targeter_factory_impl.h index 243f15e7b27..f060acf4444 100644 --- a/src/mongo/client/remote_command_targeter_factory_impl.h +++ b/src/mongo/client/remote_command_targeter_factory_impl.h @@ -46,7 +46,7 @@ namespace mongo { class RemoteCommandTargeterFactoryImpl final : public RemoteCommandTargeterFactory { public: RemoteCommandTargeterFactoryImpl(); - ~RemoteCommandTargeterFactoryImpl(); + ~RemoteCommandTargeterFactoryImpl() override; std::unique_ptr create(const ConnectionString& connStr) override; }; diff --git a/src/mongo/client/remote_command_targeter_factory_mock.h b/src/mongo/client/remote_command_targeter_factory_mock.h index cca2922a9b1..e0ef864afcd 100644 --- a/src/mongo/client/remote_command_targeter_factory_mock.h +++ b/src/mongo/client/remote_command_targeter_factory_mock.h @@ -46,7 +46,7 @@ namespace mongo { class RemoteCommandTargeterFactoryMock final : public RemoteCommandTargeterFactory { public: RemoteCommandTargeterFactoryMock(); - ~RemoteCommandTargeterFactoryMock(); + ~RemoteCommandTargeterFactoryMock() override; /** * If the input connection string matches one of the pre-defined targeters added through an diff --git a/src/mongo/client/remote_command_targeter_mock.h b/src/mongo/client/remote_command_targeter_mock.h index 92092804d1b..f00ba7192f7 100644 --- a/src/mongo/client/remote_command_targeter_mock.h +++ b/src/mongo/client/remote_command_targeter_mock.h @@ -51,7 +51,7 @@ namespace mongo { class RemoteCommandTargeterMock final : public RemoteCommandTargeter { public: RemoteCommandTargeterMock(); - virtual ~RemoteCommandTargeterMock(); + ~RemoteCommandTargeterMock() override; /** * Shortcut for unit-tests. diff --git a/src/mongo/client/replica_set_monitor_manager.h b/src/mongo/client/replica_set_monitor_manager.h index 93674dc5a41..3bceb1c39d2 100644 --- a/src/mongo/client/replica_set_monitor_manager.h +++ b/src/mongo/client/replica_set_monitor_manager.h @@ -72,7 +72,7 @@ class MongoURI; class ReplicaSetMonitorManagerNetworkConnectionHook final : public executor::NetworkConnectionHook { public: ReplicaSetMonitorManagerNetworkConnectionHook() = default; - virtual ~ReplicaSetMonitorManagerNetworkConnectionHook() = default; + ~ReplicaSetMonitorManagerNetworkConnectionHook() override = default; Status validateHost(const HostAndPort& remoteHost, const BSONObj& helloRequest, diff --git a/src/mongo/client/replica_set_monitor_server_parameters_test.cpp b/src/mongo/client/replica_set_monitor_server_parameters_test.cpp index f7cb837c1d0..402409f58fe 100644 --- a/src/mongo/client/replica_set_monitor_server_parameters_test.cpp +++ b/src/mongo/client/replica_set_monitor_server_parameters_test.cpp @@ -41,12 +41,12 @@ namespace { */ class ReplicaSetMonitorProtocolTest : public unittest::Test { protected: - void setUp() { + void setUp() override { setGlobalServiceContext(ServiceContext::make()); ReplicaSetMonitor::cleanup(); } - void tearDown() { + void tearDown() override { ReplicaSetMonitor::cleanup(); ReplicaSetMonitorProtocolTestUtil::resetRSMProtocol(); } diff --git a/src/mongo/client/sasl_aws_client_conversation.h b/src/mongo/client/sasl_aws_client_conversation.h index 2217b0476c8..f1bda0772bd 100644 --- a/src/mongo/client/sasl_aws_client_conversation.h +++ b/src/mongo/client/sasl_aws_client_conversation.h @@ -51,7 +51,7 @@ class SaslAWSClientConversation : public SaslClientConversation { public: explicit SaslAWSClientConversation(SaslClientSession* saslClientSession); - virtual ~SaslAWSClientConversation() = default; + ~SaslAWSClientConversation() override = default; StatusWith step(StringData inputData, std::string* outputData) override; diff --git a/src/mongo/client/sasl_plain_client_conversation.h b/src/mongo/client/sasl_plain_client_conversation.h index 626453ceb45..ca1bab3c7d1 100644 --- a/src/mongo/client/sasl_plain_client_conversation.h +++ b/src/mongo/client/sasl_plain_client_conversation.h @@ -50,9 +50,9 @@ public: **/ explicit SaslPLAINClientConversation(SaslClientSession* saslClientSession); - virtual ~SaslPLAINClientConversation(); + ~SaslPLAINClientConversation() override; - virtual StatusWith step(StringData inputData, std::string* outputData); + StatusWith step(StringData inputData, std::string* outputData) override; }; } // namespace mongo diff --git a/src/mongo/client/sdam/server_selection_json_test_runner.cpp b/src/mongo/client/sdam/server_selection_json_test_runner.cpp index d70eaa4c408..56007ffe81d 100644 --- a/src/mongo/client/sdam/server_selection_json_test_runner.cpp +++ b/src/mongo/client/sdam/server_selection_json_test_runner.cpp @@ -146,9 +146,9 @@ public: parseTest(testFilePath); } - ~JsonRttTestCase() = default; + ~JsonRttTestCase() override = default; - TestCaseResult execute() { + TestCaseResult execute() override { LOGV2(4333500, "### Running Test ###", "testFilePath"_attr = _testFilePath); ServerDescriptionPtr updatedServerDescription; @@ -176,7 +176,7 @@ public: return result; } - const std::string& FilePath() const { + const std::string& FilePath() const override { return _testFilePath; } @@ -250,9 +250,9 @@ public: testFilePath.string()}; } } - ~JsonServerSelectionTestCase() = default; + ~JsonServerSelectionTestCase() override = default; - TestCaseResult execute() { + TestCaseResult execute() override { LOGV2(4333504, "### Running Test ###", "testFilePath"_attr = _testFilePath); if (_parseError) return *_parseError; @@ -289,11 +289,11 @@ public: return result; } - const std::string& FilePath() const { + const std::string& FilePath() const override { return _testFilePath; } - bool errorIsExpected() { + bool errorIsExpected() override { return _errorExpected; } diff --git a/src/mongo/client/sdam/topology_listener.h b/src/mongo/client/sdam/topology_listener.h index 4fe73a1f4b4..88cc6e51394 100644 --- a/src/mongo/client/sdam/topology_listener.h +++ b/src/mongo/client/sdam/topology_listener.h @@ -110,13 +110,13 @@ public: void onTopologyDescriptionChangedEvent(TopologyDescriptionPtr previousDescription, TopologyDescriptionPtr newDescription) override; - virtual void onServerHandshakeCompleteEvent(HelloRTT duration, - const HostAndPort& address, - BSONObj reply = BSONObj()) override; + void onServerHandshakeCompleteEvent(HelloRTT duration, + const HostAndPort& address, + BSONObj reply = BSONObj()) override; void onServerHandshakeFailedEvent(const HostAndPort& address, const Status& status, - BSONObj reply); + BSONObj reply) override; void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, diff --git a/src/mongo/client/sdam/topology_listener_mock.h b/src/mongo/client/sdam/topology_listener_mock.h index b07ccd377af..b04801d9dc8 100644 --- a/src/mongo/client/sdam/topology_listener_mock.h +++ b/src/mongo/client/sdam/topology_listener_mock.h @@ -47,7 +47,7 @@ namespace mongo::sdam { class TopologyListenerMock : public TopologyListener { public: TopologyListenerMock() = default; - virtual ~TopologyListenerMock() = default; + ~TopologyListenerMock() override = default; void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; diff --git a/src/mongo/client/server_discovery_monitor.h b/src/mongo/client/server_discovery_monitor.h index 3f77b5b0de4..e4c9f66835e 100644 --- a/src/mongo/client/server_discovery_monitor.h +++ b/src/mongo/client/server_discovery_monitor.h @@ -148,7 +148,7 @@ public: std::shared_ptr stats, std::shared_ptr executor = nullptr); - virtual ~ServerDiscoveryMonitor() {} + ~ServerDiscoveryMonitor() override {} void shutdown(); diff --git a/src/mongo/client/server_ping_monitor.h b/src/mongo/client/server_ping_monitor.h index 337c8237dc5..2d615fe688c 100644 --- a/src/mongo/client/server_ping_monitor.h +++ b/src/mongo/client/server_ping_monitor.h @@ -149,7 +149,7 @@ public: sdam::TopologyListener* rttListener, Milliseconds pingFrequency, std::shared_ptr executor); - ~ServerPingMonitor(); + ~ServerPingMonitor() override; /** * Drops all SingleServerMonitors and shuts down the task executor. @@ -162,14 +162,14 @@ public: */ void onServerHandshakeCompleteEvent(sdam::HelloRTT durationMs, const HostAndPort& address, - BSONObj reply = BSONObj()); + BSONObj reply = BSONObj()) override; /** * Drop corresponding SingleServerPingMonitors if the server is not included in the * newDescritpion. */ void onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription, - sdam::TopologyDescriptionPtr newDescription); + sdam::TopologyDescriptionPtr newDescription) override; private: MongoURI _setUri; diff --git a/src/mongo/client/server_ping_monitor_test.cpp b/src/mongo/client/server_ping_monitor_test.cpp index cf59f6de637..17224d41647 100644 --- a/src/mongo/client/server_ping_monitor_test.cpp +++ b/src/mongo/client/server_ping_monitor_test.cpp @@ -245,14 +245,14 @@ private: class SingleServerPingMonitorTest : public ServerPingMonitorTestFixture { protected: - void setUp() { + void setUp() override { ServerPingMonitorTestFixture::setUp(); _replSet.reset(new MockReplicaSet( "test", 1, /* hasPrimary = */ false, /* dollarPrefixHosts = */ false)); _hostAndPort = HostAndPort(_replSet->getSecondaries()[0]); } - void tearDown() { + void tearDown() override { _replSet.reset(); ServerPingMonitorTestFixture::tearDown(); } diff --git a/src/mongo/crypto/fle_crypto_test.cpp b/src/mongo/crypto/fle_crypto_test.cpp index 95fc4e2e1fa..35d65e7f07f 100644 --- a/src/mongo/crypto/fle_crypto_test.cpp +++ b/src/mongo/crypto/fle_crypto_test.cpp @@ -193,7 +193,7 @@ public: BSONObj getEncryptedKey(const UUID& uuid) override; - SymmetricKey& getKMSLocalKey() { + SymmetricKey& getKMSLocalKey() override { return _localKey; } diff --git a/src/mongo/crypto/jwks_fetcher_mock.h b/src/mongo/crypto/jwks_fetcher_mock.h index c8846a45681..f28abd459ba 100644 --- a/src/mongo/crypto/jwks_fetcher_mock.h +++ b/src/mongo/crypto/jwks_fetcher_mock.h @@ -40,7 +40,7 @@ class MockJWKSFetcher : public JWKSFetcher { public: MockJWKSFetcher(BSONObj keys) : _keys(std::move(keys)) {} - JWKSet fetch() { + JWKSet fetch() override { if (_shouldFail) { uasserted(ErrorCodes::NetworkTimeout, "Mock JWKS fetcher configured to simulate timeout"); diff --git a/src/mongo/db/admission/throughput_probing.h b/src/mongo/db/admission/throughput_probing.h index f741ff7f7fd..36efd4320db 100644 --- a/src/mongo/db/admission/throughput_probing.h +++ b/src/mongo/db/admission/throughput_probing.h @@ -120,12 +120,12 @@ public: std::unique_ptr readTicketHolder, std::unique_ptr writeTicketHolder, Milliseconds interval); - virtual bool supportsRuntimeSizeAdjustment() const override { + bool supportsRuntimeSizeAdjustment() const override { return false; } protected: - virtual void _appendImplStats(BSONObjBuilder& builder) const override; + void _appendImplStats(BSONObjBuilder& builder) const override; private: /** diff --git a/src/mongo/db/admission/ticketholder_manager.h b/src/mongo/db/admission/ticketholder_manager.h index 0fd1b01a176..a6b8212df33 100644 --- a/src/mongo/db/admission/ticketholder_manager.h +++ b/src/mongo/db/admission/ticketholder_manager.h @@ -114,12 +114,12 @@ public: std::unique_ptr writeTicketHolder) : TicketHolderManager(std::move(readTicketHolder), std::move(writeTicketHolder)) {} - virtual bool supportsRuntimeSizeAdjustment() const override { + bool supportsRuntimeSizeAdjustment() const override { return true; } protected: - virtual void _appendImplStats(BSONObjBuilder& builder) const override {} + void _appendImplStats(BSONObjBuilder& builder) const override {} }; } // namespace admission } // namespace mongo diff --git a/src/mongo/db/audit_interface.h b/src/mongo/db/audit_interface.h index e35c275f8da..24e195df7e8 100644 --- a/src/mongo/db/audit_interface.h +++ b/src/mongo/db/audit_interface.h @@ -473,179 +473,182 @@ struct TryLogEventParams { class AuditNoOp : public AuditInterface { public: AuditNoOp() = default; - ~AuditNoOp() = default; + ~AuditNoOp() override = default; - void logClientMetadata(Client* client) const {}; + void logClientMetadata(Client* client) const override{}; - void logAuthentication(Client* client, const AuthenticateEvent& event) const {}; + void logAuthentication(Client* client, const AuthenticateEvent& event) const override{}; void logCommandAuthzCheck(Client* client, const OpMsgRequest& cmdObj, const CommandInterface& command, - ErrorCodes::Error result) const {}; + ErrorCodes::Error result) const override{}; void logKillCursorsAuthzCheck(Client* client, const NamespaceString& ns, long long cursorId, - ErrorCodes::Error result) const {}; + ErrorCodes::Error result) const override{}; void logCreateUser(Client* client, const UserName& username, bool password, const BSONObj* customData, const std::vector& roles, - const boost::optional& restrictions) const {}; + const boost::optional& restrictions) const override{}; - void logDropUser(Client* client, const UserName& username) const {}; + void logDropUser(Client* client, const UserName& username) const override{}; - void logDropAllUsersFromDatabase(Client* client, const DatabaseName& dbname) const {}; + void logDropAllUsersFromDatabase(Client* client, const DatabaseName& dbname) const override{}; void logUpdateUser(Client* client, const UserName& username, bool password, const BSONObj* customData, const std::vector* roles, - const boost::optional& restrictions) const {}; + const boost::optional& restrictions) const override{}; void logGrantRolesToUser(Client* client, const UserName& username, - const std::vector& roles) const {}; + const std::vector& roles) const override{}; void logRevokeRolesFromUser(Client* client, const UserName& username, - const std::vector& roles) const {}; + const std::vector& roles) const override{}; void logCreateRole(Client* client, const RoleName& role, const std::vector& roles, const PrivilegeVector& privileges, - const boost::optional& restrictions) const {}; + const boost::optional& restrictions) const override{}; void logUpdateRole(Client* client, const RoleName& role, const std::vector* roles, const PrivilegeVector* privileges, - const boost::optional& restrictions) const {}; + const boost::optional& restrictions) const override{}; - void logDropRole(Client* client, const RoleName& role) const {}; + void logDropRole(Client* client, const RoleName& role) const override{}; - void logDropAllRolesFromDatabase(Client* client, const DatabaseName& dbname) const {}; + void logDropAllRolesFromDatabase(Client* client, const DatabaseName& dbname) const override{}; void logGrantRolesToRole(Client* client, const RoleName& role, - const std::vector& roles) const {}; + const std::vector& roles) const override{}; void logRevokeRolesFromRole(Client* client, const RoleName& role, - const std::vector& roles) const {}; + const std::vector& roles) const override{}; void logGrantPrivilegesToRole(Client* client, const RoleName& role, - const PrivilegeVector& privileges) const {}; + const PrivilegeVector& privileges) const override{}; void logRevokePrivilegesFromRole(Client* client, const RoleName& role, - const PrivilegeVector& privileges) const {}; + const PrivilegeVector& privileges) const override{}; void logReplSetReconfig(Client* client, const BSONObj* oldConfig, - const BSONObj* newConfig) const {}; + const BSONObj* newConfig) const override{}; - void logApplicationMessage(Client* client, StringData msg) const {}; + void logApplicationMessage(Client* client, StringData msg) const override{}; - void logStartupOptions(Client* client, const BSONObj& startupOptions) const {}; + void logStartupOptions(Client* client, const BSONObj& startupOptions) const override{}; - void logShutdown(Client* client) const {}; + void logShutdown(Client* client) const override{}; void logLogout(Client* client, StringData reason, const BSONArray& initialUsers, const BSONArray& updatedUsers, - const boost::optional& loginTime) const {}; + const boost::optional& loginTime) const override{}; void logCreateIndex(Client* client, const BSONObj* indexSpec, StringData indexname, const NamespaceString& nsname, StringData indexBuildState, - ErrorCodes::Error result) const {}; + ErrorCodes::Error result) const override{}; - void logCreateCollection(Client* client, const NamespaceString& nsname) const {}; + void logCreateCollection(Client* client, const NamespaceString& nsname) const override{}; void logCreateView(Client* client, const NamespaceString& nsname, const NamespaceString& viewOn, BSONArray pipeline, - ErrorCodes::Error code) const {}; + ErrorCodes::Error code) const override{}; - void logImportCollection(Client* client, const NamespaceString& nsname) const {}; + void logImportCollection(Client* client, const NamespaceString& nsname) const override{}; - void logCreateDatabase(Client* client, const DatabaseName& dbname) const {}; + void logCreateDatabase(Client* client, const DatabaseName& dbname) const override{}; - void logDropIndex(Client* client, StringData indexname, const NamespaceString& nsname) const {}; + void logDropIndex(Client* client, + StringData indexname, + const NamespaceString& nsname) const override{}; - void logDropCollection(Client* client, const NamespaceString& nsname) const {}; + void logDropCollection(Client* client, const NamespaceString& nsname) const override{}; void logDropView(Client* client, const NamespaceString& nsname, const NamespaceString& viewOn, const std::vector& pipeline, - ErrorCodes::Error code) const {}; + ErrorCodes::Error code) const override{}; - void logDropDatabase(Client* client, const DatabaseName& dbname) const {}; + void logDropDatabase(Client* client, const DatabaseName& dbname) const override{}; void logRenameCollection(Client* client, const NamespaceString& source, - const NamespaceString& target) const {}; + const NamespaceString& target) const override{}; - void logEnableSharding(Client* client, StringData dbname) const {}; + void logEnableSharding(Client* client, StringData dbname) const override{}; - void logAddShard(Client* client, StringData name, const std::string& servers) const {}; + void logAddShard(Client* client, StringData name, const std::string& servers) const override{}; - void logRemoveShard(Client* client, StringData shardname) const {}; + void logRemoveShard(Client* client, StringData shardname) const override{}; void logShardCollection(Client* client, const NamespaceString& ns, const BSONObj& keyPattern, - bool unique) const {}; + bool unique) const override{}; void logRefineCollectionShardKey(Client* client, const NamespaceString& ns, - const BSONObj& keyPattern) const {}; + const BSONObj& keyPattern) const override{}; void logInsertOperation(Client* client, const NamespaceString& nss, - const BSONObj& doc) const {}; + const BSONObj& doc) const override{}; void logUpdateOperation(Client* client, const NamespaceString& nss, - const BSONObj& doc) const {}; + const BSONObj& doc) const override{}; void logRemoveOperation(Client* client, const NamespaceString& nss, - const BSONObj& doc) const {}; + const BSONObj& doc) const override{}; - void logGetClusterParameter( - Client* client, - const std::variant>& requestedParameters) const {}; + void logGetClusterParameter(Client* client, + const std::variant>& + requestedParameters) const override{}; void logSetClusterParameter(Client* client, const BSONObj& oldValue, const BSONObj& newValue, - const boost::optional& tenantId) const {}; + const boost::optional& tenantId) const override{}; - void logUpdateCachedClusterParameter(Client* client, - const BSONObj& oldValue, - const BSONObj& newValue, - const boost::optional& tenantId) const {}; + void logUpdateCachedClusterParameter( + Client* client, + const BSONObj& oldValue, + const BSONObj& newValue, + const boost::optional& tenantId) const override{}; void logRotateLog(Client* client, const Status& logStatus, const std::vector& errors, - const std::string& suffix) const {}; + const std::string& suffix) const override{}; - void logConfigEvent(Client* client, const AuditConfigDocument& config) const {}; + void logConfigEvent(Client* client, const AuditConfigDocument& config) const override{}; }; } // namespace audit diff --git a/src/mongo/db/auth/auth_op_observer.h b/src/mongo/db/auth/auth_op_observer.h index c8d331c0e3b..3e20e360aa3 100644 --- a/src/mongo/db/auth/auth_op_observer.h +++ b/src/mongo/db/auth/auth_op_observer.h @@ -60,7 +60,7 @@ class AuthOpObserver final : public OpObserverNoop { public: AuthOpObserver(); - ~AuthOpObserver(); + ~AuthOpObserver() override; // The filtering for this OpObserver is derived from the namespace filters in // AuthorizationManagerImpl and the various AuditInterface implementations, see SERVER-83383. diff --git a/src/mongo/db/auth/authorization_manager_impl.h b/src/mongo/db/auth/authorization_manager_impl.h index f7d1af732ca..23d66cb44e1 100644 --- a/src/mongo/db/auth/authorization_manager_impl.h +++ b/src/mongo/db/auth/authorization_manager_impl.h @@ -78,7 +78,7 @@ public: AuthorizationManagerImpl(Service* service, std::unique_ptr externalState); - ~AuthorizationManagerImpl(); + ~AuthorizationManagerImpl() override; std::unique_ptr makeAuthorizationSession() override; diff --git a/src/mongo/db/auth/authorization_manager_test.cpp b/src/mongo/db/auth/authorization_manager_test.cpp index 9266fb1afb7..0865e4d8ee2 100644 --- a/src/mongo/db/auth/authorization_manager_test.cpp +++ b/src/mongo/db/auth/authorization_manager_test.cpp @@ -114,7 +114,7 @@ public: "password", saslGlobalParams.scramSHA256IterationCount.load())); } - ~AuthorizationManagerTest() { + ~AuthorizationManagerTest() override { if (authzManager) AuthorizationManager::get(opCtx->getService())->invalidateUserCache(); } diff --git a/src/mongo/db/auth/authorization_session_test_fixture.h b/src/mongo/db/auth/authorization_session_test_fixture.h index 64afeba2627..466f1470516 100644 --- a/src/mongo/db/auth/authorization_session_test_fixture.h +++ b/src/mongo/db/auth/authorization_session_test_fixture.h @@ -45,7 +45,7 @@ namespace mongo { class FailureCapableAuthzManagerExternalStateMock : public AuthzManagerExternalStateMock { public: FailureCapableAuthzManagerExternalStateMock() = default; - ~FailureCapableAuthzManagerExternalStateMock() = default; + ~FailureCapableAuthzManagerExternalStateMock() override = default; void setFindsShouldFail(bool enable) { _findsShouldFail = enable; @@ -68,7 +68,7 @@ private: class AuthorizationSessionTestFixture : public ServiceContextMongoDTest { public: - void setUp(); + void setUp() override; void tearDown() override { authzSession->logoutAllDatabases(_client.get(), "Ending AuthorizationSessionTest"); diff --git a/src/mongo/db/auth/authz_manager_external_state_d.h b/src/mongo/db/auth/authz_manager_external_state_d.h index 3a35f394ea5..9c04759ff97 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.h +++ b/src/mongo/db/auth/authz_manager_external_state_d.h @@ -54,7 +54,7 @@ class AuthzManagerExternalStateMongod : public AuthzManagerExternalStateLocal { public: AuthzManagerExternalStateMongod(); - virtual ~AuthzManagerExternalStateMongod(); + ~AuthzManagerExternalStateMongod() override; std::unique_ptr makeAuthzSessionExternalState( AuthorizationManager* authzManager) final; diff --git a/src/mongo/db/auth/authz_manager_external_state_local.h b/src/mongo/db/auth/authz_manager_external_state_local.h index 0fb89f1ab06..76504ea35c1 100644 --- a/src/mongo/db/auth/authz_manager_external_state_local.h +++ b/src/mongo/db/auth/authz_manager_external_state_local.h @@ -67,7 +67,7 @@ class AuthzManagerExternalStateLocal : public AuthzManagerExternalState { AuthzManagerExternalStateLocal& operator=(const AuthzManagerExternalStateLocal&) = delete; public: - virtual ~AuthzManagerExternalStateLocal() = default; + ~AuthzManagerExternalStateLocal() override = default; Status hasValidStoredAuthorizationVersion(OperationContext* opCtx, BSONObj* foundVersionDoc) override; diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.h b/src/mongo/db/auth/authz_manager_external_state_mock.h index 10ce9fca068..958ec6cf585 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.h +++ b/src/mongo/db/auth/authz_manager_external_state_mock.h @@ -60,7 +60,7 @@ class AuthzManagerExternalStateMock : public AuthzManagerExternalStateLocal { public: AuthzManagerExternalStateMock(); - virtual ~AuthzManagerExternalStateMock(); + ~AuthzManagerExternalStateMock() override; void setAuthorizationManager(AuthorizationManager* authzManager); void setAuthzVersion(OperationContext* opCtx, int version); diff --git a/src/mongo/db/auth/authz_session_external_state_d.h b/src/mongo/db/auth/authz_session_external_state_d.h index 85047c31cc8..449e20611ff 100644 --- a/src/mongo/db/auth/authz_session_external_state_d.h +++ b/src/mongo/db/auth/authz_session_external_state_d.h @@ -45,13 +45,13 @@ class AuthzSessionExternalStateMongod : public AuthzSessionExternalStateServerCo public: AuthzSessionExternalStateMongod(AuthorizationManager* authzManager); - virtual ~AuthzSessionExternalStateMongod(); + ~AuthzSessionExternalStateMongod() override; - virtual bool shouldIgnoreAuthChecks() const; + bool shouldIgnoreAuthChecks() const override; - virtual bool serverIsArbiter() const; + bool serverIsArbiter() const override; - virtual void startRequest(OperationContext* opCtx); + void startRequest(OperationContext* opCtx) override; }; } // namespace mongo diff --git a/src/mongo/db/auth/authz_session_external_state_mock.h b/src/mongo/db/auth/authz_session_external_state_mock.h index 9baf148cb3a..348d3d9abaa 100644 --- a/src/mongo/db/auth/authz_session_external_state_mock.h +++ b/src/mongo/db/auth/authz_session_external_state_mock.h @@ -50,15 +50,15 @@ public: _allowLocalhostReturnValue(false), _serverIsArbiterReturnValue(false) {} - virtual bool shouldIgnoreAuthChecks() const { + bool shouldIgnoreAuthChecks() const override { return _ignoreAuthChecksReturnValue; } - virtual bool shouldAllowLocalhost() const { + bool shouldAllowLocalhost() const override { return _allowLocalhostReturnValue; } - virtual bool serverIsArbiter() const { + bool serverIsArbiter() const override { return _serverIsArbiterReturnValue; } @@ -70,7 +70,7 @@ public: _allowLocalhostReturnValue = returnValue; } - virtual void startRequest(OperationContext* opCtx) {} + void startRequest(OperationContext* opCtx) override {} private: bool _ignoreAuthChecksReturnValue; diff --git a/src/mongo/db/auth/authz_session_external_state_s.h b/src/mongo/db/auth/authz_session_external_state_s.h index d34e1948dfe..1ae4f74b8b8 100644 --- a/src/mongo/db/auth/authz_session_external_state_s.h +++ b/src/mongo/db/auth/authz_session_external_state_s.h @@ -45,9 +45,9 @@ class AuthzSessionExternalStateMongos : public AuthzSessionExternalStateServerCo public: AuthzSessionExternalStateMongos(AuthorizationManager* authzManager); - virtual ~AuthzSessionExternalStateMongos(); + ~AuthzSessionExternalStateMongos() override; - virtual void startRequest(OperationContext* opCtx); + void startRequest(OperationContext* opCtx) override; }; } // namespace mongo diff --git a/src/mongo/db/auth/authz_session_external_state_server_common.h b/src/mongo/db/auth/authz_session_external_state_server_common.h index 480e1cb1b9c..e1ebf9c5670 100644 --- a/src/mongo/db/auth/authz_session_external_state_server_common.h +++ b/src/mongo/db/auth/authz_session_external_state_server_common.h @@ -45,11 +45,11 @@ class AuthzSessionExternalStateServerCommon : public AuthzSessionExternalState { delete; public: - virtual ~AuthzSessionExternalStateServerCommon(); + ~AuthzSessionExternalStateServerCommon() override; - virtual bool shouldAllowLocalhost() const; - virtual bool shouldIgnoreAuthChecks() const; - virtual bool serverIsArbiter() const; + bool shouldAllowLocalhost() const override; + bool shouldIgnoreAuthChecks() const override; + bool serverIsArbiter() const override; protected: AuthzSessionExternalStateServerCommon(AuthorizationManager* authzManager); diff --git a/src/mongo/db/auth/restriction_mock.h b/src/mongo/db/auth/restriction_mock.h index 33295800820..c437562f7e2 100644 --- a/src/mongo/db/auth/restriction_mock.h +++ b/src/mongo/db/auth/restriction_mock.h @@ -48,7 +48,7 @@ public: "Mock restriction forced to be unmet"); } - virtual void appendToBuilder(BSONArrayBuilder* builder) const { + void appendToBuilder(BSONArrayBuilder* builder) const override { builder->append(_shouldPass); } @@ -74,7 +74,7 @@ public: "Mock restriction forced to be unmet"); } - virtual void appendToBuilder(BSONObjBuilder* builder) const final { + void appendToBuilder(BSONObjBuilder* builder) const final { builder->append(_name, _shouldPass); } diff --git a/src/mongo/db/auth/sasl_commands.cpp b/src/mongo/db/auth/sasl_commands.cpp index 63366050b4d..bac24eb8257 100644 --- a/src/mongo/db/auth/sasl_commands.cpp +++ b/src/mongo/db/auth/sasl_commands.cpp @@ -98,7 +98,7 @@ public: return NamespaceString(request().getDbName()); } - Reply typedRun(OperationContext* opCtx); + Reply typedRun(OperationContext* opCtx) override; }; std::string help() const final { @@ -137,7 +137,7 @@ public: return NamespaceString(request().getDbName()); } - Reply typedRun(OperationContext* opCtx); + Reply typedRun(OperationContext* opCtx) override; }; std::string help() const final { diff --git a/src/mongo/db/auth/sasl_mechanism_registry.h b/src/mongo/db/auth/sasl_mechanism_registry.h index e72185aa0fb..9200c2b75c7 100644 --- a/src/mongo/db/auth/sasl_mechanism_registry.h +++ b/src/mongo/db/auth/sasl_mechanism_registry.h @@ -155,7 +155,7 @@ public: explicit ServerMechanismBase(std::string authenticationDatabase) : _authenticationDatabase(std::move(authenticationDatabase)) {} - virtual ~ServerMechanismBase() = default; + ~ServerMechanismBase() override = default; /** * Returns the principal name which this mechanism is performing authentication for. @@ -296,7 +296,7 @@ class MakeServerMechanism : public ServerMechanismBase { public: explicit MakeServerMechanism(std::string authenticationDatabase) : ServerMechanismBase(std::move(authenticationDatabase)) {} - virtual ~MakeServerMechanism() = default; + ~MakeServerMechanism() override = default; using policy_type = Policy; @@ -332,7 +332,7 @@ public: explicit MakeServerFactory(Service*) {} MakeServerFactory() = default; - virtual ServerMechanism* createImpl(std::string authenticationDatabase) override { + ServerMechanism* createImpl(std::string authenticationDatabase) override { return new ServerMechanism(std::move(authenticationDatabase)); } diff --git a/src/mongo/db/auth/sasl_scram_server_conversation.h b/src/mongo/db/auth/sasl_scram_server_conversation.h index 1530133fa77..63e93aaaec4 100644 --- a/src/mongo/db/auth/sasl_scram_server_conversation.h +++ b/src/mongo/db/auth/sasl_scram_server_conversation.h @@ -72,7 +72,7 @@ public: * **/ StatusWith> stepImpl(OperationContext* opCtx, - StringData inputData); + StringData inputData) override; StatusWith saslPrep(StringData str) const { if (std::is_same::value) { diff --git a/src/mongo/db/auth/user_document_parser_test.cpp b/src/mongo/db/auth/user_document_parser_test.cpp index 54cf9c89a6b..7de4e6a0956 100644 --- a/src/mongo/db/auth/user_document_parser_test.cpp +++ b/src/mongo/db/auth/user_document_parser_test.cpp @@ -77,7 +77,7 @@ public: BSONObj credentials; BSONObj sha1_creds, sha256_creds; - void setUp() { + void setUp() override { user.reset(new User(UserRequest(UserName("spencer", "test"), boost::none))); adminUser.reset(new User(UserRequest(UserName("admin", "admin"), boost::none))); diff --git a/src/mongo/db/baton.cpp b/src/mongo/db/baton.cpp index ddb16877a32..a1509da2231 100644 --- a/src/mongo/db/baton.cpp +++ b/src/mongo/db/baton.cpp @@ -61,7 +61,7 @@ class SubBaton final : public Baton { public: explicit SubBaton(BatonHandle baton) : _baton(std::move(baton)) {} - ~SubBaton() { + ~SubBaton() override { invariant(_isDead); } diff --git a/src/mongo/db/baton.h b/src/mongo/db/baton.h index d098251d33a..8cbbb6c500f 100644 --- a/src/mongo/db/baton.h +++ b/src/mongo/db/baton.h @@ -64,7 +64,7 @@ class Baton : public Waitable, public OutOfLineExecutor, public std::enable_shared_from_this { public: - virtual ~Baton() = default; + ~Baton() override = default; /** * Detaches a baton from an associated opCtx. diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h index 0a0ca54d1de..ed051ee9f78 100644 --- a/src/mongo/db/catalog/collection.h +++ b/src/mongo/db/catalog/collection.h @@ -229,7 +229,7 @@ public: }; Collection() = default; - virtual ~Collection() = default; + ~Collection() override = default; /** * Clones this Collection instance. Some members are deep copied and some are shallow copied. @@ -771,7 +771,7 @@ public: CollectionPtr(const CollectionPtr&) = delete; CollectionPtr(CollectionPtr&&); - ~CollectionPtr(); + ~CollectionPtr() override; CollectionPtr& operator=(const CollectionPtr&) = delete; CollectionPtr& operator=(CollectionPtr&&); diff --git a/src/mongo/db/catalog/collection_catalog_test.cpp b/src/mongo/db/catalog/collection_catalog_test.cpp index 4fccf72ba56..2542bffc1e9 100644 --- a/src/mongo/db/catalog/collection_catalog_test.cpp +++ b/src/mongo/db/catalog/collection_catalog_test.cpp @@ -122,7 +122,7 @@ public: std::make_unique(getServiceContext())); } - void tearDown() { + void tearDown() override { globalLock.reset(); } @@ -140,7 +140,7 @@ protected: class CollectionCatalogIterationTest : public ServiceContextMongoDTest { public: - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); opCtx = makeOperationContext(); globalLock.emplace(opCtx.get()); @@ -162,7 +162,7 @@ public: } } - void tearDown() { + void tearDown() override { for (auto& it : dbMap) { for (auto& kv : it.second) { catalog.deregisterCollection( @@ -217,7 +217,7 @@ protected: class CollectionCatalogResourceTest : public ServiceContextMongoDTest { public: - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); opCtx = makeOperationContext(); globalLock.emplace(opCtx.get()); @@ -242,7 +242,7 @@ public: ASSERT_EQ(5, numEntries); } - void tearDown() { + void tearDown() override { std::vector collectionsToDeregister; for (auto&& coll : catalog.range(DatabaseName::createDatabaseName_forTest(boost::none, "resourceDb"))) { diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h index b66b857f5ef..43f0e19ad04 100644 --- a/src/mongo/db/catalog/collection_impl.h +++ b/src/mongo/db/catalog/collection_impl.h @@ -94,7 +94,7 @@ public: std::shared_ptr metadata, std::unique_ptr recordStore); - ~CollectionImpl(); + ~CollectionImpl() override; std::shared_ptr clone() const final; @@ -302,7 +302,7 @@ public: */ bool isEmpty(OperationContext* opCtx) const final; - inline int averageObjectSize(OperationContext* opCtx) const { + inline int averageObjectSize(OperationContext* opCtx) const override { uint64_t n = numRecords(opCtx); if (n == 0) diff --git a/src/mongo/db/catalog/collection_mock.h b/src/mongo/db/catalog/collection_mock.h index 383c1a3b7a5..f4c90862326 100644 --- a/src/mongo/db/catalog/collection_mock.h +++ b/src/mongo/db/catalog/collection_mock.h @@ -53,29 +53,29 @@ public: : _uuid(uuid), _nss(nss), _indexCatalog(std::move(indexCatalog)) {} CollectionMock(const NamespaceString& nss, RecordId catalogId) : _nss(nss), _catalogId(std::move(catalogId)) {} - ~CollectionMock() = default; + ~CollectionMock() override = default; - std::shared_ptr clone() const { + std::shared_ptr clone() const override { return std::make_shared(*this); } - SharedCollectionDecorations* getSharedDecorations() const { + SharedCollectionDecorations* getSharedDecorations() const override { return nullptr; } - void init(OperationContext* opCtx) { + void init(OperationContext* opCtx) override { MONGO_UNREACHABLE; } Status initFromExisting(OperationContext* opCtx, const std::shared_ptr& collection, const DurableCatalogEntry& catalogEntry, - boost::optional readTimestamp) { + boost::optional readTimestamp) override { MONGO_UNREACHABLE; } - RecordId getCatalogId() const { + RecordId getCatalogId() const override { return _catalogId; } @@ -83,7 +83,7 @@ public: _catalogId = std::move(catalogId); } - const NamespaceString& ns() const { + const NamespaceString& ns() const override { return _nss; } @@ -92,58 +92,61 @@ public: return Status::OK(); } - const IndexCatalog* getIndexCatalog() const { + const IndexCatalog* getIndexCatalog() const override { return _indexCatalog.get(); } - IndexCatalog* getIndexCatalog() { + IndexCatalog* getIndexCatalog() override { return _indexCatalog.get(); } - RecordStore* getRecordStore() const { + RecordStore* getRecordStore() const override { MONGO_UNREACHABLE; } - std::shared_ptr getSharedIdent() const { + std::shared_ptr getSharedIdent() const override { return std::make_shared(_nss.toString_forTest()); } - void setIdent(std::shared_ptr newIdent) { + void setIdent(std::shared_ptr newIdent) override { MONGO_UNREACHABLE; } - BSONObj getValidatorDoc() const { + BSONObj getValidatorDoc() const override { return BSONObj(); } - std::pair checkValidation(OperationContext* opCtx, - const BSONObj& document) const { + std::pair checkValidation( + OperationContext* opCtx, const BSONObj& document) const override { MONGO_UNREACHABLE; } - virtual Status checkValidationAndParseResult(OperationContext* opCtx, - const BSONObj& document) const { + Status checkValidationAndParseResult(OperationContext* opCtx, + const BSONObj& document) const override { MONGO_UNREACHABLE; } - bool requiresIdIndex() const { + bool requiresIdIndex() const override { MONGO_UNREACHABLE; } - Snapshotted docFor(OperationContext* opCtx, const RecordId& loc) const { + Snapshotted docFor(OperationContext* opCtx, const RecordId& loc) const override { MONGO_UNREACHABLE; } - bool findDoc(OperationContext* opCtx, const RecordId& loc, Snapshotted* out) const { + bool findDoc(OperationContext* opCtx, + const RecordId& loc, + Snapshotted* out) const override { MONGO_UNREACHABLE; } - std::unique_ptr getCursor(OperationContext* opCtx, bool forward) const { + std::unique_ptr getCursor(OperationContext* opCtx, + bool forward) const override { MONGO_UNREACHABLE; } - bool updateWithDamagesSupported() const { + bool updateWithDamagesSupported() const override { MONGO_UNREACHABLE; } - Status truncate(OperationContext* opCtx) { + Status truncate(OperationContext* opCtx) override { MONGO_UNREACHABLE; } @@ -155,32 +158,32 @@ public: const BSONObj& validator, MatchExpressionParser::AllowedFeatureSet allowedFeatures, boost::optional - maxFeatureCompatibilityVersion) const { + maxFeatureCompatibilityVersion) const override { MONGO_UNREACHABLE; } - void setValidator(OperationContext* opCtx, Validator validator) { + void setValidator(OperationContext* opCtx, Validator validator) override { MONGO_UNREACHABLE; } - Status setValidationLevel(OperationContext* opCtx, ValidationLevelEnum newLevel) { + Status setValidationLevel(OperationContext* opCtx, ValidationLevelEnum newLevel) override { MONGO_UNREACHABLE; } - Status setValidationAction(OperationContext* opCtx, ValidationActionEnum newAction) { + Status setValidationAction(OperationContext* opCtx, ValidationActionEnum newAction) override { MONGO_UNREACHABLE; } - boost::optional getValidationLevel() const { + boost::optional getValidationLevel() const override { MONGO_UNREACHABLE; } - boost::optional getValidationAction() const { + boost::optional getValidationAction() const override { MONGO_UNREACHABLE; } Status updateValidator(OperationContext* opCtx, BSONObj newValidator, boost::optional newLevel, - boost::optional newAction) { + boost::optional newAction) override { MONGO_UNREACHABLE; } @@ -188,61 +191,61 @@ public: MONGO_UNREACHABLE; } - bool isTemporary() const { + bool isTemporary() const override { MONGO_UNREACHABLE; } - boost::optional getTimeseriesBucketsMayHaveMixedSchemaData() const { + boost::optional getTimeseriesBucketsMayHaveMixedSchemaData() const override { MONGO_UNREACHABLE; } void setTimeseriesBucketsMayHaveMixedSchemaData(OperationContext* opCtx, - boost::optional setting) { + boost::optional setting) override { MONGO_UNREACHABLE; } - boost::optional timeseriesBucketingParametersHaveChanged() const { + boost::optional timeseriesBucketingParametersHaveChanged() const override { MONGO_UNREACHABLE; } void setTimeseriesBucketingParametersChanged(OperationContext* opCtx, - boost::optional value) { + boost::optional value) override { MONGO_UNREACHABLE; } StatusWith doesTimeseriesBucketsDocContainMixedSchemaData( - const BSONObj& bucketsDoc) const { + const BSONObj& bucketsDoc) const override { MONGO_UNREACHABLE; } - bool getRequiresTimeseriesExtendedRangeSupport() const { + bool getRequiresTimeseriesExtendedRangeSupport() const override { MONGO_UNREACHABLE; } - void setRequiresTimeseriesExtendedRangeSupport(OperationContext* opCtx) const { + void setRequiresTimeseriesExtendedRangeSupport(OperationContext* opCtx) const override { MONGO_UNREACHABLE; } - bool areTimeseriesBucketsFixed() const { + bool areTimeseriesBucketsFixed() const override { MONGO_UNREACHABLE; } - bool isClustered() const { + bool isClustered() const override { return false; } - boost::optional getClusteredInfo() const { + boost::optional getClusteredInfo() const override { MONGO_UNREACHABLE; } void updateClusteredIndexTTLSetting(OperationContext* opCtx, - boost::optional expireAfterSeconds) { + boost::optional expireAfterSeconds) override { MONGO_UNREACHABLE; } Status updateCappedSize(OperationContext* opCtx, boost::optional newCappedSize, - boost::optional newCappedMax) { + boost::optional newCappedMax) override { MONGO_UNREACHABLE; } @@ -250,32 +253,32 @@ public: MONGO_UNREACHABLE; } - bool isChangeStreamPreAndPostImagesEnabled() const { + bool isChangeStreamPreAndPostImagesEnabled() const override { MONGO_UNREACHABLE; } void setChangeStreamPreAndPostImages(OperationContext* opCtx, - ChangeStreamPreAndPostImagesOptions val) { + ChangeStreamPreAndPostImagesOptions val) override { MONGO_UNREACHABLE; } - bool areRecordIdsReplicated() const { + bool areRecordIdsReplicated() const override { return false; } - bool isCapped() const { + bool isCapped() const override { return false; } - long long getCappedMaxDocs() const { + long long getCappedMaxDocs() const override { MONGO_UNREACHABLE; } - long long getCappedMaxSize() const { + long long getCappedMaxSize() const override { MONGO_UNREACHABLE; } - bool usesCappedSnapshots() const { + bool usesCappedSnapshots() const override { return false; } @@ -285,43 +288,45 @@ public: void registerCappedInserts(OperationContext* opCtx, const RecordId& minRecord, - const RecordId& maxRecord) const { + const RecordId& maxRecord) const override { std::abort(); } - CappedVisibilityObserver* getCappedVisibilityObserver() const { + CappedVisibilityObserver* getCappedVisibilityObserver() const override { std::abort(); } - CappedVisibilitySnapshot takeCappedVisibilitySnapshot() const { + CappedVisibilitySnapshot takeCappedVisibilitySnapshot() const override { std::abort(); } - long long numRecords(OperationContext* opCtx) const { + long long numRecords(OperationContext* opCtx) const override { return 0LL; } - long long dataSize(OperationContext* opCtx) const { + long long dataSize(OperationContext* opCtx) const override { MONGO_UNREACHABLE; } - bool isEmpty(OperationContext* opCtx) const { + bool isEmpty(OperationContext* opCtx) const override { MONGO_UNREACHABLE; } - int averageObjectSize(OperationContext* const opCtx) const { + int averageObjectSize(OperationContext* const opCtx) const override { MONGO_UNREACHABLE; } - uint64_t getIndexSize(OperationContext* opCtx, BSONObjBuilder* details, int scale) const { + uint64_t getIndexSize(OperationContext* opCtx, + BSONObjBuilder* details, + int scale) const override { MONGO_UNREACHABLE; } - uint64_t getIndexFreeStorageBytes(OperationContext* const opCtx) const { + uint64_t getIndexFreeStorageBytes(OperationContext* const opCtx) const override { MONGO_UNREACHABLE; } - boost::optional getMinimumValidSnapshot() const { + boost::optional getMinimumValidSnapshot() const override { MONGO_UNREACHABLE; } @@ -329,29 +334,30 @@ public: // no-op, called by unittests } - boost::optional getTimeseriesOptions() const { + boost::optional getTimeseriesOptions() const override { return boost::none; } - void setTimeseriesOptions(OperationContext* opCtx, const TimeseriesOptions& tsOptions) { + void setTimeseriesOptions(OperationContext* opCtx, + const TimeseriesOptions& tsOptions) override { MONGO_UNREACHABLE; } - const CollatorInterface* getDefaultCollator() const { + const CollatorInterface* getDefaultCollator() const override { MONGO_UNREACHABLE; } - const CollectionOptions& getCollectionOptions() const { + const CollectionOptions& getCollectionOptions() const override { return _options; } - StatusWith addCollationDefaultsToIndexSpecsForCreate(OperationContext* opCtx, - const BSONObj& indexSpecs) const { + StatusWith addCollationDefaultsToIndexSpecsForCreate( + OperationContext* opCtx, const BSONObj& indexSpecs) const override { MONGO_UNREACHABLE; } StatusWith> addCollationDefaultsToIndexSpecsForCreate( - OperationContext* opCtx, const std::vector& indexSpecs) const { + OperationContext* opCtx, const std::vector& indexSpecs) const override { MONGO_UNREACHABLE; } @@ -364,72 +370,75 @@ public: MONGO_UNREACHABLE; } - void onDeregisterFromCatalog(OperationContext* opCtx) {} + void onDeregisterFromCatalog(OperationContext* opCtx) override {} - UUID uuid() const { + UUID uuid() const override { return _uuid; } - void indexBuildSuccess(OperationContext* opCtx, IndexCatalogEntry* index) { + void indexBuildSuccess(OperationContext* opCtx, IndexCatalogEntry* index) override { MONGO_UNREACHABLE; } - StatusWith checkMetaDataForIndex(const std::string& indexName, const BSONObj& spec) const { + StatusWith checkMetaDataForIndex(const std::string& indexName, + const BSONObj& spec) const override { MONGO_UNREACHABLE; } - void updateTTLSetting(OperationContext* opCtx, StringData idxName, long long newExpireSeconds) { + void updateTTLSetting(OperationContext* opCtx, + StringData idxName, + long long newExpireSeconds) override { MONGO_UNREACHABLE; } - void updateHiddenSetting(OperationContext* opCtx, StringData idxName, bool hidden) { + void updateHiddenSetting(OperationContext* opCtx, StringData idxName, bool hidden) override { MONGO_UNREACHABLE; } - void updateUniqueSetting(OperationContext* opCtx, StringData idxName, bool unique) { + void updateUniqueSetting(OperationContext* opCtx, StringData idxName, bool unique) override { MONGO_UNREACHABLE; } void updatePrepareUniqueSetting(OperationContext* opCtx, StringData idxName, - bool prepareUnique) { + bool prepareUnique) override { MONGO_UNREACHABLE; } - std::vector repairInvalidIndexOptions(OperationContext* opCtx) { + std::vector repairInvalidIndexOptions(OperationContext* opCtx) override { MONGO_UNREACHABLE; } - void setIsTemp(OperationContext* opCtx, bool isTemp) { + void setIsTemp(OperationContext* opCtx, bool isTemp) override { MONGO_UNREACHABLE; } - void removeIndex(OperationContext* opCtx, StringData indexName) { + void removeIndex(OperationContext* opCtx, StringData indexName) override { MONGO_UNREACHABLE; } Status prepareForIndexBuild(OperationContext* opCtx, const IndexDescriptor* spec, boost::optional buildUUID, - bool isBackgroundSecondaryBuild) { + bool isBackgroundSecondaryBuild) override { MONGO_UNREACHABLE; } - boost::optional getIndexBuildUUID(StringData indexName) const { + boost::optional getIndexBuildUUID(StringData indexName) const override { MONGO_UNREACHABLE; } bool isIndexMultikey(OperationContext* opCtx, StringData indexName, MultikeyPaths* multikeyPaths, - int indexOffset) const { + int indexOffset) const override { MONGO_UNREACHABLE; } bool setIndexIsMultikey(OperationContext* opCtx, StringData indexName, const MultikeyPaths& multikeyPaths, - int indexOffset) const { + int indexOffset) const override { MONGO_UNREACHABLE; } @@ -440,52 +449,52 @@ public: MONGO_UNREACHABLE; } - int getTotalIndexCount() const { + int getTotalIndexCount() const override { MONGO_UNREACHABLE; } - int getCompletedIndexCount() const { + int getCompletedIndexCount() const override { MONGO_UNREACHABLE; } - BSONObj getIndexSpec(StringData indexName) const { + BSONObj getIndexSpec(StringData indexName) const override { MONGO_UNREACHABLE; } - void getAllIndexes(std::vector* names) const { + void getAllIndexes(std::vector* names) const override { MONGO_UNREACHABLE; } - void getReadyIndexes(std::vector* names) const { + void getReadyIndexes(std::vector* names) const override { MONGO_UNREACHABLE; } - bool isIndexPresent(StringData indexName) const { + bool isIndexPresent(StringData indexName) const override { MONGO_UNREACHABLE; } - bool isIndexReady(StringData indexName) const { + bool isIndexReady(StringData indexName) const override { MONGO_UNREACHABLE; } void replaceMetadata(OperationContext* opCtx, - std::shared_ptr md) { + std::shared_ptr md) override { MONGO_UNREACHABLE; } - bool isMetadataEqual(const BSONObj& otherMetadata) const { + bool isMetadataEqual(const BSONObj& otherMetadata) const override { MONGO_UNREACHABLE; } - void sanitizeCollectionOptions(OperationContext* opCtx) { + void sanitizeCollectionOptions(OperationContext* opCtx) override { MONGO_UNREACHABLE; } - bool needsCappedLock() const { + bool needsCappedLock() const override { MONGO_UNREACHABLE; } - bool isCappedAndNeedsDelete(OperationContext* opCtx) const { + bool isCappedAndNeedsDelete(OperationContext* opCtx) const override { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h index 881a9021d3a..96aac98ea4d 100644 --- a/src/mongo/db/catalog/database.h +++ b/src/mongo/db/catalog/database.h @@ -78,7 +78,7 @@ public: Database() = default; // must call close first - virtual ~Database() = default; + ~Database() override = default; inline Database(Database&&) = delete; inline Database& operator=(Database&&) = delete; diff --git a/src/mongo/db/catalog/index_catalog_mock.h b/src/mongo/db/catalog/index_catalog_mock.h index 909c85bac7b..05f9f9d2468 100644 --- a/src/mongo/db/catalog/index_catalog_mock.h +++ b/src/mongo/db/catalog/index_catalog_mock.h @@ -45,7 +45,7 @@ public: return std::make_unique(*this); } - void init(OperationContext*, Collection*, bool = false) { + void init(OperationContext*, Collection*, bool = false) override { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/catalog/virtual_collection_impl.h b/src/mongo/db/catalog/virtual_collection_impl.h index 3453c824b0b..206fd89d5be 100644 --- a/src/mongo/db/catalog/virtual_collection_impl.h +++ b/src/mongo/db/catalog/virtual_collection_impl.h @@ -91,7 +91,7 @@ public: VirtualCollectionImpl(const VirtualCollectionImpl&) = default; - ~VirtualCollectionImpl() = default; + ~VirtualCollectionImpl() override = default; const VirtualCollectionOptions& getVirtualCollectionOptions() const { return _shared->_recordStore->getOptions(); @@ -512,7 +512,7 @@ public: return _shared->_recordStore->dataSize(opCtx) == 0LL; } - inline int averageObjectSize(OperationContext* opCtx) const { + inline int averageObjectSize(OperationContext* opCtx) const override { return 0; } diff --git a/src/mongo/db/client_out_of_line_executor.cpp b/src/mongo/db/client_out_of_line_executor.cpp index d1c60daabfc..81f8678bb23 100644 --- a/src/mongo/db/client_out_of_line_executor.cpp +++ b/src/mongo/db/client_out_of_line_executor.cpp @@ -147,12 +147,12 @@ namespace { * before the client decorations are destroyed. See SERVER-48901 for more details. */ class ClientOutOfLineExecutorClientObserver final : public ServiceContext::ClientObserver { - void onCreateClient(Client*) {} - void onDestroyClient(Client* client) { + void onCreateClient(Client*) override {} + void onDestroyClient(Client* client) override { ClientOutOfLineExecutor::get(client)->shutdown(); } - void onCreateOperationContext(OperationContext*) {} - void onDestroyOperationContext(OperationContext*) {} + void onCreateOperationContext(OperationContext*) override {} + void onDestroyOperationContext(OperationContext*) override {} }; ServiceContext::ConstructorActionRegisterer diff --git a/src/mongo/db/client_out_of_line_executor.h b/src/mongo/db/client_out_of_line_executor.h index b0a9e9874c1..11d8cd6e9b9 100644 --- a/src/mongo/db/client_out_of_line_executor.h +++ b/src/mongo/db/client_out_of_line_executor.h @@ -51,7 +51,7 @@ class ClientOutOfLineExecutor final : public OutOfLineExecutor { public: ClientOutOfLineExecutor() noexcept; - ~ClientOutOfLineExecutor() noexcept; + ~ClientOutOfLineExecutor() noexcept override; static ClientOutOfLineExecutor* get(const Client*) noexcept; diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 2ba89df9406..5bba6b506e9 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -420,11 +420,11 @@ namespace { */ class ClientCursorMonitor : public BackgroundJob { public: - std::string name() const { + std::string name() const override { return "ClientCursorMonitor"; } - void run() { + void run() override { ThreadClient tc("clientcursormon", getGlobalServiceContext()->getService(ClusterRole::ShardServer)); diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index 73158b23bee..f189fb55626 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -390,7 +390,7 @@ private: * Cursors must be unpinned and deregistered from the CursorManager before they can be * destroyed. */ - ~ClientCursor(); + ~ClientCursor() override; /** * Disposes this ClientCursor's PlanExecutor. Must be called before deleting a ClientCursor to diff --git a/src/mongo/db/cluster_transaction_api.h b/src/mongo/db/cluster_transaction_api.h index f758cd5467a..6958cb83bbe 100644 --- a/src/mongo/db/cluster_transaction_api.h +++ b/src/mongo/db/cluster_transaction_api.h @@ -52,7 +52,7 @@ public: Future handleRequest(OperationContext* opCtx, const Message& request) const override; - bool runsClusterOperations() const { + bool runsClusterOperations() const override { // Cluster commands will attach appropriate shard versions for any targeted namespaces, so // it is safe to use this client within a caller's operation with shard versions. return true; diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index 5bc863883ec..a302d9c3019 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -163,7 +163,7 @@ public: AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return true; } diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp index 4f14c206e63..d995b92868e 100644 --- a/src/mongo/db/commands/count_cmd.cpp +++ b/src/mongo/db/commands/count_cmd.cpp @@ -114,7 +114,7 @@ class CmdCount : public BasicCommand { public: CmdCount() : BasicCommand("count") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/db/commands/cpuload.cpp b/src/mongo/db/commands/cpuload.cpp index 43938bc9815..05066041598 100644 --- a/src/mongo/db/commands/cpuload.cpp +++ b/src/mongo/db/commands/cpuload.cpp @@ -105,7 +105,7 @@ public: result.append("durationSeconds", durationCount(micros)); return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } }; diff --git a/src/mongo/db/commands/create_indexes_cmd.cpp b/src/mongo/db/commands/create_indexes_cmd.cpp index 27443d97909..572ca9d1e8b 100644 --- a/src/mongo/db/commands/create_indexes_cmd.cpp +++ b/src/mongo/db/commands/create_indexes_cmd.cpp @@ -779,7 +779,7 @@ public: return request().getNamespace(); } - void doCheckAuthorization(OperationContext* opCtx) const { + void doCheckAuthorization(OperationContext* opCtx) const override { Privilege p(CommandHelpers::resourcePatternForNamespace(ns()), ActionType::createIndex); uassert(ErrorCodes::Unauthorized, "Unauthorized", diff --git a/src/mongo/db/commands/current_op.cpp b/src/mongo/db/commands/current_op.cpp index 038e564cf1a..75008c2b522 100644 --- a/src/mongo/db/commands/current_op.cpp +++ b/src/mongo/db/commands/current_op.cpp @@ -81,8 +81,8 @@ public: return true; } - virtual StatusWith runAggregation( - OperationContext* opCtx, AggregateCommandRequest& request) const final { + StatusWith runAggregation(OperationContext* opCtx, + AggregateCommandRequest& request) const final { auto aggCmdObj = aggregation_request_helper::serializeToCommandObj(request); rpc::OpMsgReplyBuilder replyBuilder; @@ -113,7 +113,7 @@ public: SerializationContext::stateCommandReply(request.getSerializationContext())); } - virtual void appendToResponse(BSONObjBuilder* result) const final { + void appendToResponse(BSONObjBuilder* result) const final { if (lockedForWriting()) { result->append("fsyncLock", true); result->append("info", diff --git a/src/mongo/db/commands/current_op_common.h b/src/mongo/db/commands/current_op_common.h index bbd0df639f1..9c6abb14aa4 100644 --- a/src/mongo/db/commands/current_op_common.h +++ b/src/mongo/db/commands/current_op_common.h @@ -48,7 +48,7 @@ class CurrentOpCommandBase : public BasicCommand { public: CurrentOpCommandBase() : BasicCommand("currentOp") {} - virtual ~CurrentOpCommandBase() {} + ~CurrentOpCommandBase() override {} bool supportsWriteConcern(const BSONObj& cmd) const final { return false; diff --git a/src/mongo/db/commands/dbcheck_command.cpp b/src/mongo/db/commands/dbcheck_command.cpp index 6e6668151f3..7430284ac66 100644 --- a/src/mongo/db/commands/dbcheck_command.cpp +++ b/src/mongo/db/commands/dbcheck_command.cpp @@ -1886,11 +1886,11 @@ public: return false; } - virtual bool adminOnly() const { + bool adminOnly() const override { return false; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -1918,10 +1918,10 @@ public: return isAuthorized ? Status::OK() : Status(ErrorCodes::Unauthorized, "Unauthorized"); } - virtual bool run(OperationContext* opCtx, - const DatabaseName& dbName, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName& dbName, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { auto job = getRun(opCtx, dbName, cmdObj); (new DbCheckJob(opCtx->getService(), std::move(job)))->go(); return true; diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index 1491061e527..f547646a7a7 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -526,7 +526,7 @@ public: using Request = CollMod; using Reply = CollModReply; - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } @@ -759,7 +759,7 @@ class BuildInfoExecutor final : public AsyncRequestExecutor { public: BuildInfoExecutor() : AsyncRequestExecutor("BuildInfoExecutor") {} - Status handleRequest(std::shared_ptr rec) { + Status handleRequest(std::shared_ptr rec) override { // Critical to observability and diagnosability, categorize as immediate priority. ScopedAdmissionPriority skipAdmissionControl(rec->getOpCtx(), AdmissionContext::Priority::kExempt); diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index 3d1d4e6e269..a3757aa22d8 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -131,7 +131,7 @@ class DBHashCmd : public BasicCommand { public: DBHashCmd() : BasicCommand("dbHash", "dbhash") {} - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index 1cc3a9dad0c..a8cb9b3f08d 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -540,7 +540,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName& dbName, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { tasserted(8687400, "distinct command should have not invoked this method"); return true; } diff --git a/src/mongo/db/commands/drop_indexes_cmd.cpp b/src/mongo/db/commands/drop_indexes_cmd.cpp index 2adbdc5a2d0..1986d576f24 100644 --- a/src/mongo/db/commands/drop_indexes_cmd.cpp +++ b/src/mongo/db/commands/drop_indexes_cmd.cpp @@ -156,7 +156,7 @@ public: // rather than with a NotWritablePrimary error. return AllowedOnSecondary::kAlways; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } std::string help() const override { diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp index d48fe6f844a..734bf6184b6 100644 --- a/src/mongo/db/commands/explain_cmd.cpp +++ b/src/mongo/db/commands/explain_cmd.cpp @@ -79,7 +79,7 @@ class CmdExplain final : public Command { public: CmdExplain() : Command("explain") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 73ea6a08b0c..93845d6c785 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -247,7 +247,7 @@ class FindCmd final : public Command { public: FindCmd() : Command("find") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } @@ -465,7 +465,7 @@ public: * --Save state for getMore, transferring ownership of the executor to a ClientCursor. * --Generate response to send to the client. */ - void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* replyBuilder) { + void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* replyBuilder) override { CommandHelpers::handleMarkKillOnClientDisconnect(opCtx); const BSONObj& cmdObj = _request.body; diff --git a/src/mongo/db/commands/fle_compact_test.cpp b/src/mongo/db/commands/fle_compact_test.cpp index e24f28a29bc..2132af163ca 100644 --- a/src/mongo/db/commands/fle_compact_test.cpp +++ b/src/mongo/db/commands/fle_compact_test.cpp @@ -123,7 +123,7 @@ public: KeyMaterial getKey(const UUID& uuid) override; BSONObj getEncryptedKey(const UUID& uuid) override; - SymmetricKey& getKMSLocalKey() { + SymmetricKey& getKMSLocalKey() override { return _localKey; } @@ -205,8 +205,8 @@ public: }; protected: - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void createCollection(const NamespaceString& ns); diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 53ce1d81f5a..876b29445d9 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -359,7 +359,7 @@ class GetMoreCmd final : public Command { public: GetMoreCmd() : Command("getMore") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp index 866fc611881..fdecbdfd7f5 100644 --- a/src/mongo/db/commands/isself.cpp +++ b/src/mongo/db/commands/isself.cpp @@ -81,7 +81,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { // Critical to observability and diagnosability, annotate as immediate priority. ScopedAdmissionPriority skipAdmissionControl(opCtx, AdmissionContext::Priority::kExempt); result.append("id", repl::instanceId); diff --git a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp index d39039f9264..d975aeaaa63 100644 --- a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp @@ -97,10 +97,10 @@ public: return false; } - virtual bool run(OperationContext* opCtx, - const DatabaseName& dbName, - const BSONObj& cmdObj, - BSONObjBuilder& result) override { + bool run(OperationContext* opCtx, + const DatabaseName& dbName, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { IDLParserContext ctx("KillAllSessionsByPatternCmd"); auto ksc = KillAllSessionsByPatternCmd::parse(ctx, cmdObj); diff --git a/src/mongo/db/commands/kill_all_sessions_command.cpp b/src/mongo/db/commands/kill_all_sessions_command.cpp index ece2df253ad..73300368c35 100644 --- a/src/mongo/db/commands/kill_all_sessions_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_command.cpp @@ -94,10 +94,10 @@ public: return false; } - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) override { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { IDLParserContext ctx("KillAllSessionsCmd"); auto ksc = KillAllSessionsCmd::parse(ctx, cmdObj); diff --git a/src/mongo/db/commands/kill_op_cmd_base.h b/src/mongo/db/commands/kill_op_cmd_base.h index 11fca4263f1..190e8c1b526 100644 --- a/src/mongo/db/commands/kill_op_cmd_base.h +++ b/src/mongo/db/commands/kill_op_cmd_base.h @@ -47,7 +47,7 @@ class KillOpCmdBase : public BasicCommand { public: KillOpCmdBase() : BasicCommand("killOp") {} - virtual ~KillOpCmdBase() = default; + ~KillOpCmdBase() override = default; bool supportsWriteConcern(const BSONObj& cmd) const override { return false; diff --git a/src/mongo/db/commands/kill_sessions_command.cpp b/src/mongo/db/commands/kill_sessions_command.cpp index 2512a4ba273..a6192e4a975 100644 --- a/src/mongo/db/commands/kill_sessions_command.cpp +++ b/src/mongo/db/commands/kill_sessions_command.cpp @@ -119,10 +119,10 @@ public: return false; } - virtual bool run(OperationContext* opCtx, - const DatabaseName& dbName, - const BSONObj& cmdObj, - BSONObjBuilder& result) override { + bool run(OperationContext* opCtx, + const DatabaseName& dbName, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { IDLParserContext ctx("KillSessionsCmd"); auto ksc = KillSessionsCmdFromClient::parse(ctx, cmdObj); diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index b5459b9003a..2762f0b28e2 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -329,7 +329,7 @@ public: class Invocation final : public InvocationBaseGen { public: using InvocationBaseGen::InvocationBaseGen; - virtual bool supportsWriteConcern() const final { + bool supportsWriteConcern() const final { return false; } diff --git a/src/mongo/db/commands/map_reduce_command_base.h b/src/mongo/db/commands/map_reduce_command_base.h index 17492e6d770..af0011d7dc9 100644 --- a/src/mongo/db/commands/map_reduce_command_base.h +++ b/src/mongo/db/commands/map_reduce_command_base.h @@ -51,9 +51,9 @@ public: * would need to be done confirm support for both command and aggregation stages as is done for * the aggregate command. */ - virtual ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj, - repl::ReadConcernLevel level, - bool isImplicitDefault) const { + ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj, + repl::ReadConcernLevel level, + bool isImplicitDefault) const override { static const Status kReadConcernNotSupported{ErrorCodes::InvalidOptions, "read concern not supported"}; static const Status kDefaultReadConcernNotPermitted{ErrorCodes::InvalidOptions, @@ -68,7 +68,7 @@ public: return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return map_reduce_common::mrSupportsWriteConcern(cmd); } diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index 30c35e135dd..67bbec9490b 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -116,11 +116,11 @@ public: return AllowedOnSecondary::kNever; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return true; } @@ -140,10 +140,10 @@ public: return Status::OK(); } - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { hangInAppendOplogNote.pauseWhileSet(); auto replCoord = repl::ReplicationCoordinator::get(opCtx); diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index c2a3d1b77e2..dc1f7d82efb 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -83,7 +83,7 @@ class PipelineCommand final : public Command { public: PipelineCommand() : Command("aggregate") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } @@ -335,7 +335,7 @@ public: bool maintenanceOk() const override { return false; } - ReadWriteType getReadWriteType() const { + ReadWriteType getReadWriteType() const override { return ReadWriteType::kRead; } diff --git a/src/mongo/db/commands/profile_common.h b/src/mongo/db/commands/profile_common.h index 84c115f75e5..6ff8341ba42 100644 --- a/src/mongo/db/commands/profile_common.h +++ b/src/mongo/db/commands/profile_common.h @@ -57,7 +57,7 @@ class ProfileCmdRequest; class ProfileCmdBase : public BasicCommand { public: ProfileCmdBase() : BasicCommand("profile") {} - virtual ~ProfileCmdBase() {} + ~ProfileCmdBase() override {} AllowedOnSecondary secondaryAllowed(ServiceContext*) const final { return AllowedOnSecondary::kAlways; diff --git a/src/mongo/db/commands/rename_collection_cmd.cpp b/src/mongo/db/commands/rename_collection_cmd.cpp index 6400553f94e..56a97de26a5 100644 --- a/src/mongo/db/commands/rename_collection_cmd.cpp +++ b/src/mongo/db/commands/rename_collection_cmd.cpp @@ -64,7 +64,7 @@ class CmdRenameCollection final : public TypedCommand { public: using Request = RenameCollectionCommand; - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { diff --git a/src/mongo/db/commands/resize_oplog.cpp b/src/mongo/db/commands/resize_oplog.cpp index f5a9b82b1e3..169a2b13e2f 100644 --- a/src/mongo/db/commands/resize_oplog.cpp +++ b/src/mongo/db/commands/resize_oplog.cpp @@ -78,7 +78,7 @@ public: return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -101,7 +101,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& jsobj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { AutoGetCollection coll(opCtx, NamespaceString::kRsOplogNamespace, MODE_X); uassert(ErrorCodes::NamespaceNotFound, "oplog does not exist", coll); uassert(ErrorCodes::IllegalOperation, "oplog isn't capped", coll->isCapped()); diff --git a/src/mongo/db/commands/set_cluster_parameter_invocation_test.cpp b/src/mongo/db/commands/set_cluster_parameter_invocation_test.cpp index 3cbfca7a7eb..031ce02dbea 100644 --- a/src/mongo/db/commands/set_cluster_parameter_invocation_test.cpp +++ b/src/mongo/db/commands/set_cluster_parameter_invocation_test.cpp @@ -65,7 +65,7 @@ class MockParameterService : public ServerParameterService { public: MockParameterService(std::function get) : _getMock(get){}; - ServerParameter* get(StringData parameterName) { + ServerParameter* get(StringData parameterName) override { return _getMock(parameterName); } @@ -83,23 +83,24 @@ public: void append(OperationContext* opCtx, BSONObjBuilder* b, StringData name, - const boost::optional&) {} + const boost::optional&) override {} void appendSupportingRoundtrip(OperationContext* opCtx, BSONObjBuilder* b, StringData name, - const boost::optional&) {} + const boost::optional&) override {} - Status set(const BSONElement& newValueElement, const boost::optional& tenantId) { + Status set(const BSONElement& newValueElement, + const boost::optional& tenantId) override { return Status(ErrorCodes::BadValue, "Should not call set() in this test"); } - Status setFromString(StringData str, const boost::optional& tenantId) { + Status setFromString(StringData str, const boost::optional& tenantId) override { return Status(ErrorCodes::BadValue, "Should not call setFromString() in this test"); } Status validate(const BSONElement& newValueElement, - const boost::optional& tenantId) const { + const boost::optional& tenantId) const override { return validateImpl(newValueElement); } diff --git a/src/mongo/db/commands/shutdown.h b/src/mongo/db/commands/shutdown.h index 8b11ea64a3e..de6a6f8c13d 100644 --- a/src/mongo/db/commands/shutdown.h +++ b/src/mongo/db/commands/shutdown.h @@ -115,7 +115,7 @@ public: bool requiresAuth() const override { return true; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } bool localHostOnlyIfNoAuth() const override { diff --git a/src/mongo/db/commands/sleep_command.cpp b/src/mongo/db/commands/sleep_command.cpp index 12eb3adc14e..dfeecb2dcaf 100644 --- a/src/mongo/db/commands/sleep_command.cpp +++ b/src/mongo/db/commands/sleep_command.cpp @@ -58,11 +58,11 @@ namespace mongo { /* For diagnostic / testing purposes. Enabled via command line. See docs/test_commands.md. */ class CmdSleep : public BasicCommand { public: - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } @@ -151,7 +151,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { LOGV2(20504, "Test-only command 'sleep' invoked"); long long msToSleep = 0; diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp index bb3c518e5b3..fc079621865 100644 --- a/src/mongo/db/commands/snapshot_management.cpp +++ b/src/mongo/db/commands/snapshot_management.cpp @@ -57,10 +57,10 @@ public: AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } @@ -78,7 +78,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { auto snapshotManager = getGlobalServiceContext()->getStorageEngine()->getSnapshotManager(); if (!snapshotManager) { uasserted(ErrorCodes::CommandNotSupported, ""); @@ -102,10 +102,10 @@ public: AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kAlways; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } @@ -123,7 +123,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { auto snapshotManager = getGlobalServiceContext()->getStorageEngine()->getSnapshotManager(); if (!snapshotManager) { uasserted(ErrorCodes::CommandNotSupported, ""); diff --git a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp index 3ee196fd11f..6c62013f058 100644 --- a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp @@ -191,12 +191,12 @@ public: bool supportsWriteConcern() const override { return false; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; - std::string help() const { + std::string help() const override { return "Start migrating databases whose names match the specified prefix to the specified " "replica set."; } @@ -271,7 +271,7 @@ public: bool supportsWriteConcern() const override { return false; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; @@ -361,7 +361,7 @@ public: bool supportsWriteConcern() const override { return false; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; diff --git a/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp b/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp index bd3e6dd619c..2db52b92881 100644 --- a/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp @@ -202,12 +202,12 @@ public: bool supportsWriteConcern() const override { return false; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; - std::string help() const { + std::string help() const override { return "Internal replica set command; instructs the recipient to sync data as part of a " "tenant migration."; } @@ -419,12 +419,12 @@ public: return false; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; - std::string help() const { + std::string help() const override { return "Interrupts tenant migration data sync and marks that the recipient's durable state " "machine may be garbage collected."; } diff --git a/src/mongo/db/commands/test_api_version_2_commands.cpp b/src/mongo/db/commands/test_api_version_2_commands.cpp index 96a49db2abe..94b5d0baa75 100644 --- a/src/mongo/db/commands/test_api_version_2_commands.cpp +++ b/src/mongo/db/commands/test_api_version_2_commands.cpp @@ -50,7 +50,7 @@ class TestVersion2Cmd : public BasicCommand { public: TestVersion2Cmd() : BasicCommand("testVersion2") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersion2; } @@ -82,7 +82,7 @@ class TestVersions1And2Cmd : public BasicCommand { public: TestVersions1And2Cmd() : BasicCommand("testVersions1And2") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersion1And2; } @@ -114,11 +114,11 @@ class TestDeprecationInVersion2Cmd : public BasicCommand { public: TestDeprecationInVersion2Cmd() : BasicCommand("testDeprecationInVersion2") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersion1And2; } - const std::set& deprecatedApiVersions() const { + const std::set& deprecatedApiVersions() const override { return kApiVersion2; } @@ -150,7 +150,7 @@ class TestRemovalCmd : public BasicCommand { public: TestRemovalCmd() : BasicCommand("testRemoval") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/db/commands/test_deprecation_command.cpp b/src/mongo/db/commands/test_deprecation_command.cpp index b84f4d7a4cb..edbfedbe30b 100644 --- a/src/mongo/db/commands/test_deprecation_command.cpp +++ b/src/mongo/db/commands/test_deprecation_command.cpp @@ -51,11 +51,11 @@ class TestDeprecationCmd : public BasicCommand { public: TestDeprecationCmd() : BasicCommand("testDeprecation") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } - const std::set& deprecatedApiVersions() const { + const std::set& deprecatedApiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 039a8b8286e..c0407e75eb6 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -199,7 +199,7 @@ public: << "Cannot specify both {full: true, background: true}."; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -234,7 +234,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName& dbName, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { if (MONGO_unlikely(validateCmdCollectionNotValid.shouldFail())) { result.appendBool("valid", false); return true; diff --git a/src/mongo/db/commands/validate_db_metadata_cmd.cpp b/src/mongo/db/commands/validate_db_metadata_cmd.cpp index 0f77c06fd5e..a90f26ad996 100644 --- a/src/mongo/db/commands/validate_db_metadata_cmd.cpp +++ b/src/mongo/db/commands/validate_db_metadata_cmd.cpp @@ -100,7 +100,7 @@ public: return AllowedOnSecondary::kAlways; } - bool maintenanceOk() const { + bool maintenanceOk() const override { return false; } diff --git a/src/mongo/db/commands/whats_my_uri_cmd.cpp b/src/mongo/db/commands/whats_my_uri_cmd.cpp index ead610e0f87..12065e0d9fc 100644 --- a/src/mongo/db/commands/whats_my_uri_cmd.cpp +++ b/src/mongo/db/commands/whats_my_uri_cmd.cpp @@ -56,7 +56,7 @@ public: return AllowedOnSecondary::kAlways; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } diff --git a/src/mongo/db/concurrency/resource_catalog_test.cpp b/src/mongo/db/concurrency/resource_catalog_test.cpp index 991c81acb9f..d63e301dc9f 100644 --- a/src/mongo/db/concurrency/resource_catalog_test.cpp +++ b/src/mongo/db/concurrency/resource_catalog_test.cpp @@ -45,7 +45,7 @@ namespace { class ResourceCatalogTest : public unittest::Test { public: - void setUp() { + void setUp() override { ASSERT_EQ(firstResourceId, secondResourceId); ASSERT_NE(firstResourceId, thirdResourceId); } diff --git a/src/mongo/db/cst/parser_gen.hpp b/src/mongo/db/cst/parser_gen.hpp index d37ffd22eaa..52daaa562b8 100644 --- a/src/mongo/db/cst/parser_gen.hpp +++ b/src/mongo/db/cst/parser_gen.hpp @@ -728,7 +728,7 @@ public: syntax_error(const syntax_error& s) : std::runtime_error(s.what()), location(s.location) {} - ~syntax_error() YY_NOEXCEPT YY_NOTHROW; + ~syntax_error() YY_NOEXCEPT override YY_NOTHROW; location_type location; }; diff --git a/src/mongo/db/default_baton.h b/src/mongo/db/default_baton.h index 8816d317bbb..edae6f08802 100644 --- a/src/mongo/db/default_baton.h +++ b/src/mongo/db/default_baton.h @@ -52,7 +52,7 @@ class DefaultBaton : public Baton { public: explicit DefaultBaton(OperationContext* opCtx); - ~DefaultBaton(); + ~DefaultBaton() override; void schedule(Task func) noexcept override; diff --git a/src/mongo/db/exec/add_fields_projection_executor.h b/src/mongo/db/exec/add_fields_projection_executor.h index aa73f90912b..5c423d3b07b 100644 --- a/src/mongo/db/exec/add_fields_projection_executor.h +++ b/src/mongo/db/exec/add_fields_projection_executor.h @@ -162,7 +162,7 @@ public: */ Document applyProjection(const Document& inputDoc) const final; - boost::optional> extractExhaustivePaths() const { + boost::optional> extractExhaustivePaths() const override { return boost::none; } diff --git a/src/mongo/db/exec/batched_delete_stage.h b/src/mongo/db/exec/batched_delete_stage.h index 899d5d5f18b..395c10e9230 100644 --- a/src/mongo/db/exec/batched_delete_stage.h +++ b/src/mongo/db/exec/batched_delete_stage.h @@ -123,7 +123,7 @@ public: WorkingSet* ws, CollectionAcquisition collection, PlanStage* child); - ~BatchedDeleteStage(); + ~BatchedDeleteStage() override; // Returns true when no more work can be done (there are no more deletes to commit). bool isEOF() final; @@ -132,7 +132,7 @@ public: const SpecificStats* getSpecificStats() const final; - StageState doWork(WorkingSetID* out); + StageState doWork(WorkingSetID* out) override; StageType stageType() const final { return STAGE_BATCHED_DELETE; diff --git a/src/mongo/db/exec/count.h b/src/mongo/db/exec/count.h index 01e28a232d2..b7840aca79b 100644 --- a/src/mongo/db/exec/count.h +++ b/src/mongo/db/exec/count.h @@ -66,7 +66,7 @@ public: return STAGE_COUNT; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; const SpecificStats* getSpecificStats() const final; diff --git a/src/mongo/db/exec/delete_stage.h b/src/mongo/db/exec/delete_stage.h index d70c8153c5c..e643d1caf1e 100644 --- a/src/mongo/db/exec/delete_stage.h +++ b/src/mongo/db/exec/delete_stage.h @@ -125,16 +125,16 @@ public: CollectionAcquisition collection, PlanStage* child); - bool isEOF(); - StageState doWork(WorkingSetID* out); + bool isEOF() override; + StageState doWork(WorkingSetID* out) override; - StageType stageType() const { + StageType stageType() const override { return STAGE_DELETE; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; - const SpecificStats* getSpecificStats() const; + const SpecificStats* getSpecificStats() const override; protected: void doSaveStateRequiresCollection() final { diff --git a/src/mongo/db/exec/document_value/document_internal.h b/src/mongo/db/exec/document_value/document_internal.h index 66399a788ee..a17b7ca68bf 100644 --- a/src/mongo/db/exec/document_value/document_internal.h +++ b/src/mongo/db/exec/document_value/document_internal.h @@ -373,7 +373,7 @@ public: _bsonHasMetadata(bsonHasMetadata), _modified(modified) {} - ~DocumentStorage(); + ~DocumentStorage() override; void reset(const BSONObj& bson, bool bsonHasMetadata); diff --git a/src/mongo/db/exec/document_value/document_value_test.cpp b/src/mongo/db/exec/document_value/document_value_test.cpp index 80157888c2c..045d129a818 100644 --- a/src/mongo/db/exec/document_value/document_value_test.cpp +++ b/src/mongo/db/exec/document_value/document_value_test.cpp @@ -1617,118 +1617,118 @@ protected: }; class ToBoolTrue : public ToBoolBase { - bool expected() { + bool expected() override { return true; } }; class ToBoolFalse : public ToBoolBase { - bool expected() { + bool expected() override { return false; } }; /** Coerce 0 to bool. */ class ZeroIntToBool : public ToBoolFalse { - Value value() { + Value value() override { return Value(0); } }; /** Coerce -1 to bool. */ class NonZeroIntToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(-1); } }; /** Coerce 0LL to bool. */ class ZeroLongToBool : public ToBoolFalse { - Value value() { + Value value() override { return Value(0LL); } }; /** Coerce 5LL to bool. */ class NonZeroLongToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(5LL); } }; /** Coerce 0.0 to bool. */ class ZeroDoubleToBool : public ToBoolFalse { - Value value() { + Value value() override { return Value(0); } }; /** Coerce -1.3 to bool. */ class NonZeroDoubleToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(-1.3); } }; /** Coerce "" to bool. */ class StringToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(StringData()); } }; /** Coerce {} to bool. */ class ObjectToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(mongo::Document()); } }; /** Coerce [] to bool. */ class ArrayToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(std::vector()); } }; /** Coerce Date(0) to bool. */ class DateToBool : public ToBoolTrue { - Value value() { + Value value() override { return Value(Date_t{}); } }; /** Coerce js literal regex to bool. */ class RegexToBool : public ToBoolTrue { - Value value() { + Value value() override { return fromBson(fromjson("{''://}")); } }; /** Coerce true to bool. */ class TrueToBool : public ToBoolTrue { - Value value() { + Value value() override { return fromBson(BSON("" << true)); } }; /** Coerce false to bool. */ class FalseToBool : public ToBoolFalse { - Value value() { + Value value() override { return fromBson(BSON("" << false)); } }; /** Coerce null to bool. */ class NullToBool : public ToBoolFalse { - Value value() { + Value value() override { return Value(BSONNULL); } }; /** Coerce undefined to bool. */ class UndefinedToBool : public ToBoolFalse { - Value value() { + Value value() override { return Value(BSONUndefined); } }; @@ -1755,50 +1755,50 @@ protected: /** Coerce -5 to int. */ class IntToInt : public ToIntBase { - Value value() { + Value value() override { return Value(-5); } - int expected() { + int expected() override { return -5; } }; /** Coerce long to int. */ class LongToInt : public ToIntBase { - Value value() { + Value value() override { return Value(0xff00000007LL); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce 9.8 to int. */ class DoubleToInt : public ToIntBase { - Value value() { + Value value() override { return Value(9.8); } - int expected() { + int expected() override { return 9; } }; /** Coerce null to int. */ class NullToInt : public ToIntBase { - Value value() { + Value value() override { return Value(BSONNULL); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce undefined to int. */ class UndefinedToInt : public ToIntBase { - Value value() { + Value value() override { return Value(BSONUndefined); } - bool asserts() { + bool asserts() override { return true; } }; @@ -1813,40 +1813,40 @@ public: /** Coerce maxInt to int */ class MaxIntToInt : public ToIntBase { - Value value() { + Value value() override { return Value((double)std::numeric_limits::max()); } - int expected() { + int expected() override { return std::numeric_limits::max(); } }; /** Coerce minInt to int */ class MinIntToInt : public ToIntBase { - Value value() { + Value value() override { return Value((double)std::numeric_limits::min()); } - int expected() { + int expected() override { return std::numeric_limits::min(); } }; /** Coerce maxInt + 1 to int */ class TooLargeToInt : public ToIntBase { - Value value() { + Value value() override { return Value((double)std::numeric_limits::max() + 1); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce minInt - 1 to int */ class TooLargeNegativeToInt : public ToIntBase { - Value value() { + Value value() override { return Value((double)std::numeric_limits::min() - 1); } - bool asserts() { + bool asserts() override { return true; } }; @@ -1873,101 +1873,101 @@ protected: /** Coerce -5 to long. */ class IntToLong : public ToLongBase { - Value value() { + Value value() override { return Value(-5); } - long long expected() { + long long expected() override { return -5; } }; /** Coerce long to long. */ class LongToLong : public ToLongBase { - Value value() { + Value value() override { return Value(0xff00000007LL); } - long long expected() { + long long expected() override { return 0xff00000007LL; } }; /** Coerce 9.8 to long. */ class DoubleToLong : public ToLongBase { - Value value() { + Value value() override { return Value(9.8); } - long long expected() { + long long expected() override { return 9; } }; /** Coerce infinity to long. */ class InfToLong : public ToLongBase { - Value value() { + Value value() override { return Value(std::numeric_limits::infinity()); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce negative infinity to long. **/ class NegInfToLong : public ToLongBase { - Value value() { + Value value() override { return Value(std::numeric_limits::infinity() * -1); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce large to long. **/ class InvalidLargeToLong : public ToLongBase { - Value value() { + Value value() override { return Value(pow(2, 63)); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce lowest double to long. **/ class LowestDoubleToLong : public ToLongBase { - Value value() { + Value value() override { return Value(static_cast(std::numeric_limits::lowest())); } - long long expected() { + long long expected() override { return std::numeric_limits::lowest(); } }; /** Coerce 'towards infinity' to long **/ class TowardsInfinityToLong : public ToLongBase { - Value value() { + Value value() override { return Value(static_cast(std::nextafter(std::numeric_limits::lowest(), std::numeric_limits::lowest()))); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce null to long. */ class NullToLong : public ToLongBase { - Value value() { + Value value() override { return Value(BSONNULL); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce undefined to long. */ class UndefinedToLong : public ToLongBase { - Value value() { + Value value() override { return Value(BSONUndefined); } - bool asserts() { + bool asserts() override { return true; } }; @@ -2002,51 +2002,51 @@ protected: /** Coerce -5 to double. */ class IntToDouble : public ToDoubleBase { - Value value() { + Value value() override { return Value(-5); } - double expected() { + double expected() override { return -5; } }; /** Coerce long to double. */ class LongToDouble : public ToDoubleBase { - Value value() { + Value value() override { // A long that cannot be exactly represented as a double. return Value(static_cast(0x8fffffffffffffffLL)); } - double expected() { + double expected() override { return static_cast(0x8fffffffffffffffLL); } }; /** Coerce double to double. */ class DoubleToDouble : public ToDoubleBase { - Value value() { + Value value() override { return Value(9.8); } - double expected() { + double expected() override { return 9.8; } }; /** Coerce null to double. */ class NullToDouble : public ToDoubleBase { - Value value() { + Value value() override { return Value(BSONNULL); } - bool asserts() { + bool asserts() override { return true; } }; /** Coerce undefined to double. */ class UndefinedToDouble : public ToDoubleBase { - Value value() { + Value value() override { return Value(BSONUndefined); } - bool asserts() { + bool asserts() override { return true; } }; @@ -2073,10 +2073,10 @@ protected: /** Coerce date to date. */ class DateToDate : public ToDateBase { - Value value() { + Value value() override { return Value(Date_t::fromMillisSinceEpoch(888)); } - long long expected() { + long long expected() override { return 888; } }; @@ -2086,10 +2086,10 @@ class DateToDate : public ToDateBase { * is different from BSON behavior of interpreting all bytes as a date. */ class TimestampToDate : public ToDateBase { - Value value() { + Value value() override { return Value(Timestamp(777, 666)); } - long long expected() { + long long expected() override { return 777 * 1000; } }; @@ -2118,74 +2118,74 @@ protected: /** Coerce -0.2 to string. */ class DoubleToString : public ToStringBase { - Value value() { + Value value() override { return Value(-0.2); } - std::string expected() { + std::string expected() override { return "-0.2"; } }; /** Coerce -4 to string. */ class IntToString : public ToStringBase { - Value value() { + Value value() override { return Value(-4); } - std::string expected() { + std::string expected() override { return "-4"; } }; /** Coerce 10000LL to string. */ class LongToString : public ToStringBase { - Value value() { + Value value() override { return Value(10000LL); } - std::string expected() { + std::string expected() override { return "10000"; } }; /** Coerce string to string. */ class StringToString : public ToStringBase { - Value value() { + Value value() override { return Value("fO_o"_sd); } - std::string expected() { + std::string expected() override { return "fO_o"; } }; /** Coerce timestamp to string. */ class TimestampToString : public ToStringBase { - Value value() { + Value value() override { return Value(Timestamp(1, 2)); } - std::string expected() { + std::string expected() override { return Timestamp(1, 2).toStringPretty(); } }; /** Coerce date to string. */ class DateToString : public ToStringBase { - Value value() { + Value value() override { return Value(Date_t::fromMillisSinceEpoch(1234567890123LL)); } - std::string expected() { + std::string expected() override { return "2009-02-13T23:31:30.123Z"; } // from js }; /** Coerce null to string. */ class NullToString : public ToStringBase { - Value value() { + Value value() override { return Value(BSONNULL); } }; /** Coerce undefined to string. */ class UndefinedToString : public ToStringBase { - Value value() { + Value value() override { return Value(BSONUndefined); } }; @@ -2587,7 +2587,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("document") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/exec/eof.h b/src/mongo/db/exec/eof.h index 3e5c069185f..5e9b582cfc6 100644 --- a/src/mongo/db/exec/eof.h +++ b/src/mongo/db/exec/eof.h @@ -47,7 +47,7 @@ class EOFStage final : public PlanStage { public: EOFStage(ExpressionContext* expCtx); - ~EOFStage(); + ~EOFStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; @@ -57,7 +57,7 @@ public: return STAGE_EOF; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; const SpecificStats* getSpecificStats() const final; diff --git a/src/mongo/db/exec/exclusion_projection_executor.h b/src/mongo/db/exec/exclusion_projection_executor.h index a8c11646880..23ede2858cc 100644 --- a/src/mongo/db/exec/exclusion_projection_executor.h +++ b/src/mongo/db/exec/exclusion_projection_executor.h @@ -99,7 +99,7 @@ public: std::pair extractProjectOnFieldAndRename(StringData oldName, StringData newName); protected: - std::unique_ptr makeChild(const std::string& fieldName) const { + std::unique_ptr makeChild(const std::string& fieldName) const override { return std::make_unique( _policies, FieldPath::getFullyQualifiedPath(_pathToNode, fieldName)); } @@ -261,7 +261,7 @@ public: } } - boost::optional> extractExhaustivePaths() const { + boost::optional> extractExhaustivePaths() const override { return boost::none; } diff --git a/src/mongo/db/exec/fetch.h b/src/mongo/db/exec/fetch.h index d700a1da4aa..ab5f4d89da1 100644 --- a/src/mongo/db/exec/fetch.h +++ b/src/mongo/db/exec/fetch.h @@ -63,7 +63,7 @@ public: const MatchExpression* filter, VariantCollectionPtrOrAcquisition collection); - ~FetchStage(); + ~FetchStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; @@ -75,7 +75,7 @@ public: return STAGE_FETCH; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; const SpecificStats* getSpecificStats() const final; diff --git a/src/mongo/db/exec/filter.h b/src/mongo/db/exec/filter.h index fff46d553dd..e349cd129e7 100644 --- a/src/mongo/db/exec/filter.h +++ b/src/mongo/db/exec/filter.h @@ -47,7 +47,7 @@ public: // This is only called by a $where query. The query system must be smart enough to realize // that it should do a fetch beforehand. - BSONObj toBSON() const { + BSONObj toBSON() const override { return _obj; } @@ -103,7 +103,7 @@ public: IndexKeyMatchableDocument(const BSONObj& key, const BSONObj& keyPattern) : _keyPattern(keyPattern), _key(key) {} - BSONObj toBSON() const { + BSONObj toBSON() const override { return _key; } diff --git a/src/mongo/db/exec/idhack.h b/src/mongo/db/exec/idhack.h index 48115e5d2f3..bba0484ea95 100644 --- a/src/mongo/db/exec/idhack.h +++ b/src/mongo/db/exec/idhack.h @@ -69,7 +69,7 @@ public: VariantCollectionPtrOrAcquisition collection, const IndexDescriptor* descriptor); - ~IDHackStage(); + ~IDHackStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; @@ -81,7 +81,7 @@ public: return STAGE_IDHACK; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; const SpecificStats* getSpecificStats() const final; diff --git a/src/mongo/db/exec/limit.h b/src/mongo/db/exec/limit.h index ce6be32494c..105cb4a4b35 100644 --- a/src/mongo/db/exec/limit.h +++ b/src/mongo/db/exec/limit.h @@ -55,7 +55,7 @@ public: long long limit, WorkingSet* ws, std::unique_ptr child); - ~LimitStage(); + ~LimitStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; diff --git a/src/mongo/db/exec/merge_sort.h b/src/mongo/db/exec/merge_sort.h index 111a3423cb9..6418f645fe6 100644 --- a/src/mongo/db/exec/merge_sort.h +++ b/src/mongo/db/exec/merge_sort.h @@ -77,7 +77,7 @@ public: return STAGE_SORT_MERGE; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; const SpecificStats* getSpecificStats() const final; diff --git a/src/mongo/db/exec/near.h b/src/mongo/db/exec/near.h index 1772c85263e..67b2b39d40a 100644 --- a/src/mongo/db/exec/near.h +++ b/src/mongo/db/exec/near.h @@ -91,7 +91,7 @@ class NearStage : public RequiresIndexStage { public: struct CoveredInterval; - ~NearStage(); + ~NearStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; diff --git a/src/mongo/db/exec/plan_stats.h b/src/mongo/db/exec/plan_stats.h index 2df1a27314d..ed0d1406f2e 100644 --- a/src/mongo/db/exec/plan_stats.h +++ b/src/mongo/db/exec/plan_stats.h @@ -189,7 +189,7 @@ struct AndHashStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return container_size_helper::estimateObjectSizeInBytes(mapAfterChild) + sizeof(*this); } @@ -223,7 +223,7 @@ struct AndSortedStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return container_size_helper::estimateObjectSizeInBytes(failedAnd) + sizeof(*this); } @@ -246,7 +246,7 @@ struct CachedPlanStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -268,7 +268,7 @@ struct CollectionScanStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -303,7 +303,7 @@ struct CountStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -341,7 +341,7 @@ struct CountScanStats : public SpecificStats { return specific; } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return container_size_helper::estimateObjectSizeInBytes( multiKeyPaths, [](const auto& keyPath) { @@ -398,7 +398,7 @@ struct DeleteStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -439,7 +439,7 @@ struct DistinctScanStats : public SpecificStats { return specific; } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return container_size_helper::estimateObjectSizeInBytes( multiKeyPaths, [](const auto& keyPath) { @@ -494,7 +494,7 @@ struct FetchStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -520,7 +520,7 @@ struct IDHackStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return indexName.capacity() + sizeof(*this); } @@ -546,7 +546,7 @@ struct ReturnKeyStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -581,7 +581,7 @@ struct IndexScanStats : public SpecificStats { return specific; } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return container_size_helper::estimateObjectSizeInBytes( multiKeyPaths, [](const auto& keyPath) { @@ -649,7 +649,7 @@ struct LimitStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -671,7 +671,7 @@ struct MockStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -691,7 +691,7 @@ struct MultiPlanStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -713,7 +713,7 @@ struct OrStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -736,7 +736,7 @@ struct ProjectionStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return projObj.objsize() + sizeof(*this); } @@ -757,11 +757,11 @@ struct SortStats : public SpecificStats { SortStats(uint64_t limit, uint64_t maxMemoryUsageBytes) : limit(limit), maxMemoryUsageBytes(maxMemoryUsageBytes) {} - std::unique_ptr clone() const { + std::unique_ptr clone() const override { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sortPattern.objsize() + sizeof(*this); } @@ -809,7 +809,7 @@ struct MergeSortStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sortPattern.objsize() + sizeof(*this); } @@ -835,7 +835,7 @@ struct ShardingFilterStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -857,7 +857,7 @@ struct SkipStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -893,7 +893,7 @@ struct NearStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return container_size_helper::estimateObjectSizeInBytes(intervalStats) + keyPattern.objsize() + indexName.capacity() + sizeof(*this); } @@ -920,7 +920,7 @@ struct UpdateStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return objInserted.objsize() + sizeof(*this); } @@ -953,7 +953,7 @@ struct TextMatchStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return parsedTextQuery.objsize() + indexPrefix.objsize() + indexName.capacity() + sizeof(*this); } @@ -986,7 +986,7 @@ struct TextOrStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -1006,7 +1006,7 @@ struct TrialStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -1033,7 +1033,7 @@ struct GroupStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -1067,7 +1067,7 @@ struct DocumentSourceCursorStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this) + (planSummaryStats.estimateObjectSizeInBytes() - sizeof(planSummaryStats)); } @@ -1088,7 +1088,7 @@ struct DocumentSourceLookupStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this) + (planSummaryStats.estimateObjectSizeInBytes() - sizeof(planSummaryStats)); } @@ -1110,7 +1110,7 @@ struct UnionWithStats final : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this) + (planSummaryStats.estimateObjectSizeInBytes() - sizeof(planSummaryStats)); } @@ -1132,7 +1132,7 @@ struct DocumentSourceFacetStats : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this) + (planSummaryStats.estimateObjectSizeInBytes() - sizeof(planSummaryStats)); } @@ -1154,7 +1154,7 @@ struct UnpackTimeseriesBucketStats final : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -1174,7 +1174,7 @@ struct TimeseriesModifyStats final : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return objInserted.objsize() + sizeof(*this); } @@ -1208,7 +1208,7 @@ struct SampleFromTimeseriesBucketStats final : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -1226,11 +1226,11 @@ struct SampleFromTimeseriesBucketStats final : public SpecificStats { }; struct SpoolStats : public SpecificStats { - std::unique_ptr clone() const { + std::unique_ptr clone() const override { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } diff --git a/src/mongo/db/exec/requires_all_indices_stage.h b/src/mongo/db/exec/requires_all_indices_stage.h index 0bdd7d90c74..a26801187f3 100644 --- a/src/mongo/db/exec/requires_all_indices_stage.h +++ b/src/mongo/db/exec/requires_all_indices_stage.h @@ -53,12 +53,12 @@ public: _allIndicesRequiredChecker.emplace(std::move(multipleCollection)); } - virtual ~RequiresAllIndicesStage() = default; + ~RequiresAllIndicesStage() override = default; protected: - void doSaveStateRequiresCollection() override final {} + void doSaveStateRequiresCollection() final {} - void doRestoreStateRequiresCollection() override final { + void doRestoreStateRequiresCollection() final { if (_allIndicesRequiredChecker) { const auto& coll = collection(); auto multipleCollection = coll.isAcquisition() diff --git a/src/mongo/db/exec/requires_collection_stage.h b/src/mongo/db/exec/requires_collection_stage.h index 74b1eb25b3f..711c835d948 100644 --- a/src/mongo/db/exec/requires_collection_stage.h +++ b/src/mongo/db/exec/requires_collection_stage.h @@ -65,7 +65,7 @@ public: _catalogEpoch(getCatalogEpoch()), _nss(coll.getCollectionPtr()->ns()) {} - virtual ~RequiresCollectionStage() = default; + ~RequiresCollectionStage() override = default; protected: void doSaveState() final; diff --git a/src/mongo/db/exec/requires_index_stage.h b/src/mongo/db/exec/requires_index_stage.h index a5aa8e7cf34..45d87ac03b6 100644 --- a/src/mongo/db/exec/requires_index_stage.h +++ b/src/mongo/db/exec/requires_index_stage.h @@ -59,7 +59,7 @@ public: const IndexDescriptor* indexDescriptor, WorkingSet* workingSet); - virtual ~RequiresIndexStage() = default; + ~RequiresIndexStage() override = default; protected: /** @@ -72,9 +72,9 @@ protected: */ virtual void doRestoreStateRequiresIndex() = 0; - void doSaveStateRequiresCollection() override final; + void doSaveStateRequiresCollection() final; - void doRestoreStateRequiresCollection() override final; + void doRestoreStateRequiresCollection() final; const IndexDescriptor* indexDescriptor() const { return _entry ? _entry->descriptor() : nullptr; diff --git a/src/mongo/db/exec/sample_from_timeseries_bucket.h b/src/mongo/db/exec/sample_from_timeseries_bucket.h index 41b085984d2..2132f89e487 100644 --- a/src/mongo/db/exec/sample_from_timeseries_bucket.h +++ b/src/mongo/db/exec/sample_from_timeseries_bucket.h @@ -94,7 +94,7 @@ public: return &_specificStats; } - PlanStage::StageState doWork(WorkingSetID* id); + PlanStage::StageState doWork(WorkingSetID* id) override; private: /** diff --git a/src/mongo/db/exec/sbe/abt/sbe_abt_test_util.h b/src/mongo/db/exec/sbe/abt/sbe_abt_test_util.h index e2c9ab0a987..e0c89e40bf3 100644 --- a/src/mongo/db/exec/sbe/abt/sbe_abt_test_util.h +++ b/src/mongo/db/exec/sbe/abt/sbe_abt_test_util.h @@ -58,7 +58,7 @@ class NodeSBE : public ServiceContextTest {}; class ABTRecorder : public ce::SamplingExecutor { public: ABTRecorder(ABTVector& nodes) : _nodes(nodes) {} - ~ABTRecorder() = default; + ~ABTRecorder() override = default; std::pair execute( const Metadata& metadata, diff --git a/src/mongo/db/exec/sbe/sbe_hash_lookup_test.cpp b/src/mongo/db/exec/sbe/sbe_hash_lookup_test.cpp index a335d62f4be..6334f3b3820 100644 --- a/src/mongo/db/exec/sbe/sbe_hash_lookup_test.cpp +++ b/src/mongo/db/exec/sbe/sbe_hash_lookup_test.cpp @@ -43,7 +43,7 @@ public: const BSONArray& outer, const BSONArray& inner, bool outerKeyOnly = true, - CollatorInterface* collator = nullptr) { + CollatorInterface* collator = nullptr) override { auto& stream = gctx.outStream(); if (stream.tellp()) { stream << std::endl; diff --git a/src/mongo/db/exec/sbe/sbe_hash_lookup_unwind_test.cpp b/src/mongo/db/exec/sbe/sbe_hash_lookup_unwind_test.cpp index 94eec8cc2b8..54a5ff17ea9 100644 --- a/src/mongo/db/exec/sbe/sbe_hash_lookup_unwind_test.cpp +++ b/src/mongo/db/exec/sbe/sbe_hash_lookup_unwind_test.cpp @@ -44,7 +44,7 @@ public: const BSONArray& outer, const BSONArray& inner, bool outerKeyOnly = true, - CollatorInterface* collator = nullptr) { + CollatorInterface* collator = nullptr) override { auto& stream = gctx.outStream(); if (stream.tellp()) { stream << std::endl; diff --git a/src/mongo/db/exec/sbe/sbe_pattern_value_cmp_test.cpp b/src/mongo/db/exec/sbe/sbe_pattern_value_cmp_test.cpp index 8e8a91abfc6..bffc7fde9f0 100644 --- a/src/mongo/db/exec/sbe/sbe_pattern_value_cmp_test.cpp +++ b/src/mongo/db/exec/sbe/sbe_pattern_value_cmp_test.cpp @@ -50,7 +50,7 @@ namespace { class ObjectArray : public mongo::unittest::Test { public: ObjectArray() {} - ~ObjectArray() { + ~ObjectArray() override { for (auto& pair : objs) { releaseValue(pair.first, pair.second); } diff --git a/src/mongo/db/exec/sbe/stages/block_hashagg.h b/src/mongo/db/exec/sbe/stages/block_hashagg.h index c05d0a275d4..538ba3acb68 100644 --- a/src/mongo/db/exec/sbe/stages/block_hashagg.h +++ b/src/mongo/db/exec/sbe/stages/block_hashagg.h @@ -77,7 +77,7 @@ public: bool participateInTrialRunTracking = true, bool forceIncreasedSpilling = false); - ~BlockHashAggStage(); + ~BlockHashAggStage() override; std::unique_ptr clone() const final; diff --git a/src/mongo/db/exec/sbe/stages/block_to_row.h b/src/mongo/db/exec/sbe/stages/block_to_row.h index 95b63b63b35..c8960686ca1 100644 --- a/src/mongo/db/exec/sbe/stages/block_to_row.h +++ b/src/mongo/db/exec/sbe/stages/block_to_row.h @@ -59,7 +59,7 @@ public: PlanNodeId nodeId, PlanYieldPolicy* yieldPolicy = nullptr, bool participateInTrialRunTracking = true); - ~BlockToRowStage(); + ~BlockToRowStage() override; std::unique_ptr clone() const final; diff --git a/src/mongo/db/exec/sbe/stages/filter.h b/src/mongo/db/exec/sbe/stages/filter.h index f6338847e4c..29cab7c7e3c 100644 --- a/src/mongo/db/exec/sbe/stages/filter.h +++ b/src/mongo/db/exec/sbe/stages/filter.h @@ -156,7 +156,7 @@ public: } } - std::unique_ptr getStats(bool includeDebugInfo) const { + std::unique_ptr getStats(bool includeDebugInfo) const override { auto ret = std::make_unique(_commonStats); ret->specific = std::make_unique(_specificStats); diff --git a/src/mongo/db/exec/sbe/stages/hash_agg.h b/src/mongo/db/exec/sbe/stages/hash_agg.h index 09a2d899991..617be44c742 100644 --- a/src/mongo/db/exec/sbe/stages/hash_agg.h +++ b/src/mongo/db/exec/sbe/stages/hash_agg.h @@ -119,7 +119,7 @@ public: bool participateInTrialRunTracking = true, bool forceIncreasedSpilling = false); - ~HashAggStage(); + ~HashAggStage() override; std::unique_ptr clone() const final; diff --git a/src/mongo/db/exec/sbe/stages/plan_stats.h b/src/mongo/db/exec/sbe/stages/plan_stats.h index 38a65b0d501..f0a5d35dd6f 100644 --- a/src/mongo/db/exec/sbe/stages/plan_stats.h +++ b/src/mongo/db/exec/sbe/stages/plan_stats.h @@ -148,7 +148,7 @@ struct IndexScanStats final : public SpecificStats { return std::make_unique(*this); } - uint64_t estimateObjectSizeInBytes() const { + uint64_t estimateObjectSizeInBytes() const override { return sizeof(*this); } @@ -407,10 +407,10 @@ struct PlanStatsNumReadsVisitor : PlanStatsVisitorBase { // To avoid overloaded-virtual warnings. using PlanStatsConstVisitor::visit; - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { numReads += stats->numReads; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { numReads += stats->numReads; } diff --git a/src/mongo/db/exec/sbe/stages/search_cursor.h b/src/mongo/db/exec/sbe/stages/search_cursor.h index 887eebc2151..8f9fed8398a 100644 --- a/src/mongo/db/exec/sbe/stages/search_cursor.h +++ b/src/mongo/db/exec/sbe/stages/search_cursor.h @@ -105,7 +105,7 @@ public: std::unique_ptr getStats(bool includeDebugInfo) const final; const SpecificStats* getSpecificStats() const final; - std::vector debugPrint() const final override; + std::vector debugPrint() const final; size_t estimateCompileTimeSize() const final; /** diff --git a/src/mongo/db/exec/sbe/stages/sort.h b/src/mongo/db/exec/sbe/stages/sort.h index 6b34211da41..9a08c2f8a7a 100644 --- a/src/mongo/db/exec/sbe/stages/sort.h +++ b/src/mongo/db/exec/sbe/stages/sort.h @@ -88,7 +88,7 @@ public: PlanNodeId planNodeId, bool participateInTrialRunTracking = true); - ~SortStage(); + ~SortStage() override; std::unique_ptr clone() const final; @@ -118,7 +118,7 @@ private: class SortImpl : public SortIface { public: SortImpl(SortStage& stage); - ~SortImpl(); + ~SortImpl() override; void prepare(CompileCtx& ctx) final; value::SlotAccessor* getAccessor(CompileCtx& ctx, value::SlotId slot) final; diff --git a/src/mongo/db/exec/sbe/stages/spool.h b/src/mongo/db/exec/sbe/stages/spool.h index b47916cea77..0b235e960e6 100644 --- a/src/mongo/db/exec/sbe/stages/spool.h +++ b/src/mongo/db/exec/sbe/stages/spool.h @@ -203,12 +203,12 @@ public: _spoolId{spoolId}, _vals{std::move(vals)} {} - std::unique_ptr clone() const { + std::unique_ptr clone() const override { return std::make_unique>( _spoolId, _vals, _yieldPolicy, _commonStats.nodeId, participateInTrialRunTracking()); } - void prepare(CompileCtx& ctx) { + void prepare(CompileCtx& ctx) override { if (!_buffer) { _buffer = ctx.getSpoolBuffer(_spoolId); } @@ -225,7 +225,7 @@ public: } } - value::SlotAccessor* getAccessor(CompileCtx& ctx, value::SlotId slot) { + value::SlotAccessor* getAccessor(CompileCtx& ctx, value::SlotId slot) override { if (auto it = _outAccessors.find(slot); it != _outAccessors.end()) { return &it->second; } @@ -233,14 +233,14 @@ public: return ctx.getAccessor(slot); } - void open(bool reOpen) { + void open(bool reOpen) override { auto optTimer(getOptTimer(_opCtx)); _commonStats.opens++; _bufferIt = _buffer->size(); } - PlanState getNext() { + PlanState getNext() override { auto optTimer(getOptTimer(_opCtx)); checkForInterruptAndYield(_opCtx); @@ -268,13 +268,13 @@ public: return trackPlanState(PlanState::ADVANCED); } - void close() { + void close() override { auto optTimer(getOptTimer(_opCtx)); trackClose(); } - std::unique_ptr getStats(bool includeDebugInfo) const { + std::unique_ptr getStats(bool includeDebugInfo) const override { auto ret = std::make_unique(_commonStats); if (includeDebugInfo) { @@ -287,11 +287,11 @@ public: return ret; } - const SpecificStats* getSpecificStats() const { + const SpecificStats* getSpecificStats() const override { return nullptr; } - std::vector debugPrint() const { + std::vector debugPrint() const override { auto ret = PlanStage::debugPrint(); DebugPrinter::addSpoolIdentifier(ret, _spoolId); @@ -309,7 +309,7 @@ public: return ret; } - size_t estimateCompileTimeSize() const { + size_t estimateCompileTimeSize() const override { size_t size = sizeof(*this); size += size_estimator::estimate(_vals); return size; diff --git a/src/mongo/db/exec/sbe/stages/stage_visitors.h b/src/mongo/db/exec/sbe/stages/stage_visitors.h index 424bc7b118f..2f86b95f914 100644 --- a/src/mongo/db/exec/sbe/stages/stage_visitors.h +++ b/src/mongo/db/exec/sbe/stages/stage_visitors.h @@ -66,7 +66,7 @@ public: } protected: - virtual void visit(const sbe::PlanStage* root) { + void visit(const sbe::PlanStage* root) override { auto stats = root->getCommonStats(); if (stats->stageType == "seek"_sd) { collectionSeeks += stats->opens; diff --git a/src/mongo/db/exec/sbe/util/stage_results_printer.cpp b/src/mongo/db/exec/sbe/util/stage_results_printer.cpp index 8ff5db01253..8a82631cac9 100644 --- a/src/mongo/db/exec/sbe/util/stage_results_printer.cpp +++ b/src/mongo/db/exec/sbe/util/stage_results_printer.cpp @@ -122,7 +122,7 @@ struct PlanStatsSpecificStatsPrinter : PlanStatsVisitorBase { // To avoid overloaded-virtual warnings. using PlanStatsConstVisitor::visit; - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _stream << "dsk:" << stats->usedDisk << "\n"; _stream << "htRecs:" << stats->spilledHtRecords << "\n"; _stream << "htIndices:" << stats->spilledHtBytesOverAllRecords << "\n"; diff --git a/src/mongo/db/exec/sbe/values/block_interface.h b/src/mongo/db/exec/sbe/values/block_interface.h index e5119e3e7bd..216c97b102b 100644 --- a/src/mongo/db/exec/sbe/values/block_interface.h +++ b/src/mongo/db/exec/sbe/values/block_interface.h @@ -344,7 +344,7 @@ public: o._val = 0; } - ~MonoBlock() { + ~MonoBlock() override { releaseValue(_tag, _val); } @@ -461,7 +461,7 @@ public: HeterogeneousBlock(std::vector tags, std::vector vals, bool isDense = false) : _vals(std::move(vals)), _tags(std::move(tags)), _isDense(isDense) {} - ~HeterogeneousBlock() { + ~HeterogeneousBlock() override { release(); } diff --git a/src/mongo/db/exec/sbe/values/block_test.cpp b/src/mongo/db/exec/sbe/values/block_test.cpp index 4eae5958b83..52bb3348b40 100644 --- a/src/mongo/db/exec/sbe/values/block_test.cpp +++ b/src/mongo/db/exec/sbe/values/block_test.cpp @@ -684,7 +684,7 @@ public: o._vals = {}; o._tags = {}; } - ~TestBlock() { + ~TestBlock() override { for (size_t i = 0; i < _vals.size(); ++i) { releaseValue(_tags[i], _vals[i]); } diff --git a/src/mongo/db/exec/sbe/values/bson_block.cpp b/src/mongo/db/exec/sbe/values/bson_block.cpp index 246da8de72b..a5151b07c5d 100644 --- a/src/mongo/db/exec/sbe/values/bson_block.cpp +++ b/src/mongo/db/exec/sbe/values/bson_block.cpp @@ -285,12 +285,13 @@ class BSONExtractorImpl : public BSONCellExtractor { public: BSONExtractorImpl(std::vector pathReqs); - std::vector> extractFromBsons(const std::vector& bsons); + std::vector> extractFromBsons( + const std::vector& bsons) override; std::vector> extractFromTopLevelField( StringData topLevelField, const std::span& tags, - const std::span& vals); + const std::span& vals) override; BsonWalkNode* getRoot() { return &_root; diff --git a/src/mongo/db/exec/sbe/values/slot.h b/src/mongo/db/exec/sbe/values/slot.h index 6c322a114e1..1a00d5321e1 100644 --- a/src/mongo/db/exec/sbe/values/slot.h +++ b/src/mongo/db/exec/sbe/values/slot.h @@ -157,7 +157,7 @@ public: other._owned = false; } - ~OwnedValueAccessor() { + ~OwnedValueAccessor() override { release(); } @@ -502,7 +502,7 @@ public: other._bsonObj = BSONObj(); } - ~BSONObjValueAccessor() { + ~BSONObjValueAccessor() override { release(); } diff --git a/src/mongo/db/exec/shard_filter.h b/src/mongo/db/exec/shard_filter.h index 35d305bfa14..95abcbce85c 100644 --- a/src/mongo/db/exec/shard_filter.h +++ b/src/mongo/db/exec/shard_filter.h @@ -60,7 +60,7 @@ public: ScopedCollectionFilter collectionFilter, WorkingSet* ws, std::unique_ptr child); - ~ShardFilterStage(); + ~ShardFilterStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; diff --git a/src/mongo/db/exec/skip.h b/src/mongo/db/exec/skip.h index 9aa2cd9b5b5..bd9b1d7ef15 100644 --- a/src/mongo/db/exec/skip.h +++ b/src/mongo/db/exec/skip.h @@ -54,7 +54,7 @@ public: long long toSkip, WorkingSet* ws, std::unique_ptr child); - ~SkipStage(); + ~SkipStage() override; bool isEOF() final; StageState doWork(WorkingSetID* out) final; diff --git a/src/mongo/db/exec/sort.h b/src/mongo/db/exec/sort.h index fa034003f57..37bf685d22a 100644 --- a/src/mongo/db/exec/sort.h +++ b/src/mongo/db/exec/sort.h @@ -95,7 +95,7 @@ public: StageState doWork(WorkingSetID* out) final; - std::unique_ptr getStats() override final; + std::unique_ptr getStats() final; protected: // Not owned by us. @@ -124,11 +124,11 @@ public: bool addSortKeyMetadata, std::unique_ptr child); - void spool(WorkingSetID wsid) override final; + void spool(WorkingSetID wsid) final; - void loadingDone() override final; + void loadingDone() final; - StageState unspool(WorkingSetID* out) override final; + StageState unspool(WorkingSetID* out) final; StageType stageType() const final { return STAGE_SORT_DEFAULT; @@ -165,11 +165,11 @@ public: bool addSortKeyMetadata, std::unique_ptr child); - virtual void spool(WorkingSetID wsid) override final; + void spool(WorkingSetID wsid) final; - void loadingDone() override final; + void loadingDone() final; - virtual StageState unspool(WorkingSetID* out) override final; + StageState unspool(WorkingSetID* out) final; StageType stageType() const final { return STAGE_SORT_SIMPLE; diff --git a/src/mongo/db/exec/spool.h b/src/mongo/db/exec/spool.h index b608dcd0227..06e3ca12a0b 100644 --- a/src/mongo/db/exec/spool.h +++ b/src/mongo/db/exec/spool.h @@ -64,20 +64,20 @@ public: SpoolStage(ExpressionContext* expCtx, WorkingSet* ws, std::unique_ptr child); - StageType stageType() const { + StageType stageType() const override { return STAGE_SPOOL; } bool isEOF() final; - std::unique_ptr getStats(); + std::unique_ptr getStats() override; - const SpecificStats* getSpecificStats() const { + const SpecificStats* getSpecificStats() const override { return &_specificStats; } protected: - PlanStage::StageState doWork(WorkingSetID* id); + PlanStage::StageState doWork(WorkingSetID* id) override; private: void spill(); diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp index fddc7b23a25..72e9bfb22c0 100644 --- a/src/mongo/db/exec/stagedebug_cmd.cpp +++ b/src/mongo/db/exec/stagedebug_cmd.cpp @@ -127,7 +127,7 @@ class StageDebugCmd : public BasicCommand { public: StageDebugCmd() : BasicCommand("stageDebug") {} - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -150,7 +150,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName& dbName, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { BSONElement argElt = cmdObj["stageDebug"]; if (argElt.eoo() || !argElt.isABSONObj()) { return false; diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h index 47fefb959b0..1bdeb57e1e3 100644 --- a/src/mongo/db/exec/subplan.h +++ b/src/mongo/db/exec/subplan.h @@ -100,7 +100,7 @@ public: return STAGE_SUBPLAN; } - std::unique_ptr getStats(); + std::unique_ptr getStats() override; const SpecificStats* getSpecificStats() const final; diff --git a/src/mongo/db/exec/text_match.h b/src/mongo/db/exec/text_match.h index 212ab1a984d..5c1e9e9da2b 100644 --- a/src/mongo/db/exec/text_match.h +++ b/src/mongo/db/exec/text_match.h @@ -86,7 +86,7 @@ public: std::unique_ptr child, const TextMatchParams& params, WorkingSet* ws); - ~TextMatchStage(); + ~TextMatchStage() override; void addChild(PlanStage* child); diff --git a/src/mongo/db/exec/timeseries_modify.h b/src/mongo/db/exec/timeseries_modify.h index 578aacf56a8..31502b680f1 100644 --- a/src/mongo/db/exec/timeseries_modify.h +++ b/src/mongo/db/exec/timeseries_modify.h @@ -149,21 +149,21 @@ public: timeseries::BucketUnpacker bucketUnpacker, std::unique_ptr residualPredicate, std::unique_ptr originalPredicate = nullptr); - ~TimeseriesModifyStage(); + ~TimeseriesModifyStage() override; - StageType stageType() const { + StageType stageType() const override { return STAGE_TIMESERIES_MODIFY; } bool isEOF() override; - std::unique_ptr getStats(); + std::unique_ptr getStats() override; - const SpecificStats* getSpecificStats() const { + const SpecificStats* getSpecificStats() const override { return &_specificStats; } - PlanStage::StageState doWork(WorkingSetID* id); + PlanStage::StageState doWork(WorkingSetID* id) override; bool containsDotsAndDollarsField() const { return _params.isUpdate && _params.updateDriver->containsDotsAndDollarsField(); diff --git a/src/mongo/db/exec/unpack_timeseries_bucket.h b/src/mongo/db/exec/unpack_timeseries_bucket.h index 7ea38a92d12..5a00aae0d19 100644 --- a/src/mongo/db/exec/unpack_timeseries_bucket.h +++ b/src/mongo/db/exec/unpack_timeseries_bucket.h @@ -67,7 +67,7 @@ public: return &_specificStats; } - PlanStage::StageState doWork(WorkingSetID* id); + PlanStage::StageState doWork(WorkingSetID* id) override; private: WorkingSet& _ws; diff --git a/src/mongo/db/exec/working_set_test.cpp b/src/mongo/db/exec/working_set_test.cpp index addbc835478..665e3199128 100644 --- a/src/mongo/db/exec/working_set_test.cpp +++ b/src/mongo/db/exec/working_set_test.cpp @@ -46,7 +46,7 @@ using std::string; class WorkingSetFixture : public mongo::unittest::Test { protected: - void setUp() { + void setUp() override { ws.reset(new WorkingSet()); id = ws->allocate(); ASSERT(id != WorkingSet::INVALID_ID); @@ -54,7 +54,7 @@ protected: ASSERT(nullptr != member); } - void tearDown() { + void tearDown() override { ws.reset(); member = nullptr; } diff --git a/src/mongo/db/field_parser_test.cpp b/src/mongo/db/field_parser_test.cpp index 6b926dc92b8..d5f3493344b 100644 --- a/src/mongo/db/field_parser_test.cpp +++ b/src/mongo/db/field_parser_test.cpp @@ -77,7 +77,7 @@ protected: static BSONField anOID; static BSONField aLong; - void setUp() { + void setUp() override { valBool = true; valArray = BSON_ARRAY(1 << 2 << 3); valObj = BSON("a" << 1); @@ -90,7 +90,7 @@ protected: << aString(valString) << anOID(valOID) << aLong(valLong)); } - void tearDown() {} + void tearDown() override {} }; BSONField ExtractionFixture::aBool("aBool"); diff --git a/src/mongo/db/fle_crud_mongod.cpp b/src/mongo/db/fle_crud_mongod.cpp index 2a3a0c4cf37..3e6cfdf8090 100644 --- a/src/mongo/db/fle_crud_mongod.cpp +++ b/src/mongo/db/fle_crud_mongod.cpp @@ -236,7 +236,7 @@ public: return BSONObj(); } - virtual bool existsById(PrfBlock block) const override { + bool existsById(PrfBlock block) const override { return getRecordById(block).has_value(); } @@ -304,7 +304,7 @@ public: return BSONObj(); } - virtual bool existsById(PrfBlock block) const override { + bool existsById(PrfBlock block) const override { return getRecordById(block).has_value(); } diff --git a/src/mongo/db/fle_crud_test.cpp b/src/mongo/db/fle_crud_test.cpp index 744ba6cb0cb..ac9831754ab 100644 --- a/src/mongo/db/fle_crud_test.cpp +++ b/src/mongo/db/fle_crud_test.cpp @@ -143,7 +143,7 @@ public: KeyMaterial getKey(const UUID& uuid) override; BSONObj getEncryptedKey(const UUID& uuid) override; - SymmetricKey& getKMSLocalKey() { + SymmetricKey& getKMSLocalKey() override { return _localKey; } @@ -223,8 +223,8 @@ int32_t getTestSeed() { class FleCrudTest : public ServiceContextMongoDTest { protected: - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void createCollection(const NamespaceString& ns); @@ -771,10 +771,10 @@ private: class FleTagsTest : public FleCrudTest { protected: - void setUp() { + void setUp() override { FleCrudTest::setUp(); } - void tearDown() { + void tearDown() override { FleCrudTest::tearDown(); } diff --git a/src/mongo/db/fle_query_interface_mock.h b/src/mongo/db/fle_query_interface_mock.h index 41e6614495c..b6a305cdbd0 100644 --- a/src/mongo/db/fle_query_interface_mock.h +++ b/src/mongo/db/fle_query_interface_mock.h @@ -53,7 +53,7 @@ class FLEQueryInterfaceMock : public FLEQueryInterface { public: FLEQueryInterfaceMock(OperationContext* opCtx, repl::StorageInterface* storage) : _opCtx(opCtx), _storage(storage) {} - ~FLEQueryInterfaceMock() = default; + ~FLEQueryInterfaceMock() override = default; BSONObj getById(const NamespaceString& nss, BSONElement element) final; diff --git a/src/mongo/db/ftdc/controller_test.cpp b/src/mongo/db/ftdc/controller_test.cpp index 59d574143b4..8b28d0c280c 100644 --- a/src/mongo/db/ftdc/controller_test.cpp +++ b/src/mongo/db/ftdc/controller_test.cpp @@ -61,7 +61,7 @@ protected: class FTDCMetricsCollectorMockTee : public FTDCCollectorInterface { public: - ~FTDCMetricsCollectorMockTee() { + ~FTDCMetricsCollectorMockTee() override { ASSERT_TRUE(_state == State::kStarted); } diff --git a/src/mongo/db/geo/big_polygon.h b/src/mongo/db/geo/big_polygon.h index f83c6242a6d..cccceb01b94 100644 --- a/src/mongo/db/geo/big_polygon.h +++ b/src/mongo/db/geo/big_polygon.h @@ -54,7 +54,7 @@ public: BigSimplePolygon(S2Loop* loop); - virtual ~BigSimplePolygon(); + ~BigSimplePolygon() override; void Init(S2Loop* loop); @@ -84,23 +84,23 @@ public: // S2Region interface // - BigSimplePolygon* Clone() const; + BigSimplePolygon* Clone() const override; - S2Cap GetCapBound() const; + S2Cap GetCapBound() const override; - S2LatLngRect GetRectBound() const; + S2LatLngRect GetRectBound() const override; - bool Contains(S2Cell const& cell) const; + bool Contains(S2Cell const& cell) const override; - bool MayIntersect(S2Cell const& cell) const; + bool MayIntersect(S2Cell const& cell) const override; - bool VirtualContainsPoint(S2Point const& p) const; + bool VirtualContainsPoint(S2Point const& p) const override; - void Encode(Encoder* encoder) const; + void Encode(Encoder* encoder) const override; - bool Decode(Decoder* decoder); + bool Decode(Decoder* decoder) override; - bool DecodeWithinScope(Decoder* decoder); + bool DecodeWithinScope(Decoder* decoder) override; private: std::unique_ptr _loop; diff --git a/src/mongo/db/geo/geometry_container.cpp b/src/mongo/db/geo/geometry_container.cpp index 4480149da78..c2e0c048dce 100644 --- a/src/mongo/db/geo/geometry_container.cpp +++ b/src/mongo/db/geo/geometry_container.cpp @@ -126,13 +126,13 @@ bool GeometryContainer::hasR2Region() const { class GeometryContainer::R2BoxRegion : public R2Region { public: R2BoxRegion(const GeometryContainer* geometry); - virtual ~R2BoxRegion(); + ~R2BoxRegion() override; - Box getR2Bounds() const; + Box getR2Bounds() const override; - bool fastContains(const Box& other) const; + bool fastContains(const Box& other) const override; - bool fastDisjoint(const Box& other) const; + bool fastDisjoint(const Box& other) const override; private: static Box buildBounds(const GeometryContainer& geometry); diff --git a/src/mongo/db/geo/r2_region_coverer_test.cpp b/src/mongo/db/geo/r2_region_coverer_test.cpp index 3988216b704..b7b867b32df 100644 --- a/src/mongo/db/geo/r2_region_coverer_test.cpp +++ b/src/mongo/db/geo/r2_region_coverer_test.cpp @@ -172,15 +172,15 @@ GeoHashConverter::Parameters getConverterParams() { class HashBoxRegion : public R2Region { public: HashBoxRegion(Box box) : _box(box) {} - Box getR2Bounds() const { + Box getR2Bounds() const override { return _box; } - bool fastContains(const Box& other) const { + bool fastContains(const Box& other) const override { return _box.contains(other); } - bool fastDisjoint(const Box& other) const { + bool fastDisjoint(const Box& other) const override { if (!_box.intersects(other)) return true; diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h index de3765c843f..1f25fb00176 100644 --- a/src/mongo/db/geo/shapes.h +++ b/src/mongo/db/geo/shapes.h @@ -239,9 +239,9 @@ public: bool contains(const Point& point) const; // R2Region interface - Box getR2Bounds() const; - bool fastContains(const Box& other) const; - bool fastDisjoint(const Box& other) const; + Box getR2Bounds() const override; + bool fastContains(const Box& other) const override; + bool fastDisjoint(const Box& other) const override; // For debugging std::string toString() const; diff --git a/src/mongo/db/index/bulk_builder_common.h b/src/mongo/db/index/bulk_builder_common.h index 945fbb3a581..396852f3890 100644 --- a/src/mongo/db/index/bulk_builder_common.h +++ b/src/mongo/db/index/bulk_builder_common.h @@ -80,7 +80,7 @@ public: bool dupsAllowed, int32_t yieldIterations, const KeyHandlerFn& onDuplicateKeyInserted, - const RecordIdHandlerFn& onDuplicateRecord) { + const RecordIdHandlerFn& onDuplicateRecord) override { Timer timer; diff --git a/src/mongo/db/index/s2_access_method.h b/src/mongo/db/index/s2_access_method.h index 7862b150b9d..c8ee5c9a0af 100644 --- a/src/mongo/db/index/s2_access_method.h +++ b/src/mongo/db/index/s2_access_method.h @@ -82,7 +82,7 @@ protected: private: void validateDocument(const CollectionPtr& collection, const BSONObj& obj, - const BSONObj& keyPattern) const override final; + const BSONObj& keyPattern) const final; /** * Fills 'keys' with the keys that should be generated for 'obj' on this index. diff --git a/src/mongo/db/index_build_entry_helpers_test.cpp b/src/mongo/db/index_build_entry_helpers_test.cpp index 3b39edc943c..b2dee8f6d4e 100644 --- a/src/mongo/db/index_build_entry_helpers_test.cpp +++ b/src/mongo/db/index_build_entry_helpers_test.cpp @@ -106,7 +106,7 @@ Status removeIndexBuildEntry(OperationContext* opCtx, UUID indexBuildUUID) { class IndexBuildEntryHelpersTest : public CatalogTestFixture { public: - void setUp() { + void setUp() override { CatalogTestFixture::setUp(); const UUID collectionUUID = UUID::gen(); diff --git a/src/mongo/db/matcher/expression_always_boolean.h b/src/mongo/db/matcher/expression_always_boolean.h index a3811fc8042..732a5874c5a 100644 --- a/src/mongo/db/matcher/expression_always_boolean.h +++ b/src/mongo/db/matcher/expression_always_boolean.h @@ -57,7 +57,7 @@ public: clonable_ptr annotation = nullptr) : MatchExpression(type, std::move(annotation)), _value(value) {} - virtual ~AlwaysBooleanMatchExpression() = default; + ~AlwaysBooleanMatchExpression() override = default; /** * The name of this MatchExpression. diff --git a/src/mongo/db/matcher/expression_arity.h b/src/mongo/db/matcher/expression_arity.h index 3ffb0ba2326..0ee3b471ea8 100644 --- a/src/mongo/db/matcher/expression_arity.h +++ b/src/mongo/db/matcher/expression_arity.h @@ -52,7 +52,7 @@ public: return nargs; } - virtual ~FixedArityMatchExpression() = default; + ~FixedArityMatchExpression() override = default; void debugString(StringBuilder& debug, int indentationLevel) const final { _debugAddSpace(debug, indentationLevel); diff --git a/src/mongo/db/matcher/expression_array.h b/src/mongo/db/matcher/expression_array.h index bed53a84bf2..c710f0bca7a 100644 --- a/src/mongo/db/matcher/expression_array.h +++ b/src/mongo/db/matcher/expression_array.h @@ -92,9 +92,9 @@ public: std::unique_ptr sub, clonable_ptr annotation = nullptr); - bool matchesArray(const BSONObj& anArray, MatchDetails* details) const; + bool matchesArray(const BSONObj& anArray, MatchDetails* details) const override; - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr e = std::make_unique( path(), _sub->clone(), _errorAnnotation); @@ -104,7 +104,7 @@ public: return e; } - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, @@ -114,16 +114,16 @@ public: return nullptr; } - virtual size_t numChildren() const { + size_t numChildren() const override { return 1; } - virtual MatchExpression* getChild(size_t i) const { + MatchExpression* getChild(size_t i) const override { tassert(6400204, "Out-of-bounds access to child of MatchExpression.", i < numChildren()); return _sub.get(); } - virtual void resetChild(size_t i, MatchExpression* other) { + void resetChild(size_t i, MatchExpression* other) override { tassert(6329401, "Out-of-bounds access to child of MatchExpression.", i < numChildren()); _sub.reset(other); } @@ -160,9 +160,9 @@ public: void add(std::unique_ptr sub); - bool matchesArray(const BSONObj& anArray, MatchDetails* details) const; + bool matchesArray(const BSONObj& anArray, MatchDetails* details) const override; - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr e = std::make_unique(path(), _errorAnnotation); for (size_t i = 0; i < _subs.size(); ++i) { @@ -174,7 +174,7 @@ public: return e; } - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, @@ -184,16 +184,16 @@ public: return &_subs; } - virtual size_t numChildren() const { + size_t numChildren() const override { return _subs.size(); } - virtual MatchExpression* getChild(size_t i) const { + MatchExpression* getChild(size_t i) const override { tassert(6400205, "Out-of-bounds access to child of MatchExpression.", i < numChildren()); return _subs[i].get(); } - virtual void resetChild(size_t i, MatchExpression* other) override { + void resetChild(size_t i, MatchExpression* other) override { tassert(6329402, "Out-of-bounds access to child of MatchExpression.", i < numChildren()); _subs[i].reset(other); } @@ -249,15 +249,15 @@ public: return nullptr; } - virtual bool matchesArray(const BSONObj& anArray, MatchDetails* details) const; + bool matchesArray(const BSONObj& anArray, MatchDetails* details) const override; - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; int getData() const { return _size; @@ -280,7 +280,7 @@ public: } private: - virtual ExpressionOptimizerFunc getOptimizer() const final { + ExpressionOptimizerFunc getOptimizer() const final { return [](std::unique_ptr expression) { return expression; }; diff --git a/src/mongo/db/matcher/expression_expr.h b/src/mongo/db/matcher/expression_expr.h index fa42e04104f..50c58a30ae3 100644 --- a/src/mongo/db/matcher/expression_expr.h +++ b/src/mongo/db/matcher/expression_expr.h @@ -116,7 +116,7 @@ public: MONGO_UNREACHABLE_TASSERT(6400207); } - void resetChild(size_t, MatchExpression*) { + void resetChild(size_t, MatchExpression*) override { MONGO_UNREACHABLE; }; diff --git a/src/mongo/db/matcher/expression_geo.h b/src/mongo/db/matcher/expression_geo.h index a72a27ba75d..e99f4f46156 100644 --- a/src/mongo/db/matcher/expression_geo.h +++ b/src/mongo/db/matcher/expression_geo.h @@ -112,7 +112,7 @@ public: const BSONObj& rawObj, clonable_ptr annotation = nullptr); - virtual ~GeoMatchExpression() {} + ~GeoMatchExpression() override {} static bool contains(const GeometryContainer& queryGeom, const GeoExpression::Predicate& queryPredicate, bool skipValidation, @@ -124,15 +124,15 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; bool matchesGeoContainer(const GeometryContainer&) const; - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; - virtual std::unique_ptr clone() const; + std::unique_ptr clone() const override; void setCanSkipValidation(bool val) { _canSkipValidation = val; @@ -225,7 +225,7 @@ public: std::shared_ptr query, const BSONObj& rawObj); - virtual ~GeoNearMatchExpression() {} + ~GeoNearMatchExpression() override {} /** * Stub implementation that should never be called, since geoNear execution requires an @@ -233,15 +233,15 @@ public: */ bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; - virtual std::unique_ptr clone() const; + std::unique_ptr clone() const override; const GeoNearExpression& getData() const { return *_query; diff --git a/src/mongo/db/matcher/expression_internal_bucket_geo_within.h b/src/mongo/db/matcher/expression_internal_bucket_geo_within.h index 6de47ae226c..cef32a615af 100644 --- a/src/mongo/db/matcher/expression_internal_bucket_geo_within.h +++ b/src/mongo/db/matcher/expression_internal_bucket_geo_within.h @@ -132,7 +132,7 @@ public: MONGO_UNREACHABLE_TASSERT(6400208); } - void resetChild(size_t, MatchExpression*) { + void resetChild(size_t, MatchExpression*) override { MONGO_UNREACHABLE; }; diff --git a/src/mongo/db/matcher/expression_internal_expr_comparison.h b/src/mongo/db/matcher/expression_internal_expr_comparison.h index 09433b3b5b1..2875ab88f4a 100644 --- a/src/mongo/db/matcher/expression_internal_expr_comparison.h +++ b/src/mongo/db/matcher/expression_internal_expr_comparison.h @@ -83,7 +83,7 @@ public: invariant(_rhs.type() != BSONType::Array); } - virtual ~InternalExprComparisonMatchExpression() = default; + ~InternalExprComparisonMatchExpression() override = default; bool matchesSingleElement(const BSONElement& elem, MatchDetails* details) const final { // We use NonLeafArrayBehavior::kMatchSubpath traversal in diff --git a/src/mongo/db/matcher/expression_leaf.h b/src/mongo/db/matcher/expression_leaf.h index b6e3ed91bc9..6a650a32291 100644 --- a/src/mongo/db/matcher/expression_leaf.h +++ b/src/mongo/db/matcher/expression_leaf.h @@ -113,7 +113,7 @@ public: : PathMatchExpression( matchType, path, leafArrBehavior, nonLeafArrBehavior, std::move(annotation)) {} - virtual ~LeafMatchExpression() = default; + ~LeafMatchExpression() override = default; size_t numChildren() const override { return 0; @@ -176,15 +176,15 @@ public: clonable_ptr annotation = nullptr, const CollatorInterface* collator = nullptr); - virtual ~ComparisonMatchExpressionBase() = default; + ~ComparisonMatchExpressionBase() override = default; - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; - virtual void appendSerializedRightHandSide(BSONObjBuilder* bob, - const SerializationOptions& opts = {}, - bool includePath = true) const; + void appendSerializedRightHandSide(BSONObjBuilder* bob, + const SerializationOptions& opts = {}, + bool includePath = true) const override; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; /** * Returns the name of this MatchExpression. @@ -276,7 +276,7 @@ public: clonable_ptr annotation = nullptr, const CollatorInterface* collator = nullptr); - virtual ~ComparisonMatchExpression() = default; + ~ComparisonMatchExpression() override = default; bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; }; @@ -519,7 +519,7 @@ public: StringData options, clonable_ptr annotation = nullptr); - ~RegexMatchExpression(); + ~RegexMatchExpression() override; std::unique_ptr clone() const final { std::unique_ptr e = @@ -538,7 +538,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, @@ -548,7 +548,7 @@ public: void shortDebugString(StringBuilder& debug) const; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; const std::string& getString() const { return _regex; @@ -622,13 +622,13 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; long long getDivisor() const { return _divisor; @@ -680,7 +680,7 @@ public: explicit ExistsMatchExpression(boost::optional path, clonable_ptr annotation = nullptr); - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr e = std::make_unique(path(), _errorAnnotation); if (getTag()) { @@ -691,13 +691,13 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; void acceptVisitor(MatchExpressionMutableVisitor* visitor) final { visitor->visit(this); @@ -731,18 +731,18 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; /** * 'collator' must outlive the InMatchExpression and any clones made of it. */ - virtual void _doSetCollator(const CollatorInterface* collator); + void _doSetCollator(const CollatorInterface* collator) override; const std::vector& getEqualities() const { return _equalities->getElements(); @@ -895,17 +895,17 @@ public: const char* bitMaskBinary, uint32_t bitMaskLen, clonable_ptr annotation); - virtual ~BitTestMatchExpression() {} + ~BitTestMatchExpression() override {} bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual void debugString(StringBuilder& debug, int indentationLevel) const; + void debugString(StringBuilder& debug, int indentationLevel) const override; void appendSerializedRightHandSide(BSONObjBuilder* bob, const SerializationOptions& opts = {}, bool includePath = true) const final; - virtual bool equivalent(const MatchExpression* other) const; + bool equivalent(const MatchExpression* other) const override; size_t numBitPositions() const { return _bitPositions.size(); diff --git a/src/mongo/db/matcher/expression_path.h b/src/mongo/db/matcher/expression_path.h index 3c4f88269ab..2bddd761a4c 100644 --- a/src/mongo/db/matcher/expression_path.h +++ b/src/mongo/db/matcher/expression_path.h @@ -74,11 +74,11 @@ public: * empty path as well as no path cases. optPath() should be preferred in order to * distinguish between the two. */ - StringData path() const override final { + StringData path() const final { return _elementPath ? _elementPath->fieldRef().dottedField() : ""; } - const FieldRef* fieldRef() const override final { + const FieldRef* fieldRef() const final { return _elementPath ? &(_elementPath->fieldRef()) : nullptr; } diff --git a/src/mongo/db/matcher/expression_text_base.h b/src/mongo/db/matcher/expression_text_base.h index 458479fe9b4..1dee5b420e5 100644 --- a/src/mongo/db/matcher/expression_text_base.h +++ b/src/mongo/db/matcher/expression_text_base.h @@ -63,7 +63,7 @@ public: static const bool kDiacriticSensitiveDefault; explicit TextMatchExpressionBase(StringData path); - virtual ~TextMatchExpressionBase() {} + ~TextMatchExpressionBase() override {} /** * Returns a reference to the parsed text query that this TextMatchExpressionBase owns. diff --git a/src/mongo/db/matcher/expression_tree.h b/src/mongo/db/matcher/expression_tree.h index 9b0c986363e..ea2708e7857 100644 --- a/src/mongo/db/matcher/expression_tree.h +++ b/src/mongo/db/matcher/expression_tree.h @@ -73,7 +73,7 @@ public: _expressions.clear(); } - virtual size_t numChildren() const { + size_t numChildren() const override { return _expressions.size(); } @@ -143,7 +143,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr self = std::make_unique(_errorAnnotation); self->reserve(numChildren()); @@ -156,11 +156,11 @@ public: return self; } - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; - virtual void serialize(BSONObjBuilder* out, - const SerializationOptions& opts = {}, - bool includePath = true) const; + void serialize(BSONObjBuilder* out, + const SerializationOptions& opts = {}, + bool includePath = true) const override; bool isTriviallyTrue() const final; @@ -190,7 +190,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr self = std::make_unique(_errorAnnotation); self->reserve(numChildren()); @@ -203,11 +203,11 @@ public: return self; } - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; - virtual void serialize(BSONObjBuilder* out, - const SerializationOptions& opts = {}, - bool includePath = true) const; + void serialize(BSONObjBuilder* out, + const SerializationOptions& opts = {}, + bool includePath = true) const override; bool isTriviallyFalse() const final; @@ -237,7 +237,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr self = std::make_unique(_errorAnnotation); self->reserve(numChildren()); @@ -250,11 +250,11 @@ public: return self; } - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; - virtual void serialize(BSONObjBuilder* out, - const SerializationOptions& opts = {}, - bool includePath = true) const; + void serialize(BSONObjBuilder* out, + const SerializationOptions& opts = {}, + bool includePath = true) const override; void acceptVisitor(MatchExpressionMutableVisitor* visitor) final { visitor->visit(this); @@ -276,7 +276,7 @@ public: clonable_ptr annotation = nullptr) : MatchExpression(NOT, std::move(annotation)), _exp(std::move(expr)) {} - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { std::unique_ptr self = std::make_unique(_exp->clone(), _errorAnnotation); if (getTag()) { @@ -293,11 +293,11 @@ public: return !_exp->matchesSingleElement(elt, details); } - virtual void debugString(StringBuilder& debug, int indentationLevel = 0) const; + void debugString(StringBuilder& debug, int indentationLevel = 0) const override; - virtual void serialize(BSONObjBuilder* out, - const SerializationOptions& opts = {}, - bool includePath = true) const; + void serialize(BSONObjBuilder* out, + const SerializationOptions& opts = {}, + bool includePath = true) const override; bool equivalent(const MatchExpression* other) const final; @@ -319,7 +319,7 @@ public: return _exp.release(); } - void resetChild(size_t i, MatchExpression* newChild) { + void resetChild(size_t i, MatchExpression* newChild) override { tassert(6329405, "Out-of-bounds access to child of MatchExpression.", i < numChildren()); _exp.reset(newChild); } diff --git a/src/mongo/db/matcher/expression_type.h b/src/mongo/db/matcher/expression_type.h index eab83723f55..54eb28869c0 100644 --- a/src/mongo/db/matcher/expression_type.h +++ b/src/mongo/db/matcher/expression_type.h @@ -84,14 +84,15 @@ public: std::move(annotation)), _typeSet(std::move(typeSet)) {} - virtual ~TypeMatchExpressionBase() = default; + ~TypeMatchExpressionBase() override = default; /** * Returns the name of this MatchExpression. */ virtual StringData name() const = 0; - bool matchesSingleElement(const BSONElement& elem, MatchDetails* details = nullptr) const { + bool matchesSingleElement(const BSONElement& elem, + MatchDetails* details = nullptr) const override { return _typeSet.hasType(elem.type()); } @@ -334,7 +335,7 @@ public: typeSet, std::move(annotation)) {} - StringData name() const { + StringData name() const override { return kName; } @@ -405,7 +406,7 @@ public: std::move(typeSet), std::move(annotation)) {} - StringData name() const { + StringData name() const override { return kName; } diff --git a/src/mongo/db/matcher/expression_where_base.h b/src/mongo/db/matcher/expression_where_base.h index 54f22422f8e..f44beaac7a3 100644 --- a/src/mongo/db/matcher/expression_where_base.h +++ b/src/mongo/db/matcher/expression_where_base.h @@ -65,7 +65,7 @@ public: MONGO_UNREACHABLE_TASSERT(6400211); } - void resetChild(size_t, MatchExpression*) { + void resetChild(size_t, MatchExpression*) override { MONGO_UNREACHABLE; }; diff --git a/src/mongo/db/matcher/extensions_callback_real.h b/src/mongo/db/matcher/extensions_callback_real.h index 95d73909e73..7a8a2d04664 100644 --- a/src/mongo/db/matcher/extensions_callback_real.h +++ b/src/mongo/db/matcher/extensions_callback_real.h @@ -61,7 +61,7 @@ public: */ ExtensionsCallbackReal(OperationContext* opCtx, const NamespaceString* nss); - ~ExtensionsCallbackReal(){}; + ~ExtensionsCallbackReal() override{}; std::unique_ptr createText( TextMatchExpressionBase::TextParams text) const final; diff --git a/src/mongo/db/matcher/matchable.h b/src/mongo/db/matcher/matchable.h index f83006ef757..0fadc86413a 100644 --- a/src/mongo/db/matcher/matchable.h +++ b/src/mongo/db/matcher/matchable.h @@ -82,13 +82,13 @@ public: class BSONMatchableDocument : public MatchableDocument { public: BSONMatchableDocument(const BSONObj& obj); - virtual ~BSONMatchableDocument(); + ~BSONMatchableDocument() override; - virtual BSONObj toBSON() const { + BSONObj toBSON() const override { return _obj; } - virtual ElementIterator* allocateIterator(const ElementPath* path) const { + ElementIterator* allocateIterator(const ElementPath* path) const override { if (_iteratorUsed) return new BSONElementIterator(path, _obj); _iteratorUsed = true; @@ -96,7 +96,7 @@ public: return &_iterator; } - virtual void releaseIterator(ElementIterator* iterator) const { + void releaseIterator(ElementIterator* iterator) const override { if (iterator == &_iterator) { _iteratorUsed = false; } else { diff --git a/src/mongo/db/matcher/path.h b/src/mongo/db/matcher/path.h index 11379d9608d..25ee649b454 100644 --- a/src/mongo/db/matcher/path.h +++ b/src/mongo/db/matcher/path.h @@ -166,12 +166,12 @@ public: _element.reset(e, BSONElement()); } - virtual ~SingleElementElementIterator() {} + ~SingleElementElementIterator() override {} - virtual bool more() { + bool more() override { return !_seen; } - virtual Context next() { + Context next() override { _seen = true; return _element; } @@ -185,8 +185,8 @@ class SimpleArrayElementIterator : public ElementIterator { public: SimpleArrayElementIterator(const BSONElement& theArray, bool returnArrayLast); - virtual bool more(); - virtual Context next(); + bool more() override; + Context next() override; private: BSONElement _theArray; @@ -217,13 +217,13 @@ public: */ BSONElementIterator(const ElementPath* path, const BSONObj& objectToIterate); - virtual ~BSONElementIterator(); + ~BSONElementIterator() override; void reset(const ElementPath* path, size_t suffixIndex, BSONElement elementToIterate); void reset(const ElementPath* path, const BSONObj& objectToIterate); - bool more(); - Context next(); + bool more() override; + Context next() override; private: /** diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.h b/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.h index 4c40ab04dcb..9d8b82f9b94 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.h @@ -116,7 +116,7 @@ public: return _expression->getFilter(); } - void resetChild(size_t i, MatchExpression* other) { + void resetChild(size_t i, MatchExpression* other) override { tassert(6329407, "Out-of-bounds access to child of MatchExpression.", i < kNumChildren); _expression->resetFilter(other); }; diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h index d7648c0a51d..10380ae9515 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h @@ -174,7 +174,7 @@ public: return _patternProperties[i - 1].second->getFilter(); } - virtual void resetChild(size_t i, MatchExpression* other) { + void resetChild(size_t i, MatchExpression* other) override { tassert(6329408, "Out-of-bounds access to child of MatchExpression.", i < numChildren()); if (i == 0) { diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h index dcf9f92d320..e492976e1bb 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h @@ -106,7 +106,7 @@ public: return _expression->getFilter(); } - void resetChild(size_t i, MatchExpression* other) final override { + void resetChild(size_t i, MatchExpression* other) final { tassert(6329409, "Out-of-bounds access to child of MatchExpression.", i < kNumChildren); _expression->resetFilter(other); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h index 55be477166b..5e45cbd8ab6 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h @@ -72,7 +72,7 @@ public: return (elem.embeddedObject().nFields() <= numProperties()); } - virtual std::unique_ptr clone() const final { + std::unique_ptr clone() const final { auto maxProperties = std::make_unique( numProperties(), _errorAnnotation); if (getTag()) { diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h index 4ac09c55ce1..e37664051b8 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h @@ -72,7 +72,7 @@ public: return (elem.embeddedObject().nFields() >= numProperties()); } - virtual std::unique_ptr clone() const final { + std::unique_ptr clone() const final { auto minProperties = std::make_unique( numProperties(), _errorAnnotation); if (getTag()) { diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_num_array_items.h b/src/mongo/db/matcher/schema/expression_internal_schema_num_array_items.h index 85a581fd5d3..afa620fc51b 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_num_array_items.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_num_array_items.h @@ -57,7 +57,7 @@ public: StringData name, clonable_ptr annotation = nullptr); - virtual ~InternalSchemaNumArrayItemsMatchExpression() {} + ~InternalSchemaNumArrayItemsMatchExpression() override {} void debugString(StringBuilder& debug, int indentationLevel) const final; diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_num_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_num_properties.h index b5bebfef701..d5827a12b52 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_num_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_num_properties.h @@ -60,7 +60,7 @@ public: _numProperties(numProperties), _name(name) {} - virtual ~InternalSchemaNumPropertiesMatchExpression() {} + ~InternalSchemaNumPropertiesMatchExpression() override {} size_t numChildren() const final { return 0; diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_object_match.h b/src/mongo/db/matcher/schema/expression_internal_schema_object_match.h index b5d2c667209..db879bea942 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_object_match.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_object_match.h @@ -85,7 +85,7 @@ public: return _sub.get(); } - void resetChild(size_t i, MatchExpression* other) final override { + void resetChild(size_t i, MatchExpression* other) final { tassert(6329410, "Out-of-bounds access to child of MatchExpression.", i < kNumChildren); _sub.reset(other); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.h b/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.h index a6933e40d4f..11d1cf8d42f 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.h @@ -100,7 +100,7 @@ public: MONGO_UNREACHABLE_TASSERT(6400218); } - void resetChild(size_t i, MatchExpression*) final override { + void resetChild(size_t i, MatchExpression*) final { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h b/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h index d42fe5b21a8..b53e08ee6e8 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_str_length.h @@ -58,7 +58,7 @@ public: StringData name, clonable_ptr annotation = nullptr); - virtual ~InternalSchemaStrLengthMatchExpression() {} + ~InternalSchemaStrLengthMatchExpression() override {} virtual Validator getComparator() const = 0; diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h b/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h index e92df51d080..39b8dcfc3f1 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.h @@ -76,7 +76,7 @@ public: MONGO_UNREACHABLE_TASSERT(6400219); } - void resetChild(size_t i, MatchExpression*) final override { + void resetChild(size_t i, MatchExpression*) final { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_xor.h b/src/mongo/db/matcher/schema/expression_internal_schema_xor.h index c58eb9a8814..946e56a8586 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_xor.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_xor.h @@ -72,7 +72,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; - virtual std::unique_ptr clone() const { + std::unique_ptr clone() const override { auto xorCopy = std::make_unique(_errorAnnotation); xorCopy->reserve(numChildren()); for (size_t i = 0; i < numChildren(); ++i) { diff --git a/src/mongo/db/op_observer/batched_write_policy_test.cpp b/src/mongo/db/op_observer/batched_write_policy_test.cpp index 580a43fe1e8..a9813dcd352 100644 --- a/src/mongo/db/op_observer/batched_write_policy_test.cpp +++ b/src/mongo/db/op_observer/batched_write_policy_test.cpp @@ -76,7 +76,7 @@ class CursorMock : public RecordCursor { public: CursorMock(std::deque* records) : _records(records) {} - virtual ~CursorMock() {} + ~CursorMock() override {} boost::optional next() override { if (_records->empty()) { @@ -93,7 +93,7 @@ public: } void detachFromOperationContext() override {} void reattachToOperationContext(OperationContext* opCtx) override {} - void setSaveStorageCursorOnDetachFromOperationContext(bool) {} + void setSaveStorageCursorOnDetachFromOperationContext(bool) override {} private: std::deque* _records; diff --git a/src/mongo/db/op_observer/change_stream_pre_images_op_observer.h b/src/mongo/db/op_observer/change_stream_pre_images_op_observer.h index b056752d685..2ce4fd57348 100644 --- a/src/mongo/db/op_observer/change_stream_pre_images_op_observer.h +++ b/src/mongo/db/op_observer/change_stream_pre_images_op_observer.h @@ -45,7 +45,7 @@ class ChangeStreamPreImagesOpObserver final : public OpObserverNoop { public: ChangeStreamPreImagesOpObserver() = default; - ~ChangeStreamPreImagesOpObserver() = default; + ~ChangeStreamPreImagesOpObserver() override = default; void onUpdate(OperationContext* opCtx, const OplogUpdateEntryArgs& args, diff --git a/src/mongo/db/op_observer/fallback_op_observer.h b/src/mongo/db/op_observer/fallback_op_observer.h index 62b238b85bc..8129cd0818a 100644 --- a/src/mongo/db/op_observer/fallback_op_observer.h +++ b/src/mongo/db/op_observer/fallback_op_observer.h @@ -55,7 +55,7 @@ class FallbackOpObserver final : public OpObserverNoop { public: FallbackOpObserver() = default; - ~FallbackOpObserver() = default; + ~FallbackOpObserver() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfigAndSystem, NamespaceFilter::kConfigAndSystem}; diff --git a/src/mongo/db/op_observer/fcv_op_observer.h b/src/mongo/db/op_observer/fcv_op_observer.h index edff60b313a..8fe707aee73 100644 --- a/src/mongo/db/op_observer/fcv_op_observer.h +++ b/src/mongo/db/op_observer/fcv_op_observer.h @@ -59,7 +59,7 @@ class FcvOpObserver final : public OpObserverNoop { public: FcvOpObserver() = default; - ~FcvOpObserver() = default; + ~FcvOpObserver() override = default; // FcvOpObserver overrides. diff --git a/src/mongo/db/op_observer/find_and_modify_images_op_observer.h b/src/mongo/db/op_observer/find_and_modify_images_op_observer.h index 555d8f0a6b6..a7b24ed7466 100644 --- a/src/mongo/db/op_observer/find_and_modify_images_op_observer.h +++ b/src/mongo/db/op_observer/find_and_modify_images_op_observer.h @@ -43,7 +43,7 @@ class FindAndModifyImagesOpObserver final : public OpObserverNoop { public: FindAndModifyImagesOpObserver() = default; - ~FindAndModifyImagesOpObserver() = default; + ~FindAndModifyImagesOpObserver() override = default; void onUpdate(OperationContext* opCtx, const OplogUpdateEntryArgs& args, diff --git a/src/mongo/db/op_observer/op_observer_impl.h b/src/mongo/db/op_observer/op_observer_impl.h index 8106d789e0f..26273306376 100644 --- a/src/mongo/db/op_observer/op_observer_impl.h +++ b/src/mongo/db/op_observer/op_observer_impl.h @@ -69,7 +69,7 @@ class OpObserverImpl : public OpObserver { public: OpObserverImpl(std::unique_ptr operationLogger); - virtual ~OpObserverImpl() = default; + ~OpObserverImpl() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kAll, NamespaceFilter::kAll}; 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 8b62d92db92..a0a6c8e093f 100644 --- a/src/mongo/db/op_observer/op_observer_impl_test.cpp +++ b/src/mongo/db/op_observer/op_observer_impl_test.cpp @@ -233,7 +233,7 @@ class OpObserverTest : public ServiceContextMongoDTest { protected: explicit OpObserverTest(Options options = {}) : ServiceContextMongoDTest(std::move(options)) {} - virtual void setUp() override { + void setUp() override { // Set up mongod. ServiceContextMongoDTest::setUp(); diff --git a/src/mongo/db/op_observer/op_observer_registry.h b/src/mongo/db/op_observer/op_observer_registry.h index d7a6db0bbb1..47e611da146 100644 --- a/src/mongo/db/op_observer/op_observer_registry.h +++ b/src/mongo/db/op_observer/op_observer_registry.h @@ -74,11 +74,11 @@ class OpObserverRegistry final : public OpObserver { public: OpObserverRegistry(); - virtual ~OpObserverRegistry(); + ~OpObserverRegistry() override; // This implementaton is unused, but needs to be implemented to conform to the OpObserver // interface. - NamespaceFilters getNamespaceFilters() const { + NamespaceFilters getNamespaceFilters() const override { return {NamespaceFilter::kAll, NamespaceFilter::kAll}; } @@ -491,7 +491,7 @@ public: void onEmptyCapped(OperationContext* const opCtx, const NamespaceString& collectionName, - const UUID& uuid) { + const UUID& uuid) override { ReservedTimes times{opCtx}; for (auto& o : _observers) o->onEmptyCapped(opCtx, collectionName, uuid); diff --git a/src/mongo/db/op_observer/op_observer_registry_test.cpp b/src/mongo/db/op_observer/op_observer_registry_test.cpp index 9a65cbad78f..9a03bf1e400 100644 --- a/src/mongo/db/op_observer/op_observer_registry_test.cpp +++ b/src/mongo/db/op_observer/op_observer_registry_test.cpp @@ -51,13 +51,13 @@ struct TestObserver : public OpObserverNoop { TestObserver() { testObservers++; } - virtual ~TestObserver() { + ~TestObserver() override { testObservers--; } int drops = 0; repl::OpTime opTime; - void onDropDatabase(OperationContext* opCtx, const DatabaseName& dbName) { + void onDropDatabase(OperationContext* opCtx, const DatabaseName& dbName) override { drops++; } repl::OpTime onDropCollection(OperationContext* opCtx, @@ -77,7 +77,7 @@ struct TestObserver : public OpObserverNoop { const boost::optional& dropTargetUUID, std::uint64_t numRecords, bool stayTemp, - bool markFromMigrate) { + bool markFromMigrate) override { preRenameCollection(opCtx, fromCollection, toCollection, diff --git a/src/mongo/db/op_observer/operation_logger_impl.h b/src/mongo/db/op_observer/operation_logger_impl.h index fae749897f6..4aafdc4bed4 100644 --- a/src/mongo/db/op_observer/operation_logger_impl.h +++ b/src/mongo/db/op_observer/operation_logger_impl.h @@ -52,7 +52,7 @@ class OperationLoggerImpl : public OperationLogger { public: OperationLoggerImpl() = default; - virtual ~OperationLoggerImpl() = default; + ~OperationLoggerImpl() override = default; void appendOplogEntryChainInfo(OperationContext* opCtx, repl::MutableOplogEntry* oplogEntry, diff --git a/src/mongo/db/op_observer/operation_logger_mock.h b/src/mongo/db/op_observer/operation_logger_mock.h index 11d2eb03cd3..6c64cc377db 100644 --- a/src/mongo/db/op_observer/operation_logger_mock.h +++ b/src/mongo/db/op_observer/operation_logger_mock.h @@ -39,7 +39,7 @@ class OperationLoggerMock : public OperationLogger { public: OperationLoggerMock() = default; - virtual ~OperationLoggerMock() = default; + ~OperationLoggerMock() override = default; void appendOplogEntryChainInfo(OperationContext* opCtx, repl::MutableOplogEntry* oplogEntry, diff --git a/src/mongo/db/op_observer/operation_logger_transaction_proxy.h b/src/mongo/db/op_observer/operation_logger_transaction_proxy.h index a37fa3b068d..dd98416b7a7 100644 --- a/src/mongo/db/op_observer/operation_logger_transaction_proxy.h +++ b/src/mongo/db/op_observer/operation_logger_transaction_proxy.h @@ -58,7 +58,7 @@ class OperationLoggerTransactionProxy : public OperationLogger { public: OperationLoggerTransactionProxy(std::unique_ptr targetOperationLogger); - virtual ~OperationLoggerTransactionProxy() = default; + ~OperationLoggerTransactionProxy() override = default; void appendOplogEntryChainInfo(OperationContext* opCtx, repl::MutableOplogEntry* oplogEntry, diff --git a/src/mongo/db/op_observer/user_write_block_mode_op_observer.h b/src/mongo/db/op_observer/user_write_block_mode_op_observer.h index cb728989ffd..427f1d068a0 100644 --- a/src/mongo/db/op_observer/user_write_block_mode_op_observer.h +++ b/src/mongo/db/op_observer/user_write_block_mode_op_observer.h @@ -60,7 +60,7 @@ class UserWriteBlockModeOpObserver final : public OpObserverNoop { public: UserWriteBlockModeOpObserver() = default; - ~UserWriteBlockModeOpObserver() = default; + ~UserWriteBlockModeOpObserver() override = default; // Operations to check for allowed writes. diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h index 7827b849740..6bbe4db9e36 100644 --- a/src/mongo/db/operation_context.h +++ b/src/mongo/db/operation_context.h @@ -112,7 +112,7 @@ public: * CTOR if possible to avoid OperationId collisions. */ OperationContext(Client* client, OperationId opId); - virtual ~OperationContext(); + ~OperationContext() override; // TODO (SERVER-77213): The RecoveryUnit ownership is being moved to the TransactionResources. // Do not add any new usages to these methods as they will go away and will be folded as an diff --git a/src/mongo/db/operation_context_test.cpp b/src/mongo/db/operation_context_test.cpp index 37dbb6b05e0..00cd7f05e47 100644 --- a/src/mongo/db/operation_context_test.cpp +++ b/src/mongo/db/operation_context_test.cpp @@ -287,7 +287,7 @@ TEST_F(OperationContextTest, CancellationTokenIsCancelableAtFirst) { class OperationDeadlineTests : public OperationContextTest { public: - void setUp() { + void setUp() override { ServiceContext* serviceCtx = getServiceContext(); serviceCtx->setFastClockSource(std::make_unique(mockClock)); serviceCtx->setPreciseClockSource(std::make_unique(mockClock)); diff --git a/src/mongo/db/operation_cpu_timer.cpp b/src/mongo/db/operation_cpu_timer.cpp index 487669f8cb5..ea2b53d3d5c 100644 --- a/src/mongo/db/operation_cpu_timer.cpp +++ b/src/mongo/db/operation_cpu_timer.cpp @@ -82,7 +82,7 @@ MONGO_FAIL_POINT_DEFINE(hangCPUTimerAfterOnThreadDetach); class PosixTimer final : public OperationCPUTimer { public: PosixTimer(const std::shared_ptr& timers) : OperationCPUTimer(timers) {} - ~PosixTimer() = default; + ~PosixTimer() override = default; Nanoseconds getElapsed() const override; diff --git a/src/mongo/db/operation_cpu_timer_test.cpp b/src/mongo/db/operation_cpu_timer_test.cpp index 01deb6226eb..86c85e1be0e 100644 --- a/src/mongo/db/operation_cpu_timer_test.cpp +++ b/src/mongo/db/operation_cpu_timer_test.cpp @@ -73,7 +73,7 @@ public: return getTimers()->makeTimer(); } - void setUp() { + void setUp() override { _opCtx = getGlobalServiceContext()->makeOperationContext(Client::getCurrent()); } diff --git a/src/mongo/db/ops/write_ops_exec_test.cpp b/src/mongo/db/ops/write_ops_exec_test.cpp index 04e0fe2f70f..804fca02b84 100644 --- a/src/mongo/db/ops/write_ops_exec_test.cpp +++ b/src/mongo/db/ops/write_ops_exec_test.cpp @@ -406,7 +406,7 @@ TEST_F(WriteOpsExecTest, PerformAtomicTimeseriesWritesWithTransform) { class OpObserverMock : public OpObserverNoop { public: - virtual ~OpObserverMock() { + ~OpObserverMock() override { ASSERT_FALSE(inBatch); } diff --git a/src/mongo/db/pipeline/abt/abt_fallback_mechanism_cq_bm.cpp b/src/mongo/db/pipeline/abt/abt_fallback_mechanism_cq_bm.cpp index ab7fd63297d..a4d2f4d59d4 100644 --- a/src/mongo/db/pipeline/abt/abt_fallback_mechanism_cq_bm.cpp +++ b/src/mongo/db/pipeline/abt/abt_fallback_mechanism_cq_bm.cpp @@ -50,8 +50,7 @@ class FallBackMechanismCQBenchmark : public BonsaiQueryBenchmarkFixture { public: FallBackMechanismCQBenchmark() {} - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { state.SkipWithError( "Fallback mechanism for CanonicalQuery fixture cannot translate a pieline"); return; @@ -59,7 +58,7 @@ public: void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto nss = NamespaceString::createNamespaceString_forTest("test.bm"); diff --git a/src/mongo/db/pipeline/abt/abt_fallback_mechanism_pipeline_bm.cpp b/src/mongo/db/pipeline/abt/abt_fallback_mechanism_pipeline_bm.cpp index 79094f5eab1..2a31a571ffc 100644 --- a/src/mongo/db/pipeline/abt/abt_fallback_mechanism_pipeline_bm.cpp +++ b/src/mongo/db/pipeline/abt/abt_fallback_mechanism_pipeline_bm.cpp @@ -53,8 +53,7 @@ class FallBackMechanismPipelineBenchmark : public BonsaiQueryBenchmarkFixture { public: FallBackMechanismPipelineBenchmark() {} - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); @@ -75,7 +74,7 @@ public: void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { std::vector pipeline; if (!matchSpec.isEmpty()) { pipeline.push_back(BSON("$match" << matchSpec)); diff --git a/src/mongo/db/pipeline/abt/abt_translate_cq_bm.cpp b/src/mongo/db/pipeline/abt/abt_translate_cq_bm.cpp index 17b4cc1e8af..c236a828b9b 100644 --- a/src/mongo/db/pipeline/abt/abt_translate_cq_bm.cpp +++ b/src/mongo/db/pipeline/abt/abt_translate_cq_bm.cpp @@ -58,15 +58,14 @@ class CanonicalQueryABTTranslate : public BonsaiQueryBenchmarkFixture { public: CanonicalQueryABTTranslate() {} - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { state.SkipWithError("Find translation fixture cannot translate a pipeline"); return; } void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto nss = NamespaceString::createNamespaceString_forTest("test.bm"); diff --git a/src/mongo/db/pipeline/abt/abt_translate_pipeline_bm.cpp b/src/mongo/db/pipeline/abt/abt_translate_pipeline_bm.cpp index de1ea2ec71f..24b4a0babed 100644 --- a/src/mongo/db/pipeline/abt/abt_translate_pipeline_bm.cpp +++ b/src/mongo/db/pipeline/abt/abt_translate_pipeline_bm.cpp @@ -63,7 +63,7 @@ public: void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { std::vector pipeline; if (!matchSpec.isEmpty()) { pipeline.push_back(BSON("$match" << matchSpec)); @@ -74,8 +74,7 @@ public: benchmarkPipeline(state, pipeline); } - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto expCtx = make_intrusive( diff --git a/src/mongo/db/pipeline/abt/agg_expression_visitor.cpp b/src/mongo/db/pipeline/abt/agg_expression_visitor.cpp index 2dbcc34c02b..113bbbbbfdb 100644 --- a/src/mongo/db/pipeline/abt/agg_expression_visitor.cpp +++ b/src/mongo/db/pipeline/abt/agg_expression_visitor.cpp @@ -65,32 +65,32 @@ class ABTAggExpressionVisitor final : public ExpressionConstVisitor { public: ABTAggExpressionVisitor(ExpressionAlgebrizerContext& ctx) : _ctx(ctx){}; - void visit(const ExpressionConstant* expr) override final { + void visit(const ExpressionConstant* expr) final { auto [tag, val] = sbe::value::makeValue(expr->getValue()); _ctx.push(tag, val); } - void visit(const ExpressionAbs* expr) override final { + void visit(const ExpressionAbs* expr) final { pushSingleArgFunctionFromTop("abs"); } - void visit(const ExpressionAdd* expr) override final { + void visit(const ExpressionAdd* expr) final { pushArithmeticBinaryExpr(expr, Operations::Add); } - void visit(const ExpressionAllElementsTrue* expr) override final { + void visit(const ExpressionAllElementsTrue* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionAnd* expr) override final { + void visit(const ExpressionAnd* expr) final { visitMultiBranchLogicExpression(expr, Operations::And); } - void visit(const ExpressionAnyElementTrue* expr) override final { + void visit(const ExpressionAnyElementTrue* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionArray* expr) override final { + void visit(const ExpressionArray* expr) final { const size_t childCount = expr->getChildren().size(); _ctx.ensureArity(childCount); @@ -104,52 +104,52 @@ public: _ctx.push("newArray", std::move(args)); } - void visit(const ExpressionArrayElemAt* expr) override final { + void visit(const ExpressionArrayElemAt* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionBitAnd* expr) override final { + void visit(const ExpressionBitAnd* expr) final { unsupportedExpression("bitAnd"); } - void visit(const ExpressionBitOr* expr) override final { + void visit(const ExpressionBitOr* expr) final { unsupportedExpression("bitOr"); } - void visit(const ExpressionBitXor* expr) override final { + void visit(const ExpressionBitXor* expr) final { unsupportedExpression("bitXor"); } - void visit(const ExpressionBitNot* expr) override final { + void visit(const ExpressionBitNot* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFirst* expr) override final { + void visit(const ExpressionFirst* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionLast* expr) override final { + void visit(const ExpressionLast* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionObjectToArray* expr) override final { + void visit(const ExpressionObjectToArray* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionArrayToObject* expr) override final { + void visit(const ExpressionArrayToObject* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionBsonSize* expr) override final { + void visit(const ExpressionBsonSize* expr) final { pushSingleArgFunctionFromTop("bsonSize"); } - void visit(const ExpressionCeil* expr) override final { + void visit(const ExpressionCeil* expr) final { pushSingleArgFunctionFromTop("ceil"); } - void visit(const ExpressionCoerceToBool* expr) override final { + void visit(const ExpressionCoerceToBool* expr) final { // Since $coerceToBool is internal-only and there are not yet any input expressions that // generate an ExpressionCoerceToBool expression, we will leave it as unreachable for now. MONGO_UNREACHABLE; } - void visit(const ExpressionCompare* expr) override final { + void visit(const ExpressionCompare* expr) final { _ctx.ensureArity(2); ABT right = _ctx.pop(); ABT left = _ctx.pop(); @@ -211,15 +211,15 @@ public: _ctx.push(op, std::move(left), std::move(right)); } - void visit(const ExpressionConcat* expr) override final { + void visit(const ExpressionConcat* expr) final { pushMultiArgFunctionFromTop("concat", expr->getChildren().size()); } - void visit(const ExpressionConcatArrays* expr) override final { + void visit(const ExpressionConcatArrays* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionCond* expr) override final { + void visit(const ExpressionCond* expr) final { _ctx.ensureArity(3); ABT cond = _ctx.pop(); ABT thenCase = _ctx.pop(); @@ -227,39 +227,39 @@ public: _ctx.push(std::move(cond), std::move(thenCase), std::move(elseCase)); } - void visit(const ExpressionDateFromString* expr) override final { + void visit(const ExpressionDateFromString* expr) final { unsupportedExpression("$dateFromString"); } - void visit(const ExpressionDateFromParts* expr) override final { + void visit(const ExpressionDateFromParts* expr) final { unsupportedExpression("$dateFromParts"); } - void visit(const ExpressionDateDiff* expr) override final { + void visit(const ExpressionDateDiff* expr) final { unsupportedExpression("$dateDiff"); } - void visit(const ExpressionDateToParts* expr) override final { + void visit(const ExpressionDateToParts* expr) final { unsupportedExpression("$dateToParts"); } - void visit(const ExpressionDateToString* expr) override final { + void visit(const ExpressionDateToString* expr) final { unsupportedExpression("$dateToString"); } - void visit(const ExpressionDateTrunc* expr) override final { + void visit(const ExpressionDateTrunc* expr) final { unsupportedExpression("$dateTrunc"); } - void visit(const ExpressionDivide* expr) override final { + void visit(const ExpressionDivide* expr) final { pushArithmeticBinaryExpr(expr, Operations::Div); } - void visit(const ExpressionExp* expr) override final { + void visit(const ExpressionExp* expr) final { pushSingleArgFunctionFromTop("exp"); } - void visit(const ExpressionFieldPath* expr) override final { + void visit(const ExpressionFieldPath* expr) final { const auto& varId = expr->getVariableId(); if (Variables::isUserDefinedVariable(varId)) { _ctx.push(generateVariableName(varId)); @@ -295,7 +295,7 @@ public: _ctx.push(std::move(path), make(_ctx.getRootProjection())); } - void visit(const ExpressionFilter* expr) override final { + void visit(const ExpressionFilter* expr) final { const auto& varId = expr->getVariableId(); uassert(6624427, "Filter variable must be user-defined.", @@ -315,79 +315,79 @@ public: std::move(input)); } - void visit(const ExpressionFloor* expr) override final { + void visit(const ExpressionFloor* expr) final { pushSingleArgFunctionFromTop("floor"); } - void visit(const ExpressionIfNull* expr) override final { + void visit(const ExpressionIfNull* expr) final { pushMultiArgFunctionFromTop("ifNull", 2); } - void visit(const ExpressionIn* expr) override final { + void visit(const ExpressionIn* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionIndexOfArray* expr) override final { + void visit(const ExpressionIndexOfArray* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionIndexOfBytes* expr) override final { + void visit(const ExpressionIndexOfBytes* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionIndexOfCP* expr) override final { + void visit(const ExpressionIndexOfCP* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionIsNumber* expr) override final { + void visit(const ExpressionIsNumber* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionLet* expr) override final { + void visit(const ExpressionLet* expr) final { unsupportedExpression("$let"); } - void visit(const ExpressionLn* expr) override final { + void visit(const ExpressionLn* expr) final { pushSingleArgFunctionFromTop("ln"); } - void visit(const ExpressionLog* expr) override final { + void visit(const ExpressionLog* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionLog10* expr) override final { + void visit(const ExpressionLog10* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionInternalFLEEqual* expr) override final { + void visit(const ExpressionInternalFLEEqual* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionInternalFLEBetween* expr) override final { + void visit(const ExpressionInternalFLEBetween* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionMap* expr) override final { + void visit(const ExpressionMap* expr) final { unsupportedExpression("$map"); } - void visit(const ExpressionMeta* expr) override final { + void visit(const ExpressionMeta* expr) final { unsupportedExpression("$meta"); } - void visit(const ExpressionMod* expr) override final { + void visit(const ExpressionMod* expr) final { pushMultiArgFunctionFromTop("mod", 2); } - void visit(const ExpressionMultiply* expr) override final { + void visit(const ExpressionMultiply* expr) final { pushArithmeticBinaryExpr(expr, Operations::Mult); } - void visit(const ExpressionNot* expr) override final { + void visit(const ExpressionNot* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionObject* expr) override final { + void visit(const ExpressionObject* expr) final { const auto& expressions = expr->getChildExpressions(); const size_t childCount = expressions.size(); _ctx.ensureArity(childCount); @@ -414,115 +414,115 @@ public: _ctx.push(tag, val); } - void visit(const ExpressionOr* expr) override final { + void visit(const ExpressionOr* expr) final { visitMultiBranchLogicExpression(expr, Operations::Or); } - void visit(const ExpressionPow* expr) override final { + void visit(const ExpressionPow* expr) final { unsupportedExpression("$pow"); } - void visit(const ExpressionRange* expr) override final { + void visit(const ExpressionRange* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionReduce* expr) override final { + void visit(const ExpressionReduce* expr) final { unsupportedExpression("$reduce"); } - void visit(const ExpressionReplaceOne* expr) override final { + void visit(const ExpressionReplaceOne* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionReplaceAll* expr) override final { + void visit(const ExpressionReplaceAll* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSetDifference* expr) override final { + void visit(const ExpressionSetDifference* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSetEquals* expr) override final { + void visit(const ExpressionSetEquals* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSetIntersection* expr) override final { + void visit(const ExpressionSetIntersection* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSetIsSubset* expr) override final { + void visit(const ExpressionSetIsSubset* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSetUnion* expr) override final { + void visit(const ExpressionSetUnion* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSize* expr) override final { + void visit(const ExpressionSize* expr) final { pushSingleArgFunctionFromTop("getArraySize"); } - void visit(const ExpressionReverseArray* expr) override final { + void visit(const ExpressionReverseArray* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSortArray* expr) override final { + void visit(const ExpressionSortArray* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSlice* expr) override final { + void visit(const ExpressionSlice* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionIsArray* expr) override final { + void visit(const ExpressionIsArray* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionInternalFindAllValuesAtPath* expr) override final { + void visit(const ExpressionInternalFindAllValuesAtPath* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionRound* expr) override final { + void visit(const ExpressionRound* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSplit* expr) override final { + void visit(const ExpressionSplit* expr) final { pushMultiArgFunctionFromTop("split", expr->getChildren().size()); } - void visit(const ExpressionSqrt* expr) override final { + void visit(const ExpressionSqrt* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionStrcasecmp* expr) override final { + void visit(const ExpressionStrcasecmp* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSubstrBytes* expr) override final { + void visit(const ExpressionSubstrBytes* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSubstrCP* expr) override final { + void visit(const ExpressionSubstrCP* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionStrLenBytes* expr) override final { + void visit(const ExpressionStrLenBytes* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionBinarySize* expr) override final { + void visit(const ExpressionBinarySize* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionStrLenCP* expr) override final { + void visit(const ExpressionStrLenCP* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionSubtract* expr) override final { + void visit(const ExpressionSubtract* expr) final { pushArithmeticBinaryExpr(expr, Operations::Sub); } - void visit(const ExpressionSwitch* expr) override final { + void visit(const ExpressionSwitch* expr) final { const size_t arity = expr->getChildren().size(); _ctx.ensureArity(arity); const size_t numCases = (arity - 1) / 2; @@ -540,280 +540,279 @@ public: _ctx.push("switch", std::move(children)); } - void visit(const ExpressionTestApiVersion* expr) override final { + void visit(const ExpressionTestApiVersion* expr) final { unsupportedExpression("$_testApiVersion"); } - void visit(const ExpressionToLower* expr) override final { + void visit(const ExpressionToLower* expr) final { pushSingleArgFunctionFromTop("toLower"); } - void visit(const ExpressionToUpper* expr) override final { + void visit(const ExpressionToUpper* expr) final { pushSingleArgFunctionFromTop("toUpper"); } - void visit(const ExpressionTrim* expr) override final { + void visit(const ExpressionTrim* expr) final { unsupportedExpression("$trim"); } - void visit(const ExpressionTrunc* expr) override final { + void visit(const ExpressionTrunc* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionType* expr) override final { + void visit(const ExpressionType* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionZip* expr) override final { + void visit(const ExpressionZip* expr) final { unsupportedExpression("$zip"); } - void visit(const ExpressionConvert* expr) override final { + void visit(const ExpressionConvert* expr) final { unsupportedExpression("$convert"); } - void visit(const ExpressionRegexFind* expr) override final { + void visit(const ExpressionRegexFind* expr) final { unsupportedExpression("$regexFind"); } - void visit(const ExpressionRegexFindAll* expr) override final { + void visit(const ExpressionRegexFindAll* expr) final { unsupportedExpression("$regexFindAll"); } - void visit(const ExpressionRegexMatch* expr) override final { + void visit(const ExpressionRegexMatch* expr) final { unsupportedExpression("$regexMatch"); } - void visit(const ExpressionCosine* expr) override final { + void visit(const ExpressionCosine* expr) final { pushSingleArgFunctionFromTop("cosine"); } - void visit(const ExpressionSine* expr) override final { + void visit(const ExpressionSine* expr) final { pushSingleArgFunctionFromTop("sine"); } - void visit(const ExpressionTangent* expr) override final { + void visit(const ExpressionTangent* expr) final { pushSingleArgFunctionFromTop("tangent"); } - void visit(const ExpressionArcCosine* expr) override final { + void visit(const ExpressionArcCosine* expr) final { pushSingleArgFunctionFromTop("arcCosine"); } - void visit(const ExpressionArcSine* expr) override final { + void visit(const ExpressionArcSine* expr) final { pushSingleArgFunctionFromTop("arcSine"); } - void visit(const ExpressionArcTangent* expr) override final { + void visit(const ExpressionArcTangent* expr) final { pushSingleArgFunctionFromTop("arcTangent"); } - void visit(const ExpressionArcTangent2* expr) override final { + void visit(const ExpressionArcTangent2* expr) final { pushSingleArgFunctionFromTop("arcTangent2"); } - void visit(const ExpressionHyperbolicArcTangent* expr) override final { + void visit(const ExpressionHyperbolicArcTangent* expr) final { pushSingleArgFunctionFromTop("arcTangentH"); } - void visit(const ExpressionHyperbolicArcCosine* expr) override final { + void visit(const ExpressionHyperbolicArcCosine* expr) final { pushSingleArgFunctionFromTop("arcCosineH"); } - void visit(const ExpressionHyperbolicArcSine* expr) override final { + void visit(const ExpressionHyperbolicArcSine* expr) final { pushSingleArgFunctionFromTop("arcSineH"); } - void visit(const ExpressionHyperbolicTangent* expr) override final { + void visit(const ExpressionHyperbolicTangent* expr) final { pushSingleArgFunctionFromTop("tangentH"); } - void visit(const ExpressionHyperbolicCosine* expr) override final { + void visit(const ExpressionHyperbolicCosine* expr) final { pushSingleArgFunctionFromTop("cosineH"); } - void visit(const ExpressionHyperbolicSine* expr) override final { + void visit(const ExpressionHyperbolicSine* expr) final { pushSingleArgFunctionFromTop("sineH"); } - void visit(const ExpressionDegreesToRadians* expr) override final { + void visit(const ExpressionDegreesToRadians* expr) final { pushSingleArgFunctionFromTop("degreesToRadians"); } - void visit(const ExpressionRadiansToDegrees* expr) override final { + void visit(const ExpressionRadiansToDegrees* expr) final { pushSingleArgFunctionFromTop("radiansToDegrees"); } - void visit(const ExpressionDayOfMonth* expr) override final { + void visit(const ExpressionDayOfMonth* expr) final { unsupportedExpression("$dayOfMonth"); } - void visit(const ExpressionDayOfWeek* expr) override final { + void visit(const ExpressionDayOfWeek* expr) final { unsupportedExpression("$dayOfWeek"); } - void visit(const ExpressionDayOfYear* expr) override final { + void visit(const ExpressionDayOfYear* expr) final { unsupportedExpression("$dayOfYear"); } - void visit(const ExpressionHour* expr) override final { + void visit(const ExpressionHour* expr) final { unsupportedExpression("$hour"); } - void visit(const ExpressionMillisecond* expr) override final { + void visit(const ExpressionMillisecond* expr) final { unsupportedExpression("$millisecond"); } - void visit(const ExpressionMinute* expr) override final { + void visit(const ExpressionMinute* expr) final { unsupportedExpression("$minute"); } - void visit(const ExpressionMonth* expr) override final { + void visit(const ExpressionMonth* expr) final { unsupportedExpression("$month"); } - void visit(const ExpressionSecond* expr) override final { + void visit(const ExpressionSecond* expr) final { unsupportedExpression("$second"); } - void visit(const ExpressionWeek* expr) override final { + void visit(const ExpressionWeek* expr) final { unsupportedExpression("$week"); } - void visit(const ExpressionIsoWeekYear* expr) override final { + void visit(const ExpressionIsoWeekYear* expr) final { unsupportedExpression("$isoWeekYear"); } - void visit(const ExpressionIsoDayOfWeek* expr) override final { + void visit(const ExpressionIsoDayOfWeek* expr) final { unsupportedExpression("$isoDayOfWeek"); } - void visit(const ExpressionIsoWeek* expr) override final { + void visit(const ExpressionIsoWeek* expr) final { unsupportedExpression("$isoWeek"); } - void visit(const ExpressionYear* expr) override final { + void visit(const ExpressionYear* expr) final { unsupportedExpression("$year"); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulatorQuantile* expr) override final { + void visit(const ExpressionFromAccumulatorQuantile* expr) final { unsupportedExpression(expr->getOpName()); } - void visit( - const ExpressionFromAccumulatorQuantile* expr) override final { + void visit(const ExpressionFromAccumulatorQuantile* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionTests::Testable* expr) override final { + void visit(const ExpressionTests::Testable* expr) final { unsupportedExpression("$test"); } - void visit(const ExpressionInternalJsEmit* expr) override final { + void visit(const ExpressionInternalJsEmit* expr) final { unsupportedExpression("$internalJsEmit"); } - void visit(const ExpressionInternalFindSlice* expr) override final { + void visit(const ExpressionInternalFindSlice* expr) final { unsupportedExpression("$internalFindSlice"); } - void visit(const ExpressionInternalFindPositional* expr) override final { + void visit(const ExpressionInternalFindPositional* expr) final { unsupportedExpression("$internalFindPositional"); } - void visit(const ExpressionInternalFindElemMatch* expr) override final { + void visit(const ExpressionInternalFindElemMatch* expr) final { unsupportedExpression("$internalFindElemMatch"); } - void visit(const ExpressionFunction* expr) override final { + void visit(const ExpressionFunction* expr) final { unsupportedExpression("$function"); } - void visit(const ExpressionRandom* expr) override final { + void visit(const ExpressionRandom* expr) final { unsupportedExpression(expr->getOpName()); } - void visit(const ExpressionToHashedIndexKey* expr) override final { + void visit(const ExpressionToHashedIndexKey* expr) final { unsupportedExpression("$toHashedIndexKey"); } - void visit(const ExpressionDateAdd* expr) override final { + void visit(const ExpressionDateAdd* expr) final { unsupportedExpression("dateAdd"); } - void visit(const ExpressionDateSubtract* expr) override final { + void visit(const ExpressionDateSubtract* expr) final { unsupportedExpression("dateSubtract"); } - void visit(const ExpressionSetField* expr) override final { + void visit(const ExpressionSetField* expr) final { unsupportedExpression("$setField"); } - void visit(const ExpressionGetField* expr) override final { + void visit(const ExpressionGetField* expr) final { unsupportedExpression("$getField"); } - void visit(const ExpressionTsSecond* expr) override final { + void visit(const ExpressionTsSecond* expr) final { unsupportedExpression("tsSecond"); } - void visit(const ExpressionTsIncrement* expr) override final { + void visit(const ExpressionTsIncrement* expr) final { unsupportedExpression("tsIncrement"); } - void visit(const ExpressionInternalOwningShard* expr) override final { + void visit(const ExpressionInternalOwningShard* expr) final { unsupportedExpression("$_internalOwningShard"); } - void visit(const ExpressionInternalIndexKey* expr) override final { + void visit(const ExpressionInternalIndexKey* expr) final { unsupportedExpression("$_internalIndexKey"); } - void visit(const ExpressionInternalKeyStringValue* expr) override final { + void visit(const ExpressionInternalKeyStringValue* expr) final { unsupportedExpression(expr->getOpName()); } diff --git a/src/mongo/db/pipeline/accumulator_for_window_functions.h b/src/mongo/db/pipeline/accumulator_for_window_functions.h index b5c3b82af75..726e941435b 100644 --- a/src/mongo/db/pipeline/accumulator_for_window_functions.h +++ b/src/mongo/db/pipeline/accumulator_for_window_functions.h @@ -96,7 +96,7 @@ public: class AccumulatorRankBase : public AccumulatorForWindowFunctions { public: explicit AccumulatorRankBase(ExpressionContext* expCtx, bool isAscending); - void reset(); + void reset() override; Value getValue(bool toBeMerged) final { return Value::createIntOrLong(_lastRank); diff --git a/src/mongo/db/pipeline/accumulator_js_reduce.h b/src/mongo/db/pipeline/accumulator_js_reduce.h index 0b4514cba74..44f6017229e 100644 --- a/src/mongo/db/pipeline/accumulator_js_reduce.h +++ b/src/mongo/db/pipeline/accumulator_js_reduce.h @@ -77,9 +77,9 @@ public: void reset() final; - virtual Document serialize(boost::intrusive_ptr initializer, - boost::intrusive_ptr argument, - const SerializationOptions& options = {}) const override; + Document serialize(boost::intrusive_ptr initializer, + boost::intrusive_ptr argument, + const SerializationOptions& options = {}) const override; private: static std::string parseReduceFunction(BSONElement func); diff --git a/src/mongo/db/pipeline/accumulator_multi.h b/src/mongo/db/pipeline/accumulator_multi.h index f4567c36327..3ca506738e4 100644 --- a/src/mongo/db/pipeline/accumulator_multi.h +++ b/src/mongo/db/pipeline/accumulator_multi.h @@ -186,7 +186,7 @@ public: static const char* getName(); - AccumulatorType getAccumulatorType() const { + AccumulatorType getAccumulatorType() const override { return AccumulatorType::kMinN; } @@ -381,7 +381,7 @@ public: private: // top/bottom/topN/bottomN do NOT ignore null values, but MISSING values will be promoted to // null so the users see them. - void _processValue(const Value& val); + void _processValue(const Value& val) override; std::pair _genKeyOutPair(const Value& val); diff --git a/src/mongo/db/pipeline/accumulator_percentile.h b/src/mongo/db/pipeline/accumulator_percentile.h index 30447daffce..ebc036a4d05 100644 --- a/src/mongo/db/pipeline/accumulator_percentile.h +++ b/src/mongo/db/pipeline/accumulator_percentile.h @@ -59,7 +59,7 @@ public: static constexpr auto kDiscrete = "discrete"_sd; static constexpr auto kName = "$percentile"_sd; - const char* getOpName() const { + const char* getOpName() const override { return kName.rawData(); } @@ -97,7 +97,7 @@ public: * Ingressing values and computing the requested percentiles. */ void processInternal(const Value& input, bool merging) final; - Value getValue(bool toBeMerged); + Value getValue(bool toBeMerged) override; /** * Other infra for the accumulators. @@ -117,7 +117,7 @@ public: */ Document serialize(boost::intrusive_ptr initializer, boost::intrusive_ptr argument, - const SerializationOptions& options) const; + const SerializationOptions& options) const override; /** * Helper that allows both the accumulator and expression $percentile to serialize their @@ -185,7 +185,7 @@ public: Document serialize(boost::intrusive_ptr initializer, boost::intrusive_ptr argument, - const SerializationOptions& options) const; + const SerializationOptions& options) const override; /** * Helper that allows both the accumulator and expression $median to serialize their diff --git a/src/mongo/db/pipeline/change_stream_expired_pre_image_remover.cpp b/src/mongo/db/pipeline/change_stream_expired_pre_image_remover.cpp index 74dba0d57a9..a45167400f0 100644 --- a/src/mongo/db/pipeline/change_stream_expired_pre_image_remover.cpp +++ b/src/mongo/db/pipeline/change_stream_expired_pre_image_remover.cpp @@ -96,11 +96,11 @@ public: changeStreamExpiredPreImagesRemover = std::move(preImagesRemover); } - std::string name() const { + std::string name() const override { return "ChangeStreamExpiredPreImagesRemover"; } - void run() { + void run() override { LOGV2(7080100, "Starting Change Stream Expired Pre-images Remover thread"); ThreadClient tc(name(), getGlobalServiceContext()->getService(ClusterRole::ShardServer)); diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index 38412417e7e..d634f0c1842 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -342,7 +342,7 @@ public: }; }; - virtual ~DocumentSource() {} + ~DocumentSource() override {} /** * Makes a deep clone of the DocumentSource by serializing and re-parsing it. DocumentSources diff --git a/src/mongo/db/pipeline/document_source_bucket_auto.h b/src/mongo/db/pipeline/document_source_bucket_auto.h index 2684cee6647..3b0703d5ff4 100644 --- a/src/mongo/db/pipeline/document_source_bucket_auto.h +++ b/src/mongo/db/pipeline/document_source_bucket_auto.h @@ -70,7 +70,7 @@ namespace mongo { class DocumentSourceBucketAuto final : public DocumentSource { public: static constexpr StringData kStageName = "$bucketAuto"_sd; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; DepsTracker::State getDependencies(DepsTracker* deps) const final; diff --git a/src/mongo/db/pipeline/document_source_change_stream.h b/src/mongo/db/pipeline/document_source_change_stream.h index d7b41ade304..9099f8cfa56 100644 --- a/src/mongo/db/pipeline/document_source_change_stream.h +++ b/src/mongo/db/pipeline/document_source_change_stream.h @@ -116,7 +116,7 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { // Change streams require "majority" readConcern. If the client did not specify an // explicit readConcern, change streams will internally upconvert the readConcern to // majority (so clients can always send aggregations without readConcern). We therefore @@ -125,7 +125,7 @@ public: kStageName, repl::ReadConcernLevel::kMajorityReadConcern, level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } @@ -364,8 +364,7 @@ public: _privileges({Privilege(ResourcePattern::forClusterResource(_nss.tenantId()), ActionType::internal)}) {} - PrivilegeVector requiredPrivileges(bool isMongos, - bool bypassDocumentValidation) const override final { + PrivilegeVector requiredPrivileges(bool isMongos, bool bypassDocumentValidation) const final { return _privileges; } diff --git a/src/mongo/db/pipeline/document_source_change_stream_add_post_image.h b/src/mongo/db/pipeline/document_source_change_stream_add_post_image.h index 848806d3395..5b11c7ec43f 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_add_post_image.h +++ b/src/mongo/db/pipeline/document_source_change_stream_add_post_image.h @@ -113,7 +113,7 @@ public: return boost::none; } - DepsTracker::State getDependencies(DepsTracker* deps) const { + DepsTracker::State getDependencies(DepsTracker* deps) const override { // The namespace is not technically needed yet, but we will if there is more than one // collection involved. deps->fields.insert(DocumentSourceChangeStream::kNamespaceField.toString()); @@ -136,7 +136,7 @@ public: void addVariableRefs(std::set* refs) const final {} - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; const char* getSourceName() const final { return kStageName.rawData(); diff --git a/src/mongo/db/pipeline/document_source_change_stream_add_pre_image.h b/src/mongo/db/pipeline/document_source_change_stream_add_pre_image.h index e3cf14b2571..4853be87aee 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_add_pre_image.h +++ b/src/mongo/db/pipeline/document_source_change_stream_add_pre_image.h @@ -119,7 +119,7 @@ public: return boost::none; } - DepsTracker::State getDependencies(DepsTracker* deps) const { + DepsTracker::State getDependencies(DepsTracker* deps) const override { deps->fields.insert(DocumentSourceChangeStream::kPreImageIdField.toString()); // This stage does not restrict the output fields to a finite set, and has no impact on // whether metadata is available or needed. @@ -128,7 +128,7 @@ public: void addVariableRefs(std::set* refs) const final {} - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; const char* getSourceName() const final { return kStageName.rawData(); diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h b/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h index 71711972c4f..39ff532986b 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h +++ b/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h @@ -84,7 +84,7 @@ public: return boost::none; } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h b/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h index b59b55d11dd..ac8380d8086 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h +++ b/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h @@ -81,7 +81,7 @@ public: return boost::none; } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h b/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h index f657d8784f0..73c650d4825 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h +++ b/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h @@ -66,7 +66,7 @@ public: const boost::intrusive_ptr& expCtx, const DocumentSourceChangeStreamSpec& spec); - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; private: /** diff --git a/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h b/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h index b07ceb0610e..441b0d9db7c 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h +++ b/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h @@ -81,7 +81,7 @@ public: return kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState) const final; diff --git a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.h b/src/mongo/db/pipeline/document_source_change_stream_oplog_match.h index 96d372b781b..7c2d93d7206 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.h +++ b/src/mongo/db/pipeline/document_source_change_stream_oplog_match.h @@ -94,7 +94,7 @@ public: StageConstraints constraints(Pipeline::SplitState pipeState) const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; protected: Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, diff --git a/src/mongo/db/pipeline/document_source_change_stream_split_large_event.h b/src/mongo/db/pipeline/document_source_change_stream_split_large_event.h index 2e7518d58b2..a88f8dda60d 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_split_large_event.h +++ b/src/mongo/db/pipeline/document_source_change_stream_split_large_event.h @@ -71,7 +71,7 @@ public: // This stage does not reference any user or system variables. void addVariableRefs(std::set* refs) const final {} - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; diff --git a/src/mongo/db/pipeline/document_source_change_stream_test.cpp b/src/mongo/db/pipeline/document_source_change_stream_test.cpp index 661cf700bcb..66fdea10a84 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_test.cpp +++ b/src/mongo/db/pipeline/document_source_change_stream_test.cpp @@ -167,7 +167,7 @@ struct MockMongoInterface final : public StubMongoProcessInterface { // For tests of transactions that involve multiple oplog entries. std::unique_ptr createTransactionHistoryIterator( - repl::OpTime time) const { + repl::OpTime time) const override { auto iterator = std::make_unique(); // Simulate a lookup on the oplog timestamp by manually advancing the iterator until we @@ -185,7 +185,7 @@ struct MockMongoInterface final : public StubMongoProcessInterface { // Called by DocumentSourceAddPreImage to obtain the UUID of the oplog. Since that's the only // piece of collection info we need for now, just return a BSONObj with the mock oplog UUID. - BSONObj getCollectionOptions(OperationContext* opCtx, const NamespaceString& nss) { + BSONObj getCollectionOptions(OperationContext* opCtx, const NamespaceString& nss) override { return BSON("uuid" << oplogUuid()); } diff --git a/src/mongo/db/pipeline/document_source_change_stream_transform.h b/src/mongo/db/pipeline/document_source_change_stream_transform.h index a1bcc60d280..c838e7d8af1 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_transform.h +++ b/src/mongo/db/pipeline/document_source_change_stream_transform.h @@ -73,7 +73,7 @@ public: DocumentSource::GetModPathsReturn getModifiedPaths() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h index 09bcd716538..3794295359d 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h +++ b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h @@ -88,7 +88,7 @@ public: DocumentSource::GetModPathsReturn getModifiedPaths() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; @@ -96,7 +96,7 @@ public: return boost::none; } - const char* getSourceName() const { + const char* getSourceName() const override { return DocumentSourceChangeStreamUnwindTransaction::kStageName.rawData(); } diff --git a/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp b/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp index 0af0907562e..7b8532f87a4 100644 --- a/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp +++ b/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp @@ -102,7 +102,7 @@ class ChangeStreamOplogCursorMock : public SeekableRecordCursor { public: ChangeStreamOplogCursorMock(std::list* records) : _records(records) {} - virtual ~ChangeStreamOplogCursorMock() {} + ~ChangeStreamOplogCursorMock() override {} boost::optional next() override { if (_records->empty()) { @@ -152,7 +152,7 @@ public: } void detachFromOperationContext() override {} void reattachToOperationContext(OperationContext* opCtx) override {} - void setSaveStorageCursorOnDetachFromOperationContext(bool) {} + void setSaveStorageCursorOnDetachFromOperationContext(bool) override {} private: bool _initialized = false; diff --git a/src/mongo/db/pipeline/document_source_coll_stats.h b/src/mongo/db/pipeline/document_source_coll_stats.h index 05ec6218231..8d7a2eb9069 100644 --- a/src/mongo/db/pipeline/document_source_coll_stats.h +++ b/src/mongo/db/pipeline/document_source_coll_stats.h @@ -100,7 +100,7 @@ public: return {Privilege(ResourcePattern::forExactNamespace(_nss), ActionType::collStats)}; } - void assertPermittedInAPIVersion(const APIParameters&) const; + void assertPermittedInAPIVersion(const APIParameters&) const override; stdx::unordered_set getInvolvedNamespaces() const final { return stdx::unordered_set(); @@ -144,7 +144,7 @@ public: return boost::none; } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_current_op.h b/src/mongo/db/pipeline/document_source_current_op.h index f547135b2be..a8bb2f8d992 100644 --- a/src/mongo/db/pipeline/document_source_current_op.h +++ b/src/mongo/db/pipeline/document_source_current_op.h @@ -120,11 +120,11 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { return onlyReadConcernLocalSupported(kStageName, level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } @@ -180,7 +180,7 @@ public: static boost::intrusive_ptr createFromBson( BSONElement spec, const boost::intrusive_ptr& pExpCtx); - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_current_op_test.cpp b/src/mongo/db/pipeline/document_source_current_op_test.cpp index eae5411bd01..6a5c551076f 100644 --- a/src/mongo/db/pipeline/document_source_current_op_test.cpp +++ b/src/mongo/db/pipeline/document_source_current_op_test.cpp @@ -84,11 +84,11 @@ public: CurrentOpUserMode userMode, CurrentOpTruncateMode truncateMode, CurrentOpCursorMode cursorMode, - CurrentOpBacktraceMode backtraceMode) const { + CurrentOpBacktraceMode backtraceMode) const override { return _ops; } - std::string getShardName(OperationContext* opCtx) const { + std::string getShardName(OperationContext* opCtx) const override { if (_hasShardName) { return kMockShardName; } diff --git a/src/mongo/db/pipeline/document_source_cursor.h b/src/mongo/db/pipeline/document_source_cursor.h index 37ea0818962..dc9980a8525 100644 --- a/src/mongo/db/pipeline/document_source_cursor.h +++ b/src/mongo/db/pipeline/document_source_cursor.h @@ -105,7 +105,7 @@ public: const char* getSourceName() const override; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { StageConstraints constraints(StreamType::kStreaming, @@ -184,7 +184,7 @@ protected: GetNextResult doGetNext() final; - ~DocumentSourceCursor(); + ~DocumentSourceCursor() override; /** * Disposes of '_exec' if it hasn't been disposed already. This involves taking a collection diff --git a/src/mongo/db/pipeline/document_source_densify.h b/src/mongo/db/pipeline/document_source_densify.h index 28c7b752c9c..6c3ecca8a62 100644 --- a/src/mongo/db/pipeline/document_source_densify.h +++ b/src/mongo/db/pipeline/document_source_densify.h @@ -420,7 +420,7 @@ public: return kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; DepsTracker::State getDependencies(DepsTracker* deps) const final { deps->fields.insert(_field.fullPath()); diff --git a/src/mongo/db/pipeline/document_source_exchange.h b/src/mongo/db/pipeline/document_source_exchange.h index 424c9a4b0c1..52604ecc2ac 100644 --- a/src/mongo/db/pipeline/document_source_exchange.h +++ b/src/mongo/db/pipeline/document_source_exchange.h @@ -245,7 +245,7 @@ public: const char* getSourceName() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; /** * DocumentSourceExchange does not have a direct source (it is reading through the shared diff --git a/src/mongo/db/pipeline/document_source_exchange_test.cpp b/src/mongo/db/pipeline/document_source_exchange_test.cpp index d3f99f069bf..632cc765663 100644 --- a/src/mongo/db/pipeline/document_source_exchange_test.cpp +++ b/src/mongo/db/pipeline/document_source_exchange_test.cpp @@ -109,7 +109,7 @@ const NamespaceString kTestNss = class DocumentSourceExchangeTest : public AggregationContextFixture { protected: std::unique_ptr _executor; - virtual void setUp() override { + void setUp() override { getExpCtx()->mongoProcessInterface = std::make_shared(); auto net = executor::makeNetworkInterface("ExchangeTest"); @@ -122,7 +122,7 @@ protected: _executor->startup(); } - virtual void tearDown() override { + void tearDown() override { _executor->shutdown(); _executor.reset(); } diff --git a/src/mongo/db/pipeline/document_source_facet.h b/src/mongo/db/pipeline/document_source_facet.h index 108b516d4be..df5338500e1 100644 --- a/src/mongo/db/pipeline/document_source_facet.h +++ b/src/mongo/db/pipeline/document_source_facet.h @@ -104,7 +104,7 @@ public: std::move(parseTimeName), boost::none, std::move(pipelines)) {} PrivilegeVector requiredPrivileges(bool isMongos, - bool bypassDocumentValidation) const override final { + bool bypassDocumentValidation) const final { PrivilegeVector requiredPrivileges; for (auto&& pipeline : _pipelines) { Privilege::addPrivilegesToPrivilegeVector( @@ -187,7 +187,7 @@ private: size_t bufferSizeBytes, size_t maxOutputDocBytes); - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::intrusive_ptr _teeBuffer; std::vector _facets; diff --git a/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup.h b/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup.h index 0e4f89ee5cf..51bfaec3b20 100644 --- a/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup.h +++ b/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup.h @@ -78,7 +78,7 @@ public: DocumentSource::GetModPathsReturn getModifiedPaths() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; @@ -86,7 +86,7 @@ public: return boost::none; } - const char* getSourceName() const { + const char* getSourceName() const override { return DocumentSourceFindAndModifyImageLookup::kStageName.rawData(); } diff --git a/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup_test.cpp b/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup_test.cpp index 759efedb581..4cf6ea07ff7 100644 --- a/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup_test.cpp +++ b/src/mongo/db/pipeline/document_source_find_and_modify_image_lookup_test.cpp @@ -121,7 +121,7 @@ struct MockMongoInterface final : public StubMongoProcessInterface { MockMongoInterface(std::vector documentsForLookup = {}) : _documentsForLookup{std::move(documentsForLookup)} {} - BSONObj getCollectionOptions(OperationContext* opCtx, const NamespaceString& nss) { + BSONObj getCollectionOptions(OperationContext* opCtx, const NamespaceString& nss) override { static const UUID* oplog_uuid = new UUID(UUID::gen()); return BSON("uuid" << *oplog_uuid); } diff --git a/src/mongo/db/pipeline/document_source_geo_near.h b/src/mongo/db/pipeline/document_source_geo_near.h index 05330e51207..d8f0bc1b742 100644 --- a/src/mongo/db/pipeline/document_source_geo_near.h +++ b/src/mongo/db/pipeline/document_source_geo_near.h @@ -101,7 +101,7 @@ public: MONGO_UNREACHABLE; } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::intrusive_ptr optimize() final; diff --git a/src/mongo/db/pipeline/document_source_geo_near_cursor.h b/src/mongo/db/pipeline/document_source_geo_near_cursor.h index 1c9e2b79ae5..8c143a45ed0 100644 --- a/src/mongo/db/pipeline/document_source_geo_near_cursor.h +++ b/src/mongo/db/pipeline/document_source_geo_near_cursor.h @@ -82,12 +82,12 @@ private: boost::optional locationField, double distanceMultiplier); - ~DocumentSourceGeoNearCursor() = default; + ~DocumentSourceGeoNearCursor() override = default; /** * Transforms 'obj' into a Document, calculating the distance. */ - Document transformDoc(Document&& obj) const override final; + Document transformDoc(Document&& obj) const final; // The output field in which to store the computed distance. FieldPath _distanceField; diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.h b/src/mongo/db/pipeline/document_source_graph_lookup.h index 999afd49b9e..93286bec8bc 100644 --- a/src/mongo/db/pipeline/document_source_graph_lookup.h +++ b/src/mongo/db/pipeline/document_source_graph_lookup.h @@ -100,7 +100,8 @@ public: "Sharded $graphLookup is not allowed within a multi-document transaction"); } - PrivilegeVector requiredPrivileges(bool isMongos, bool bypassDocumentValidation) const { + PrivilegeVector requiredPrivileges(bool isMongos, + bool bypassDocumentValidation) const override { return {Privilege(ResourcePattern::forExactNamespace(_foreignNss), ActionType::find)}; } }; @@ -141,9 +142,8 @@ public: _additionalFilter = additionalFilter ? additionalFilter->getOwned() : additionalFilter; }; - void serializeToArray( - std::vector& array, - const SerializationOptions& opts = SerializationOptions{}) const final override; + void serializeToArray(std::vector& array, + const SerializationOptions& opts = SerializationOptions{}) const final; /** * Returns the 'as' path, and possibly the fields modified by an absorbed $unwind. @@ -217,8 +217,7 @@ private: boost::optional maxDepth, boost::optional> unwindSrc); - Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { // Should not be called; use serializeToArray instead. MONGO_UNREACHABLE_TASSERT(7484306); } diff --git a/src/mongo/db/pipeline/document_source_group_base.h b/src/mongo/db/pipeline/document_source_group_base.h index f85e2a5106c..fe6d2bc8e47 100644 --- a/src/mongo/db/pipeline/document_source_group_base.h +++ b/src/mongo/db/pipeline/document_source_group_base.h @@ -81,7 +81,7 @@ public: using Accumulators = std::vector>; using GroupsMap = ValueUnorderedMap; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::intrusive_ptr optimize() final; DepsTracker::State getDependencies(DepsTracker* deps) const final; void addVariableRefs(std::set* refs) const final; @@ -209,7 +209,7 @@ protected: const boost::intrusive_ptr& expCtx, boost::optional maxMemoryUsageBytes = boost::none); - virtual ~DocumentSourceGroupBase(); + ~DocumentSourceGroupBase() override; void initializeFromBson(BSONElement elem); virtual bool isSpecFieldReserved(StringData fieldName) = 0; diff --git a/src/mongo/db/pipeline/document_source_group_test.cpp b/src/mongo/db/pipeline/document_source_group_test.cpp index 62fbfaebb1b..2d76b61bb0e 100644 --- a/src/mongo/db/pipeline/document_source_group_test.cpp +++ b/src/mongo/db/pipeline/document_source_group_test.cpp @@ -463,7 +463,7 @@ private: class ParseErrorBase : public Base { public: - virtual ~ParseErrorBase() {} + ~ParseErrorBase() override {} void _doTest() final { ASSERT_THROWS(createGroup(spec()), AssertionException); } @@ -474,7 +474,7 @@ protected: class ExpressionBase : public Base { public: - virtual ~ExpressionBase() {} + ~ExpressionBase() override {} void _doTest() final { createGroup(spec()); auto source = DocumentSourceMock::createForTest(Document(doc()), ctx()); @@ -493,10 +493,10 @@ protected: }; class IdConstantBase : public ExpressionBase { - virtual BSONObj doc() { + BSONObj doc() override { return BSONObj(); } - virtual BSONObj expected() { + BSONObj expected() override { // Since spec() specifies a constant _id, its value will be passed through. return spec(); } @@ -514,49 +514,49 @@ public: /** $group spec is an empty object. */ class EmptySpec : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSONObj(); } }; /** $group _id is an empty object. */ class IdEmptyObject : public IdConstantBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << BSONObj()); } }; /** $group _id is computed from an object expression. */ class IdObjectExpression : public ExpressionBase { - BSONObj doc() { + BSONObj doc() override { return BSON("a" << 6); } - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << BSON("z" << "$a")); } - BSONObj expected() { + BSONObj expected() override { return BSON("_id" << BSON("z" << 6)); } }; /** $group _id is specified as an invalid object expression. */ class IdInvalidObjectExpression : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << BSON("$add" << 1 << "$and" << 1)); } }; /** $group with two _id specs. */ class TwoIdSpecs : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "_id" << 2); } }; /** $group _id is the empty string. */ class IdEmptyString : public IdConstantBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << ""); } @@ -564,7 +564,7 @@ class IdEmptyString : public IdConstantBase { /** $group _id is a std::string constant. */ class IdStringConstant : public IdConstantBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << "abc"); } @@ -572,21 +572,21 @@ class IdStringConstant : public IdConstantBase { /** $group _id is a field path expression. */ class IdFieldPath : public ExpressionBase { - BSONObj doc() { + BSONObj doc() override { return BSON("a" << 5); } - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << "$a"); } - BSONObj expected() { + BSONObj expected() override { return BSON("_id" << 5); } }; /** $group with _id set to an invalid field path. */ class IdInvalidFieldPath : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << "$a.."); } @@ -594,106 +594,106 @@ class IdInvalidFieldPath : public ParseErrorBase { /** $group _id is a numeric constant. */ class IdNumericConstant : public IdConstantBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 2); } }; /** $group _id is an array constant. */ class IdArrayConstant : public IdConstantBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << BSON_ARRAY(1 << 2)); } }; /** $group _id is a regular expression (not supported). */ class IdRegularExpression : public IdConstantBase { - BSONObj spec() { + BSONObj spec() override { return fromjson("{_id:/a/}"); } }; /** The name of an aggregate field is specified with a $ prefix. */ class DollarAggregateFieldName : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "$foo" << BSON("$sum" << 1)); } }; /** An aggregate field spec that is not an object. */ class NonObjectAggregateSpec : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "a" << 1); } }; /** An aggregate field spec that is not an object. */ class EmptyObjectAggregateSpec : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "a" << BSONObj()); } }; /** An aggregate field spec with an invalid accumulator operator. */ class BadAccumulator : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "a" << BSON("$bad" << 1)); } }; /** An aggregate field spec with an array argument. */ class SumArray : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "a" << BSON("$sum" << BSONArray())); } }; /** Multiple accumulator operators for a field. */ class MultipleAccumulatorsForAField : public ParseErrorBase { - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 1 << "a" << BSON("$sum" << 1 << "$push" << 1)); } }; /** Aggregation using duplicate field names is allowed currently. */ class DuplicateAggregateFieldNames : public ExpressionBase { - BSONObj doc() { + BSONObj doc() override { return BSONObj(); } - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 0 << "z" << BSON("$sum" << 1) << "z" << BSON("$push" << 1)); } - BSONObj expected() { + BSONObj expected() override { return BSON("_id" << 0 << "z" << 1 << "z" << BSON_ARRAY(1)); } }; /** Aggregate the value of an object expression. */ class AggregateObjectExpression : public ExpressionBase { - BSONObj doc() { + BSONObj doc() override { return BSON("a" << 6); } - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 0 << "z" << BSON("$first" << BSON("x" << "$a"))); } - BSONObj expected() { + BSONObj expected() override { return BSON("_id" << 0 << "z" << BSON("x" << 6)); } }; /** Aggregate the value of an operator expression. */ class AggregateOperatorExpression : public ExpressionBase { - BSONObj doc() { + BSONObj doc() override { return BSON("a" << 6); } - BSONObj spec() { + BSONObj spec() override { return BSON("_id" << 0 << "z" << BSON("$first" << "$a")); } - BSONObj expected() { + BSONObj expected() override { return BSON("_id" << 0 << "z" << 6); } }; @@ -709,7 +709,7 @@ class CheckResultsBase : public Base { public: CheckResultsBase(GroupStageType groupStageType = GroupStageType::Default) : Base(groupStageType) {} - virtual ~CheckResultsBase() {} + ~CheckResultsBase() override {} void _doTest() override { runSharded(false); runSharded(true); @@ -788,80 +788,80 @@ class EmptyCollection : public CheckResultsBase {}; /** A $group performed on a single document. */ class SingleDocument : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("a" << 1)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << 0 << "a" << BSON("$sum" << "$a")); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0,a:1}]"; } }; /** A $group performed on two values for a single key. */ class TwoValuesSingleKey : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("a" << 1), DOC("a" << 2)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << 0 << "a" << BSON("$push" << "$a")); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0,a:[1,2]}]"; } }; /** A $group performed on two values with one key each. */ class TwoValuesTwoKeys : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("_id" << 0 << "a" << 1), DOC("_id" << 1 << "a" << 2)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << "$_id" << "a" << BSON("$push" << "$a")); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0,a:[1]},{_id:1,a:[2]}]"; } }; /** A $group performed on two values with two keys each. */ class FourValuesTwoKeys : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("id" << 0 << "a" << 1), DOC("id" << 1 << "a" << 2), DOC("id" << 0 << "a" << 3), DOC("id" << 1 << "a" << 4)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << "$id" << "a" << BSON("$push" << "$a")); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0,a:[1,3]},{_id:1,a:[2,4]}]"; } }; /** A $group performed on two values with two keys each and two accumulator operations. */ class FourValuesTwoKeysTwoAccumulators : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("id" << 0 << "a" << 1), DOC("id" << 1 << "a" << 2), DOC("id" << 0 << "a" << 3), DOC("id" << 1 << "a" << 4)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << "$id" << "list" @@ -869,31 +869,31 @@ class FourValuesTwoKeysTwoAccumulators : public CheckResultsBase { << "$a") << "sum" << BSON("$sum" << BSON("$divide" << BSON_ARRAY("$a" << 2)))); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0,list:[1,3],sum:2},{_id:1,list:[2,4],sum:3}]"; } }; /** Null and undefined _id values are grouped together. */ class GroupNullUndefinedIds : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("a" << BSONNULL << "b" << 100), DOC("b" << 10)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << "$a" << "sum" << BSON("$sum" << "$b")); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:null,sum:110}]"; } }; /** A complex _id expression. */ class ComplexId : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {DOC("a" << "de"_sd << "b" @@ -911,28 +911,28 @@ class ComplexId : public CheckResultsBase { << "d" << "ef"_sd)}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << BSON("$concat" << BSON_ARRAY("$a" << "$b" << "$c" << "$d"))); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:'deadbeef'}]"; } }; /** An undefined accumulator value is dropped. */ class UndefinedAccumulatorValue : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {Document()}; } - virtual BSONObj groupSpec() { + BSONObj groupSpec() override { return BSON("_id" << 0 << "first" << BSON("$first" << "$missing")); } - virtual std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0, first:null}]"; } }; @@ -962,7 +962,7 @@ public: } private: - std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:0,list:[1,2,10,20]},{_id:1,list:[3,4,30,40]}]"; } }; @@ -991,13 +991,13 @@ public: * SERVER-6766 */ class StringConstantIdAndAccumulatorExpressions : public CheckResultsBase { - std::deque inputData() { + std::deque inputData() override { return {Document()}; } - BSONObj groupSpec() { + BSONObj groupSpec() override { return fromjson("{_id:{$const:'$_id...'},a:{$push:{$const:'$a...'}}}"); } - std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:'$_id...',a:['$a...']}]"; } }; @@ -1011,14 +1011,14 @@ public: // Run standard base tests. CheckResultsBase::_doTest(); } - std::deque inputData() { + std::deque inputData() override { return {Document()}; } - BSONObj groupSpec() { + BSONObj groupSpec() override { // An array can be specified using $const. return fromjson("{_id:[1,2,3],a:{$push:{$const:[4,5,6]}}}"); } - std::string expectedResultSetString() { + std::string expectedResultSetString() override { return "[{_id:[1,2,3],a:[[4,5,6]]}]"; } }; @@ -1304,7 +1304,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("DocumentSourceGroupTests") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/document_source_internal_all_collection_stats.h b/src/mongo/db/pipeline/document_source_internal_all_collection_stats.h index 07914d469e2..235a189a74a 100644 --- a/src/mongo/db/pipeline/document_source_internal_all_collection_stats.h +++ b/src/mongo/db/pipeline/document_source_internal_all_collection_stats.h @@ -115,7 +115,7 @@ public: void addVariableRefs(std::set* refs) const final{}; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { StageConstraints constraints(StreamType::kStreaming, @@ -142,9 +142,8 @@ public: Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) final; - void serializeToArray( - std::vector& array, - const SerializationOptions& opts = SerializationOptions{}) const final override; + void serializeToArray(std::vector& array, + const SerializationOptions& opts = SerializationOptions{}) const final; private: GetNextResult doGetNext() final; diff --git a/src/mongo/db/pipeline/document_source_internal_apply_oplog_update.h b/src/mongo/db/pipeline/document_source_internal_apply_oplog_update.h index 6a51e36f191..ca7e60e1e77 100644 --- a/src/mongo/db/pipeline/document_source_internal_apply_oplog_update.h +++ b/src/mongo/db/pipeline/document_source_internal_apply_oplog_update.h @@ -97,7 +97,7 @@ public: void addVariableRefs(std::set* refs) const final {} private: - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; GetNextResult doGetNext() override; diff --git a/src/mongo/db/pipeline/document_source_internal_compute_geo_near_distance.h b/src/mongo/db/pipeline/document_source_internal_compute_geo_near_distance.h index b8e8b37b0ea..8248a07ebda 100644 --- a/src/mongo/db/pipeline/document_source_internal_compute_geo_near_distance.h +++ b/src/mongo/db/pipeline/document_source_internal_compute_geo_near_distance.h @@ -106,7 +106,7 @@ public: void addVariableRefs(std::set* refs) const final {} private: - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; GetNextResult doGetNext() override; diff --git a/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h b/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h index 4d04b28514a..86bfdc53038 100644 --- a/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h +++ b/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h @@ -93,7 +93,7 @@ public: ChangeStreamRequirement::kDenylist}; } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::optional distributedPlanLogic() final { return boost::none; diff --git a/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h b/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h index 166a25b2c3b..c6de894471b 100644 --- a/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h +++ b/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h @@ -87,7 +87,7 @@ public: private: GetNextResult doGetNext() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; }; } // namespace mongo diff --git a/src/mongo/db/pipeline/document_source_internal_projection.h b/src/mongo/db/pipeline/document_source_internal_projection.h index 4d83f21bfd6..306651008ff 100644 --- a/src/mongo/db/pipeline/document_source_internal_projection.h +++ b/src/mongo/db/pipeline/document_source_internal_projection.h @@ -83,7 +83,7 @@ public: Pipeline::SourceContainer* container) final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; const projection_ast::Projection& projection() const { return _projection; diff --git a/src/mongo/db/pipeline/document_source_internal_replace_root.h b/src/mongo/db/pipeline/document_source_internal_replace_root.h index 753cd4bd25b..f2f5fa258bc 100644 --- a/src/mongo/db/pipeline/document_source_internal_replace_root.h +++ b/src/mongo/db/pipeline/document_source_internal_replace_root.h @@ -74,7 +74,7 @@ public: Pipeline::SourceContainer* container) final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::intrusive_ptr newRootExpression() const { return _newRoot; diff --git a/src/mongo/db/pipeline/document_source_internal_shard_filter.h b/src/mongo/db/pipeline/document_source_internal_shard_filter.h index 94c07036c4f..6629bdccaac 100644 --- a/src/mongo/db/pipeline/document_source_internal_shard_filter.h +++ b/src/mongo/db/pipeline/document_source_internal_shard_filter.h @@ -83,7 +83,7 @@ public: } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::optional distributedPlanLogic() override { return boost::none; @@ -92,7 +92,7 @@ public: Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) override; - DepsTracker::State getDependencies(DepsTracker* deps) const { + DepsTracker::State getDependencies(DepsTracker* deps) const override { // This stage doesn't use any variables. if (_shardFilterer->isCollectionSharded()) { const BSONObj& keyPattern = _shardFilterer->getKeyPattern().toBSON(); diff --git a/src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp b/src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp index 4b1ba6acec4..5edbf577653 100644 --- a/src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp +++ b/src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp @@ -58,7 +58,7 @@ using DocumentSourceInternalShardFilterTest = AggregationContextFixture; */ class ShardFiltererBaseForTest : public ShardFilterer { public: - std::unique_ptr clone() const { + std::unique_ptr clone() const override { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/pipeline/document_source_internal_shardserver_info.h b/src/mongo/db/pipeline/document_source_internal_shardserver_info.h index f765f8f4778..1d523475c79 100644 --- a/src/mongo/db/pipeline/document_source_internal_shardserver_info.h +++ b/src/mongo/db/pipeline/document_source_internal_shardserver_info.h @@ -121,7 +121,7 @@ private: GetNextResult doGetNext() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; bool _didEmit = false; }; diff --git a/src/mongo/db/pipeline/document_source_internal_split_pipeline.h b/src/mongo/db/pipeline/document_source_internal_split_pipeline.h index 5ee26a7269a..66c98ca73da 100644 --- a/src/mongo/db/pipeline/document_source_internal_split_pipeline.h +++ b/src/mongo/db/pipeline/document_source_internal_split_pipeline.h @@ -108,7 +108,7 @@ private: : DocumentSource(kStageName, expCtx), _mergeType(mergeType), _mergeShardId(mergeShardId) {} GetNextResult doGetNext() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; HostTypeRequirement _mergeType = HostTypeRequirement::kNone; // Populated with a valid ShardId if this stage was constructed with diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h b/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h index e6cef392b3e..3e70b6c13cd 100644 --- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h +++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h @@ -99,15 +99,13 @@ public: return kStageNameInternal.rawData(); } - void serializeToArray( - std::vector& array, - const SerializationOptions& opts = SerializationOptions{}) const final override; + void serializeToArray(std::vector& array, + const SerializationOptions& opts = SerializationOptions{}) const final; /** * Use 'serializeToArray' above. */ - Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { MONGO_UNREACHABLE_TASSERT(7484305); } @@ -289,7 +287,7 @@ public: bool optimizeLastpoint(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container); - GetModPathsReturn getModifiedPaths() const final override; + GetModPathsReturn getModifiedPaths() const final; DepsTracker getRestPipelineDependencies(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container, diff --git a/src/mongo/db/pipeline/document_source_limit.h b/src/mongo/db/pipeline/document_source_limit.h index 81b8ee50c92..3b5cd7d14af 100644 --- a/src/mongo/db/pipeline/document_source_limit.h +++ b/src/mongo/db/pipeline/document_source_limit.h @@ -87,7 +87,7 @@ public: */ Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; DepsTracker::State getDependencies(DepsTracker* deps) const final { return DepsTracker::State::SEE_NEXT; // This doesn't affect needed fields diff --git a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h b/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h index 0a01d6a6c13..2b4e8893df1 100644 --- a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h +++ b/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h @@ -97,11 +97,11 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { return onlyReadConcernLocalSupported(kStageName, level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } diff --git a/src/mongo/db/pipeline/document_source_list_catalog.h b/src/mongo/db/pipeline/document_source_list_catalog.h index b9b34a8ef51..d559dcd364f 100644 --- a/src/mongo/db/pipeline/document_source_list_catalog.h +++ b/src/mongo/db/pipeline/document_source_list_catalog.h @@ -95,7 +95,7 @@ public: // virtuals from DocumentSource const char* getSourceName() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { StageConstraints constraints(StreamType::kStreaming, diff --git a/src/mongo/db/pipeline/document_source_list_local_sessions.h b/src/mongo/db/pipeline/document_source_list_local_sessions.h index 1ea043b3202..e5c71ec096d 100644 --- a/src/mongo/db/pipeline/document_source_list_local_sessions.h +++ b/src/mongo/db/pipeline/document_source_list_local_sessions.h @@ -110,11 +110,11 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { return onlyReadConcernLocalSupported(kStageName, level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(DocumentSourceListLocalSessions::kStageName); } @@ -127,8 +127,7 @@ public: return DocumentSourceListLocalSessions::kStageName.rawData(); } - Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { return Value(Document{{getSourceName(), _spec.toBSON(opts)}}); } diff --git a/src/mongo/db/pipeline/document_source_list_sampled_queries.h b/src/mongo/db/pipeline/document_source_list_sampled_queries.h index e7b4752ad9d..59b042f273b 100644 --- a/src/mongo/db/pipeline/document_source_list_sampled_queries.h +++ b/src/mongo/db/pipeline/document_source_list_sampled_queries.h @@ -103,7 +103,7 @@ public: return true; } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } @@ -116,7 +116,7 @@ public: DocumentSourceListSampledQueriesSpec spec) : DocumentSource(kStageName, pExpCtx), _spec(std::move(spec)) {} - virtual ~DocumentSourceListSampledQueries() = default; + ~DocumentSourceListSampledQueries() override = default; StageConstraints constraints( Pipeline::SplitState = Pipeline::SplitState::kUnsplit) const override { @@ -142,7 +142,7 @@ public: return kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_list_sessions.h b/src/mongo/db/pipeline/document_source_list_sessions.h index cde0d638644..9cb7e6c857c 100644 --- a/src/mongo/db/pipeline/document_source_list_sessions.h +++ b/src/mongo/db/pipeline/document_source_list_sessions.h @@ -74,8 +74,8 @@ public: const boost::intrusive_ptr& newExpCtx) : DocumentSourceMatch(other, newExpCtx), _allUsers(other._allUsers), _users(other._users) {} - virtual boost::intrusive_ptr clone( - const boost::intrusive_ptr& newExpCtx) const { + boost::intrusive_ptr clone( + const boost::intrusive_ptr& newExpCtx) const override { return make_intrusive>(*this, newExpCtx); } @@ -120,7 +120,7 @@ public: return DocumentSourceListSessions::kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { return {StreamType::kStreaming, diff --git a/src/mongo/db/pipeline/document_source_lookup.h b/src/mongo/db/pipeline/document_source_lookup.h index d104d98070d..2ab05ea14bc 100644 --- a/src/mongo/db/pipeline/document_source_lookup.h +++ b/src/mongo/db/pipeline/document_source_lookup.h @@ -117,8 +117,8 @@ public: /** * Lookup from a sharded collection may not be allowed. */ - Status checkShardedForeignCollAllowed( - const NamespaceString& nss, bool inMultiDocumentTransaction) const override final { + Status checkShardedForeignCollAllowed(const NamespaceString& nss, + bool inMultiDocumentTransaction) const final { if (!inMultiDocumentTransaction) { return Status::OK(); } @@ -152,7 +152,7 @@ public: } PrivilegeVector requiredPrivileges(bool isMongos, - bool bypassDocumentValidation) const override final; + bool bypassDocumentValidation) const final; private: bool _hasInternalCollation = false; @@ -165,9 +165,8 @@ public: const boost::intrusive_ptr&); const char* getSourceName() const final; - void serializeToArray( - std::vector& array, - const SerializationOptions& opts = SerializationOptions{}) const final override; + void serializeToArray(std::vector& array, + const SerializationOptions& opts = SerializationOptions{}) const final; /** * Returns the 'as' path, and possibly fields modified by an absorbed $unwind. @@ -375,8 +374,7 @@ private: /** * Should not be called; use serializeToArray instead. */ - Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { MONGO_UNREACHABLE_TASSERT(7484304); } diff --git a/src/mongo/db/pipeline/document_source_match.h b/src/mongo/db/pipeline/document_source_match.h index a40be30e11d..74f56f2b286 100644 --- a/src/mongo/db/pipeline/document_source_match.h +++ b/src/mongo/db/pipeline/document_source_match.h @@ -67,10 +67,10 @@ public: DocumentSourceMatch(std::unique_ptr expr, const boost::intrusive_ptr& expCtx); - virtual ~DocumentSourceMatch() = default; + ~DocumentSourceMatch() override = default; - virtual boost::intrusive_ptr clone( - const boost::intrusive_ptr& newExpCtx) const { + boost::intrusive_ptr clone( + const boost::intrusive_ptr& newExpCtx) const override { // Raw new is needed to access non-public constructors. return new DocumentSourceMatch(*this, newExpCtx); } diff --git a/src/mongo/db/pipeline/document_source_merge.h b/src/mongo/db/pipeline/document_source_merge.h index 482f214aa5a..530622e5de1 100644 --- a/src/mongo/db/pipeline/document_source_merge.h +++ b/src/mongo/db/pipeline/document_source_merge.h @@ -146,7 +146,7 @@ public: MergeWhenNotMatchedModeEnum _whenNotMatched; }; - virtual ~DocumentSourceMerge() = default; + ~DocumentSourceMerge() override = default; const char* getSourceName() const final { return kStageName.rawData(); @@ -160,7 +160,7 @@ public: boost::optional distributedPlanLogic() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; /** * Creates a new $merge stage from the given arguments. diff --git a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp index f247ba9a0fc..703ddb97398 100644 --- a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp +++ b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp @@ -459,7 +459,7 @@ protected: } private: - virtual boost::intrusive_ptr makeExpCtx() override { + boost::intrusive_ptr makeExpCtx() override { return new ExpressionContext(operationContext(), nullptr, _nss); } diff --git a/src/mongo/db/pipeline/document_source_mock.h b/src/mongo/db/pipeline/document_source_mock.h index f2d80b4b3c3..0cfd6992a5b 100644 --- a/src/mongo/db/pipeline/document_source_mock.h +++ b/src/mongo/db/pipeline/document_source_mock.h @@ -96,8 +96,7 @@ public: DocumentSourceMock(std::deque, const boost::intrusive_ptr&); - Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { // Unlike the queue, it's okay to serialize this stage for testing purposes. return Value(Document{{getSourceName(), Document()}}); } @@ -106,11 +105,11 @@ public: size_t size() const; - void reattachToOperationContext(OperationContext* opCtx) { + void reattachToOperationContext(OperationContext* opCtx) override { isDetachedFromOpCtx = false; } - void detachFromOperationContext() { + void detachFromOperationContext() override { isDetachedFromOpCtx = true; } diff --git a/src/mongo/db/pipeline/document_source_operation_metrics.h b/src/mongo/db/pipeline/document_source_operation_metrics.h index 90223d0b1d3..6de550fc4c8 100644 --- a/src/mongo/db/pipeline/document_source_operation_metrics.h +++ b/src/mongo/db/pipeline/document_source_operation_metrics.h @@ -119,7 +119,7 @@ public: return boost::none; } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_out.h b/src/mongo/db/pipeline/document_source_out.h index 14142d7711e..46008fa0e4e 100644 --- a/src/mongo/db/pipeline/document_source_out.h +++ b/src/mongo/db/pipeline/document_source_out.h @@ -101,7 +101,8 @@ public: "$out to a sharded collection is not allowed"); } - PrivilegeVector requiredPrivileges(bool isMongos, bool bypassDocumentValidation) const { + PrivilegeVector requiredPrivileges(bool isMongos, + bool bypassDocumentValidation) const override { ActionSet actions{ActionType::insert, ActionType::remove}; if (bypassDocumentValidation) { actions.addAction(ActionType::bypassDocumentValidation); @@ -123,9 +124,9 @@ public: ~DocumentSourceOut() override; - StageConstraints constraints(Pipeline::SplitState pipeState) const final override; + StageConstraints constraints(Pipeline::SplitState pipeState) const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; /** * Creates a new $out stage from the given arguments. @@ -141,7 +142,7 @@ public: static boost::intrusive_ptr createFromBson( BSONElement elem, const boost::intrusive_ptr& pExpCtx); - const char* getSourceName() const final override { + const char* getSourceName() const final { return kStageName.rawData(); } diff --git a/src/mongo/db/pipeline/document_source_plan_cache_stats.h b/src/mongo/db/pipeline/document_source_plan_cache_stats.h index 48a19997aa3..911bdb05193 100644 --- a/src/mongo/db/pipeline/document_source_plan_cache_stats.h +++ b/src/mongo/db/pipeline/document_source_plan_cache_stats.h @@ -92,11 +92,11 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { return onlyReadConcernLocalSupported(kStageName, level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(DocumentSourcePlanCacheStats::kStageName); } @@ -107,7 +107,7 @@ public: static boost::intrusive_ptr createFromBson( BSONElement elem, const boost::intrusive_ptr& pExpCtx); - virtual ~DocumentSourcePlanCacheStats() = default; + ~DocumentSourcePlanCacheStats() override = default; StageConstraints constraints( Pipeline::SplitState = Pipeline::SplitState::kUnsplit) const override { @@ -140,9 +140,8 @@ public: Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) override; - void serializeToArray( - std::vector& array, - const SerializationOptions& opts = SerializationOptions{}) const final override; + void serializeToArray(std::vector& array, + const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} @@ -152,8 +151,7 @@ private: GetNextResult doGetNext() final; - Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { MONGO_UNREACHABLE_TASSERT(7484303); // Should call serializeToArray instead. } diff --git a/src/mongo/db/pipeline/document_source_query_settings.h b/src/mongo/db/pipeline/document_source_query_settings.h index a2855d55f90..8252ea14b95 100644 --- a/src/mongo/db/pipeline/document_source_query_settings.h +++ b/src/mongo/db/pipeline/document_source_query_settings.h @@ -74,11 +74,11 @@ public: return true; } - bool isInitialSource() const { + bool isInitialSource() const override { return true; } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } diff --git a/src/mongo/db/pipeline/document_source_query_stats.h b/src/mongo/db/pipeline/document_source_query_stats.h index 83d17bf4d13..18e48c3799b 100644 --- a/src/mongo/db/pipeline/document_source_query_stats.h +++ b/src/mongo/db/pipeline/document_source_query_stats.h @@ -103,7 +103,7 @@ public: return true; } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } @@ -119,7 +119,7 @@ public: static boost::intrusive_ptr createFromBson( BSONElement elem, const boost::intrusive_ptr& pExpCtx); - virtual ~DocumentSourceQueryStats() = default; + ~DocumentSourceQueryStats() override = default; StageConstraints constraints( Pipeline::SplitState = Pipeline::SplitState::kUnsplit) const override { @@ -145,7 +145,7 @@ public: return kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/document_source_redact.h b/src/mongo/db/pipeline/document_source_redact.h index 9ba88284840..f0a1e889f9c 100644 --- a/src/mongo/db/pipeline/document_source_redact.h +++ b/src/mongo/db/pipeline/document_source_redact.h @@ -84,7 +84,7 @@ public: static boost::intrusive_ptr createFromBson( BSONElement elem, const boost::intrusive_ptr& expCtx); - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; RedactProcessor* getRedactProcessor() { return _redactProcessor.get_ptr(); diff --git a/src/mongo/db/pipeline/document_source_sample.h b/src/mongo/db/pipeline/document_source_sample.h index cefa54edef5..261cf515451 100644 --- a/src/mongo/db/pipeline/document_source_sample.h +++ b/src/mongo/db/pipeline/document_source_sample.h @@ -56,7 +56,7 @@ public: const char* getSourceName() const final { return kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { return {StreamType::kBlocking, diff --git a/src/mongo/db/pipeline/document_source_sample_from_random_cursor.h b/src/mongo/db/pipeline/document_source_sample_from_random_cursor.h index 854d0627327..29149646ded 100644 --- a/src/mongo/db/pipeline/document_source_sample_from_random_cursor.h +++ b/src/mongo/db/pipeline/document_source_sample_from_random_cursor.h @@ -57,7 +57,7 @@ class DocumentSourceSampleFromRandomCursor final : public DocumentSource { public: static constexpr StringData kStageName = "$sampleFromRandomCursor"_sd; const char* getSourceName() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; DepsTracker::State getDependencies(DepsTracker* deps) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { diff --git a/src/mongo/db/pipeline/document_source_sequential_document_cache.h b/src/mongo/db/pipeline/document_source_sequential_document_cache.h index 65418085c31..2548a3fc067 100644 --- a/src/mongo/db/pipeline/document_source_sequential_document_cache.h +++ b/src/mongo/db/pipeline/document_source_sequential_document_cache.h @@ -66,7 +66,7 @@ public: return DocumentSourceSequentialDocumentCache::kStageName.rawData(); } - StageConstraints constraints(Pipeline::SplitState pipeState) const { + StageConstraints constraints(Pipeline::SplitState pipeState) const override { StageConstraints constraints(StreamType::kStreaming, _cache->isServing() ? PositionRequirement::kFirst : PositionRequirement::kNone, @@ -128,7 +128,7 @@ private: DocumentSourceSequentialDocumentCache(const boost::intrusive_ptr& expCtx, SequentialDocumentCache* cache); - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; SequentialDocumentCache* _cache; diff --git a/src/mongo/db/pipeline/document_source_set_variable_from_subpipeline.h b/src/mongo/db/pipeline/document_source_set_variable_from_subpipeline.h index 163f87da05c..4d722589b6c 100644 --- a/src/mongo/db/pipeline/document_source_set_variable_from_subpipeline.h +++ b/src/mongo/db/pipeline/document_source_set_variable_from_subpipeline.h @@ -69,7 +69,7 @@ public: std::unique_ptr subpipeline, Variables::Id varID); - ~DocumentSourceSetVariableFromSubPipeline() = default; + ~DocumentSourceSetVariableFromSubPipeline() override = default; boost::optional distributedPlanLogic() final { // {shardsStage, mergingStage, sortPattern} @@ -138,7 +138,7 @@ protected: private: GetNextResult doGetNext() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; std::unique_ptr _subPipeline; Variables::Id _variableID; // $setVariableFromSubPipeline sets the value of $$SEARCH_META only on the first call to diff --git a/src/mongo/db/pipeline/document_source_set_window_fields.h b/src/mongo/db/pipeline/document_source_set_window_fields.h index b401fe52da6..8c1038b131c 100644 --- a/src/mongo/db/pipeline/document_source_set_window_fields.h +++ b/src/mongo/db/pipeline/document_source_set_window_fields.h @@ -138,7 +138,7 @@ public: UnionRequirement::kAllowed); } - const char* getSourceName() const { + const char* getSourceName() const override { return kStageName.rawData(); }; @@ -171,16 +171,16 @@ public: Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) final; - boost::optional distributedPlanLogic() { + boost::optional distributedPlanLogic() override { // Force to run on the merging half for now. return DistributedPlanLogic{nullptr, this, boost::none}; } boost::intrusive_ptr optimize() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; - DocumentSource::GetNextResult doGetNext(); + DocumentSource::GetNextResult doGetNext() override; void setSource(DocumentSource* source) final { pSource = source; diff --git a/src/mongo/db/pipeline/document_source_single_document_transformation.h b/src/mongo/db/pipeline/document_source_single_document_transformation.h index 900b0fbddf5..42482cff94d 100644 --- a/src/mongo/db/pipeline/document_source_single_document_transformation.h +++ b/src/mongo/db/pipeline/document_source_single_document_transformation.h @@ -67,8 +67,8 @@ namespace mongo { */ class DocumentSourceSingleDocumentTransformation final : public DocumentSource { public: - virtual boost::intrusive_ptr clone( - const boost::intrusive_ptr& newExpCtx) const { + boost::intrusive_ptr clone( + const boost::intrusive_ptr& newExpCtx) const override { auto list = DocumentSource::parse(newExpCtx ? newExpCtx : pExpCtx, serialize().getDocument().toBson()); invariant(list.size() == 1); @@ -85,7 +85,7 @@ public: const char* getSourceName() const final; boost::intrusive_ptr optimize() final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; DepsTracker::State getDependencies(DepsTracker* deps) const final; void addVariableRefs(std::set* refs) const final; GetModPathsReturn getModifiedPaths() const final; diff --git a/src/mongo/db/pipeline/document_source_skip.h b/src/mongo/db/pipeline/document_source_skip.h index f9d2491522c..91cb0d10eac 100644 --- a/src/mongo/db/pipeline/document_source_skip.h +++ b/src/mongo/db/pipeline/document_source_skip.h @@ -91,7 +91,7 @@ public: Pipeline::SourceContainer::iterator doOptimizeAt(Pipeline::SourceContainer::iterator itr, Pipeline::SourceContainer* container) final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; boost::intrusive_ptr optimize() final; diff --git a/src/mongo/db/pipeline/document_source_sort.h b/src/mongo/db/pipeline/document_source_sort.h index dd1f57f18fc..e5ca3073b38 100644 --- a/src/mongo/db/pipeline/document_source_sort.h +++ b/src/mongo/db/pipeline/document_source_sort.h @@ -103,9 +103,8 @@ public: return kStageName.rawData(); } - void serializeToArray( - std::vector& array, - const SerializationOptions& opts = SerializationOptions{}) const final override; + void serializeToArray(std::vector& array, + const SerializationOptions& opts = SerializationOptions{}) const final; boost::intrusive_ptr clone( const boost::intrusive_ptr& newExpCtx) const final; @@ -248,7 +247,7 @@ private: uint64_t limit, uint64_t maxMemoryUsageBytes); - Value serialize(const SerializationOptions& opts) const final override { + Value serialize(const SerializationOptions& opts) const final { MONGO_UNREACHABLE_TASSERT(7484302); // Should call serializeToArray instead. } diff --git a/src/mongo/db/pipeline/document_source_tee_consumer.h b/src/mongo/db/pipeline/document_source_tee_consumer.h index aaf8cdfc932..b5ae1e5954e 100644 --- a/src/mongo/db/pipeline/document_source_tee_consumer.h +++ b/src/mongo/db/pipeline/document_source_tee_consumer.h @@ -95,7 +95,7 @@ public: const char* getSourceName() const override; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; protected: GetNextResult doGetNext() final; diff --git a/src/mongo/db/pipeline/document_source_test_optimizations.h b/src/mongo/db/pipeline/document_source_test_optimizations.h index 42bd37da771..c5f6911b7a5 100644 --- a/src/mongo/db/pipeline/document_source_test_optimizations.h +++ b/src/mongo/db/pipeline/document_source_test_optimizations.h @@ -42,14 +42,14 @@ public: static constexpr StringData kStageName = "$_internalTestOptimizations"_sd; DocumentSourceTestOptimizations(const boost::intrusive_ptr& expCtx) : DocumentSource(DocumentSourceTestOptimizations::kStageName, expCtx) {} - virtual ~DocumentSourceTestOptimizations() = default; + ~DocumentSourceTestOptimizations() override = default; const char* getSourceName() const override { return DocumentSourceTestOptimizations::kStageName.rawData(); } - virtual GetNextResult doGetNext() override { + GetNextResult doGetNext() override { MONGO_UNREACHABLE; } - virtual StageConstraints constraints(Pipeline::SplitState) const override { + StageConstraints constraints(Pipeline::SplitState) const override { // Return the default constraints so that this can be used in test pipelines. Constructing a // pipeline needs to do some validation that depends on this. return StageConstraints{StreamType::kStreaming, @@ -62,19 +62,18 @@ public: UnionRequirement::kAllowed}; } - virtual boost::optional distributedPlanLogic() override { + boost::optional distributedPlanLogic() override { return boost::none; } - virtual GetModPathsReturn getModifiedPaths() const override { + GetModPathsReturn getModifiedPaths() const override { MONGO_UNREACHABLE; } void addVariableRefs(std::set* refs) const final {} private: - virtual Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override { + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final { MONGO_UNREACHABLE_TASSERT(7484301); } }; diff --git a/src/mongo/db/pipeline/document_source_union_with.h b/src/mongo/db/pipeline/document_source_union_with.h index 8a1b51305a5..a8afab4c080 100644 --- a/src/mongo/db/pipeline/document_source_union_with.h +++ b/src/mongo/db/pipeline/document_source_union_with.h @@ -88,7 +88,7 @@ public: std::move(parseTimeName), std::move(foreignNss), std::move(pipeline)) {} PrivilegeVector requiredPrivileges(bool isMongos, - bool bypassDocumentValidation) const override final; + bool bypassDocumentValidation) const final; }; DocumentSourceUnionWith(const boost::intrusive_ptr& expCtx, @@ -108,7 +108,7 @@ public: _pipeline->getContext()->inUnionWith = true; } - ~DocumentSourceUnionWith(); + ~DocumentSourceUnionWith() override; const char* getSourceName() const final { return kStageName.rawData(); @@ -216,7 +216,7 @@ private: kFinished }; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addViewDefinition(NamespaceString nss, std::vector viewPipeline); diff --git a/src/mongo/db/pipeline/document_source_unwind.h b/src/mongo/db/pipeline/document_source_unwind.h index 5468e8feba1..b544b0062be 100644 --- a/src/mongo/db/pipeline/document_source_unwind.h +++ b/src/mongo/db/pipeline/document_source_unwind.h @@ -66,7 +66,7 @@ public: // virtuals from DocumentSource const char* getSourceName() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; /** * Returns the unwound path, and the 'includeArrayIndex' path, if specified. diff --git a/src/mongo/db/pipeline/document_source_unwind_test.cpp b/src/mongo/db/pipeline/document_source_unwind_test.cpp index 10e572ef070..de459c5df81 100644 --- a/src/mongo/db/pipeline/document_source_unwind_test.cpp +++ b/src/mongo/db/pipeline/document_source_unwind_test.cpp @@ -848,7 +848,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("DocumentSourceUnwindTests") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/document_source_writer.h b/src/mongo/db/pipeline/document_source_writer.h index 5861f403d43..39ba8ee8f6b 100644 --- a/src/mongo/db/pipeline/document_source_writer.h +++ b/src/mongo/db/pipeline/document_source_writer.h @@ -141,7 +141,7 @@ public: } protected: - GetNextResult doGetNext() final override; + GetNextResult doGetNext() final; /** * Prepares the stage to be able to write incoming batches. */ diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp index e0615261366..329a73dadc0 100644 --- a/src/mongo/db/pipeline/expression.cpp +++ b/src/mongo/db/pipeline/expression.cpp @@ -3655,7 +3655,7 @@ public: _children = operands; } - virtual Value evaluate(const Document& root, Variables* variables) const { + Value evaluate(const Document& root, Variables* variables) const override { int arraySize = _children[0]->evaluate(root, variables).getArrayLength(); auto args = evaluateAndValidateArguments(root, _children, arraySize, variables); auto indexVec = _indexMap.find(args.targetOfSearch); @@ -5209,7 +5209,7 @@ public: _children = operands; } - virtual Value evaluate(const Document& root, Variables* variables) const { + Value evaluate(const Document& root, Variables* variables) const override { const Value lhs = _children[0]->evaluate(root, variables); uassert(17310, diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index 441946ad4ce..6fe13994804 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -226,7 +226,7 @@ public: StringMap complexRenames; }; - virtual ~Expression(){}; + ~Expression() override{}; /** * Optimize the Expression. @@ -458,7 +458,7 @@ public: Value val, bool wrapRepresentativeValue = false); - bool selfAndChildrenAreConstant() const override final { + bool selfAndChildrenAreConstant() const final { return true; } @@ -578,7 +578,7 @@ public: ExpressionVariadic(ExpressionContext* const expCtx, Expression::ExpressionVector&& children) : ExpressionNaryBase(expCtx, std::move(children)) {} - Value serialize(const SerializationOptions& options = {}) const { + Value serialize(const SerializationOptions& options = {}) const override { // As a special case, we would like to serialize a variadic number of children as // "?array" if they are all constant. Check for that here, otherwise default to // the normal one-by-one serialization of the children. @@ -719,13 +719,13 @@ public: return AccumulatorN::kName.rawData(); } - Value serialize(const SerializationOptions& options = {}) const { + Value serialize(const SerializationOptions& options = {}) const override { MutableDocument md; AccumulatorN::serializeHelper(_n, _output, options, md); return Value(DOC(getOpName() << md.freeze())); } - Value evaluate(const Document& root, Variables* variables) const { + Value evaluate(const Document& root, Variables* variables) const override { AccumulatorN accum(this->getExpressionContext()); // Evaluate and initialize 'n'. @@ -845,7 +845,7 @@ public: Expression::ExpressionVector&& children) : ExpressionFixedArity(expCtx, std::move(children)) {} - virtual ~ExpressionSingleNumericArg() = default; + ~ExpressionSingleNumericArg() override = default; Value evaluate(const Document& root, Variables* variables) const final { Value arg = this->_children[0]->evaluate(root, variables); @@ -875,7 +875,7 @@ public: Expression::ExpressionVector&& children) : ExpressionFixedArity(expCtx, std::move(children)) {} - virtual ~ExpressionTwoNumericArgs() = default; + ~ExpressionTwoNumericArgs() override = default; /** * Evaluate performs the type checking necessary to make sure that both arguments are numeric, @@ -916,7 +916,7 @@ public: template class DateExpressionAcceptingTimeZone : public Expression { public: - virtual ~DateExpressionAcceptingTimeZone() {} + ~DateExpressionAcceptingTimeZone() override {} Value evaluate(const Document& root, Variables* variables) const final { auto dateVal = _children[_kDate]->evaluate(root, variables); @@ -1232,7 +1232,7 @@ public: return visitor->visit(this); } - bool selfAndChildrenAreConstant() const override final; + bool selfAndChildrenAreConstant() const final; }; @@ -2019,7 +2019,7 @@ public: } [[nodiscard]] boost::intrusive_ptr optimize() final; - Value evaluate(const Document& root, Variables* variables) const; + Value evaluate(const Document& root, Variables* variables) const override; Value serialize(const SerializationOptions& options = {}) const final; /* @@ -2278,7 +2278,7 @@ public: ExpressionIndexOfArray(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionRangedArity(expCtx, std::move(children)) {} - Value evaluate(const Document& root, Variables* variables) const; + Value evaluate(const Document& root, Variables* variables) const override; [[nodiscard]] boost::intrusive_ptr optimize() final; const char* getOpName() const final; @@ -2781,7 +2781,7 @@ public: return visitor->visit(this); } - bool selfAndChildrenAreConstant() const override final; + bool selfAndChildrenAreConstant() const final; private: ExpressionObject( @@ -3282,7 +3282,7 @@ public: expCtx->sbeCompatibility = SbeCompatibility::notCompatible; } Value evaluate(const Document& root, Variables* variables) const final; - const char* getOpName() const { + const char* getOpName() const override { return "$_internalFindAllValuesAtPath"; } @@ -3408,7 +3408,7 @@ public: : ExpressionFixedArity(expCtx, std::move(children)) {} Value evaluate(const Document& root, Variables* variables) const final; - const char* getOpName() const; + const char* getOpName() const override; void acceptVisitor(ExpressionMutableVisitor* visitor) final { return visitor->visit(this); @@ -4005,7 +4005,7 @@ public: * then it can be optimized. Stores the optimized regex in '_initialExecStateForConstantRegex' * so that it can be reused during expression evaluation. */ - [[nodiscard]] boost::intrusive_ptr optimize(); + [[nodiscard]] boost::intrusive_ptr optimize() override; bool hasConstantRegex() const { return _initialExecStateForConstantRegex.has_value(); @@ -4022,7 +4022,7 @@ public: boost::optional, std::string>> getConstantPatternAndOptions() const; - Value serialize(const SerializationOptions& options = {}) const; + Value serialize(const SerializationOptions& options = {}) const override; const std::string& getOpName() const { return _opName; @@ -4176,7 +4176,7 @@ public: return visitor->visit(this); } - Value evaluate(const Document& root, Variables* variables) const; + Value evaluate(const Document& root, Variables* variables) const override; Value serialize(const SerializationOptions& options = {}) const final; }; diff --git a/src/mongo/db/pipeline/expression_and_test.cpp b/src/mongo/db/pipeline/expression_and_test.cpp index 29d984b1dbc..f4a219dfcb8 100644 --- a/src/mongo/db/pipeline/expression_and_test.cpp +++ b/src/mongo/db/pipeline/expression_and_test.cpp @@ -147,154 +147,154 @@ protected: }; class NoOptimizeBase : public OptimizeBase { - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return constify(spec()); } }; /** $and without operands. */ class NoOperands : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSONArray()); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $and passed 'true'. */ class True : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $and passed 'false'. */ class False : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $and passed 'true', 'true'. */ class TrueTrue : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(true << true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $and passed 'true', 'false'. */ class TrueFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(true << false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $and passed 'false', 'true'. */ class FalseTrue : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(false << true)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $and passed 'false', 'false'. */ class FalseFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(false << false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $and passed 'true', 'true', 'true'. */ class TrueTrueTrue : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(true << true << true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $and passed 'true', 'true', 'false'. */ class TrueTrueFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(true << true << false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $and passed '0', '1'. */ class ZeroOne : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(0 << 1)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $and passed '1', '2'. */ class OneTwo : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(1 << 2)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $and passed a field path. */ class FieldPath : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY("$a")); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** A constant expression is optimized to a constant. */ class OptimizeConstantExpression : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** A non constant expression is not optimized. */ class NonConstant : public NoOptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY("$a")); } }; /** An expression beginning with a single constant is optimized. */ class ConstantNonConstantTrue : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(1 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a")); } // note: using $and as serialization of ExpressionCoerceToBool rather than @@ -302,41 +302,41 @@ class ConstantNonConstantTrue : public OptimizeBase { }; class ConstantNonConstantFalse : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(0 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << false); } }; /** An expression with a field path and '1'. */ class NonConstantOne : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY("$a" << 1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a")); } }; /** An expression with a field path and '0'. */ class NonConstantZero : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY("$a" << 0)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << false); } }; /** An expression with two field paths and '1'. */ class NonConstantNonConstantOne : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY("$a" << "$b" << 1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a" << "$b")); } @@ -344,42 +344,42 @@ class NonConstantNonConstantOne : public OptimizeBase { /** An expression with two field paths and '0'. */ class NonConstantNonConstantZero : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY("$a" << "$b" << 0)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << false); } }; /** An expression with '0', '1', and a field path. */ class ZeroOneNonConstant : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(0 << 1 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << false); } }; /** An expression with '1', '1', and a field path. */ class OneOneNonConstant : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(1 << 1 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a")); } }; /** Nested $and expressions. */ class Nested : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY(1 << BSON("$and" << BSON_ARRAY(1)) << "$a" << "$b")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a" << "$b")); } @@ -387,12 +387,12 @@ class Nested : public OptimizeBase { /** Nested $and expressions containing a nested value evaluating to false. */ class NestedZero : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$and" << BSON_ARRAY( 1 << BSON("$and" << BSON_ARRAY(BSON("$and" << BSON_ARRAY(0)))) << "$a" << "$b")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << false); } }; @@ -403,7 +403,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("expression") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/expression_bm.cpp b/src/mongo/db/pipeline/expression_bm.cpp index 3ab1a1289f8..bc880a9a279 100644 --- a/src/mongo/db/pipeline/expression_bm.cpp +++ b/src/mongo/db/pipeline/expression_bm.cpp @@ -48,7 +48,7 @@ namespace { class ClassicExpressionBenchmarkFixture : public ExpressionBenchmarkFixture { void benchmarkExpression(BSONObj expressionSpec, benchmark::State& state, - const std::vector& documents) override final { + const std::vector& documents) final { QueryTestServiceContext testServiceContext; auto opContext = testServiceContext.makeOperationContext(); NamespaceString nss = NamespaceString::createNamespaceString_forTest("test.bm"); diff --git a/src/mongo/db/pipeline/expression_compare_test.cpp b/src/mongo/db/pipeline/expression_compare_test.cpp index a39cedbb8c6..ce8bbfc39f9 100644 --- a/src/mongo/db/pipeline/expression_compare_test.cpp +++ b/src/mongo/db/pipeline/expression_compare_test.cpp @@ -115,13 +115,13 @@ protected: }; class FieldRangeOptimize : public OptimizeBase { - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return spec(); } }; class NoOptimize : public OptimizeBase { - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return spec(); } }; @@ -146,23 +146,23 @@ public: } protected: - virtual BSONObj spec() = 0; + BSONObj spec() override = 0; virtual BSONObj expectedResult() = 0; private: - virtual BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << expectedResult().firstElement()); } }; class ExpectedTrue : public ExpectedResultBase { - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << true); } }; class ExpectedFalse : public ExpectedResultBase { - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << false); } }; @@ -184,188 +184,188 @@ protected: /** $eq with first < second. */ class EqLt : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1 << 2)); } }; /** $eq with first == second. */ class EqEq : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1 << 1)); } }; /** $eq with first > second. */ class EqGt : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1 << 0)); } }; /** $ne with first < second. */ class NeLt : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$ne" << BSON_ARRAY(1 << 2)); } }; /** $ne with first == second. */ class NeEq : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$ne" << BSON_ARRAY(1 << 1)); } }; /** $ne with first > second. */ class NeGt : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$ne" << BSON_ARRAY(1 << 0)); } }; /** $gt with first < second. */ class GtLt : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$gt" << BSON_ARRAY(1 << 2)); } }; /** $gt with first == second. */ class GtEq : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$gt" << BSON_ARRAY(1 << 1)); } }; /** $gt with first > second. */ class GtGt : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$gt" << BSON_ARRAY(1 << 0)); } }; /** $gte with first < second. */ class GteLt : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$gte" << BSON_ARRAY(1 << 2)); } }; /** $gte with first == second. */ class GteEq : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$gte" << BSON_ARRAY(1 << 1)); } }; /** $gte with first > second. */ class GteGt : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$gte" << BSON_ARRAY(1 << 0)); } }; /** $lt with first < second. */ class LtLt : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$lt" << BSON_ARRAY(1 << 2)); } }; /** $lt with first == second. */ class LtEq : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$lt" << BSON_ARRAY(1 << 1)); } }; /** $lt with first > second. */ class LtGt : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$lt" << BSON_ARRAY(1 << 0)); } }; /** $lte with first < second. */ class LteLt : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$lte" << BSON_ARRAY(1 << 2)); } }; /** $lte with first == second. */ class LteEq : public ExpectedTrue { - BSONObj spec() { + BSONObj spec() override { return BSON("$lte" << BSON_ARRAY(1 << 1)); } }; /** $lte with first > second. */ class LteGt : public ExpectedFalse { - BSONObj spec() { + BSONObj spec() override { return BSON("$lte" << BSON_ARRAY(1 << 0)); } }; /** $cmp with first < second. */ class CmpLt : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$cmp" << BSON_ARRAY(1 << 2)); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << -1); } }; /** $cmp with first == second. */ class CmpEq : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$cmp" << BSON_ARRAY(1 << 1)); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 0); } }; /** $cmp with first > second. */ class CmpGt : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$cmp" << BSON_ARRAY(1 << 0)); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 1); } }; /** $cmp results are bracketed to an absolute value of 1. */ class CmpBracketed : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$cmp" << BSON_ARRAY("z" << "a")); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 1); } }; /** Zero operands provided. */ class ZeroOperands : public ParseError { - BSONObj spec() { + BSONObj spec() override { return BSON("$ne" << BSONArray()); } }; /** One operand provided. */ class OneOperand : public ParseError { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1)); } }; /** Three operands provided. */ class ThreeOperands : public ParseError { - BSONObj spec() { + BSONObj spec() override { return BSON("$gt" << BSON_ARRAY(2 << 3 << 4)); } }; @@ -388,31 +388,31 @@ public: * ExpressionNary::optimize(). */ class OptimizeConstants : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1 << 1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** $cmp is not optimized. */ class NoOptimizeCmp : public NoOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$cmp" << BSON_ARRAY(1 << "$a")); } }; /** $ne is not optimized. */ class NoOptimizeNe : public NoOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$ne" << BSON_ARRAY(1 << "$a")); } }; /** No optimization is performend without a constant. */ class NoOptimizeNoConstant : public NoOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$ne" << BSON_ARRAY("$a" << "$b")); } @@ -420,84 +420,84 @@ class NoOptimizeNoConstant : public NoOptimize { /** No optimization is performend without an immediate field path. */ class NoOptimizeWithoutFieldPath : public NoOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(BSON("$and" << BSON_ARRAY("$a")) << 1)); } }; /** No optimization is performend without an immediate field path. */ class NoOptimizeWithoutFieldPathReverse : public NoOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1 << BSON("$and" << BSON_ARRAY("$a")))); } }; /** An equality expression is optimized. */ class OptimizeEq : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY("$a" << 1)); } }; /** A reverse sense equality expression is optimized. */ class OptimizeEqReverse : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$eq" << BSON_ARRAY(1 << "$a")); } }; /** A $lt expression is optimized. */ class OptimizeLt : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$lt" << BSON_ARRAY("$a" << 1)); } }; /** A reverse sense $lt expression is optimized. */ class OptimizeLtReverse : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$lt" << BSON_ARRAY(1 << "$a")); } }; /** A $lte expression is optimized. */ class OptimizeLte : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$lte" << BSON_ARRAY("$b" << 2)); } }; /** A reverse sense $lte expression is optimized. */ class OptimizeLteReverse : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$lte" << BSON_ARRAY(2 << "$b")); } }; /** A $gt expression is optimized. */ class OptimizeGt : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$gt" << BSON_ARRAY("$b" << 2)); } }; /** A reverse sense $gt expression is optimized. */ class OptimizeGtReverse : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$gt" << BSON_ARRAY(2 << "$b")); } }; /** A $gte expression is optimized. */ class OptimizeGte : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$gte" << BSON_ARRAY("$b" << 2)); } }; /** A reverse sense $gte expression is optimized. */ class OptimizeGteReverse : public FieldRangeOptimize { - BSONObj spec() { + BSONObj spec() override { return BSON("$gte" << BSON_ARRAY(2 << "$b")); } }; @@ -508,7 +508,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("expression") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/expression_dependencies.cpp b/src/mongo/db/pipeline/expression_dependencies.cpp index 6ff681e5d5e..7ccaba1e27c 100644 --- a/src/mongo/db/pipeline/expression_dependencies.cpp +++ b/src/mongo/db/pipeline/expression_dependencies.cpp @@ -61,147 +61,147 @@ public: // To avoid overloaded-virtual warnings. using ExpressionConstVisitor::visit; - void visit(const ExpressionAbs*) {} - void visit(const ExpressionAdd*) {} - void visit(const ExpressionAllElementsTrue*) {} - void visit(const ExpressionAnd*) {} - void visit(const ExpressionAnyElementTrue*) {} - void visit(const ExpressionArray*) {} - void visit(const ExpressionArrayElemAt*) {} - void visit(const ExpressionBitAnd*) {} - void visit(const ExpressionBitOr*) {} - void visit(const ExpressionBitXor*) {} - void visit(const ExpressionBitNot*) {} - void visit(const ExpressionFirst*) {} - void visit(const ExpressionLast*) {} - void visit(const ExpressionObjectToArray*) {} - void visit(const ExpressionArrayToObject*) {} - void visit(const ExpressionBsonSize*) {} - void visit(const ExpressionCeil*) {} - void visit(const ExpressionCoerceToBool*) {} - void visit(const ExpressionCompare*) {} - void visit(const ExpressionConcat*) {} - void visit(const ExpressionConcatArrays*) {} - void visit(const ExpressionDateAdd*) {} - void visit(const ExpressionDateDiff*) {} - void visit(const ExpressionDateFromString*) {} - void visit(const ExpressionDateFromParts*) {} - void visit(const ExpressionDateSubtract*) {} - void visit(const ExpressionDateToParts*) {} - void visit(const ExpressionDateToString*) {} - void visit(const ExpressionDateTrunc*) {} - void visit(const ExpressionDivide*) {} - void visit(const ExpressionExp*) {} - void visit(const ExpressionFilter*) {} - void visit(const ExpressionFloor*) {} - void visit(const ExpressionFunction*) {} - void visit(const ExpressionIn*) {} - void visit(const ExpressionIndexOfArray*) {} - void visit(const ExpressionIndexOfBytes*) {} - void visit(const ExpressionIndexOfCP*) {} - void visit(const ExpressionInternalJsEmit*) {} - void visit(const ExpressionIsNumber*) {} - void visit(const ExpressionLn*) {} - void visit(const ExpressionLog*) {} - void visit(const ExpressionLog10*) {} - void visit(const ExpressionMap*) {} - void visit(const ExpressionMod*) {} - void visit(const ExpressionMultiply*) {} - void visit(const ExpressionNot*) {} - void visit(const ExpressionOr*) {} - void visit(const ExpressionPow*) {} - void visit(const ExpressionRange*) {} - void visit(const ExpressionReduce*) {} - void visit(const ExpressionReplaceOne*) {} - void visit(const ExpressionReplaceAll*) {} - void visit(const ExpressionSetDifference*) {} - void visit(const ExpressionSetEquals*) {} - void visit(const ExpressionSetIntersection*) {} - void visit(const ExpressionSetIsSubset*) {} - void visit(const ExpressionSetUnion*) {} - void visit(const ExpressionSize*) {} - void visit(const ExpressionReverseArray*) {} - void visit(const ExpressionSortArray*) {} - void visit(const ExpressionSlice*) {} - void visit(const ExpressionIsArray*) {} - void visit(const ExpressionRound*) {} - void visit(const ExpressionSplit*) {} - void visit(const ExpressionSqrt*) {} - void visit(const ExpressionStrcasecmp*) {} - void visit(const ExpressionSubstrBytes*) {} - void visit(const ExpressionSubstrCP*) {} - void visit(const ExpressionStrLenBytes*) {} - void visit(const ExpressionBinarySize*) {} - void visit(const ExpressionStrLenCP*) {} - void visit(const ExpressionSubtract*) {} - void visit(const ExpressionTestApiVersion*) {} - void visit(const ExpressionToLower*) {} - void visit(const ExpressionToUpper*) {} - void visit(const ExpressionTrim*) {} - void visit(const ExpressionTrunc*) {} - void visit(const ExpressionType*) {} - void visit(const ExpressionZip*) {} - void visit(const ExpressionConvert*) {} - void visit(const ExpressionRegexFind*) {} - void visit(const ExpressionRegexFindAll*) {} - void visit(const ExpressionRegexMatch*) {} - void visit(const ExpressionCosine*) {} - void visit(const ExpressionSine*) {} - void visit(const ExpressionTangent*) {} - void visit(const ExpressionArcCosine*) {} - void visit(const ExpressionArcSine*) {} - void visit(const ExpressionArcTangent*) {} - void visit(const ExpressionArcTangent2*) {} - void visit(const ExpressionHyperbolicArcTangent*) {} - void visit(const ExpressionHyperbolicArcCosine*) {} - void visit(const ExpressionHyperbolicArcSine*) {} - void visit(const ExpressionHyperbolicTangent*) {} - void visit(const ExpressionHyperbolicCosine*) {} - void visit(const ExpressionHyperbolicSine*) {} - void visit(const ExpressionDegreesToRadians*) {} - void visit(const ExpressionRadiansToDegrees*) {} - void visit(const ExpressionDayOfMonth*) {} - void visit(const ExpressionDayOfWeek*) {} - void visit(const ExpressionDayOfYear*) {} - void visit(const ExpressionHour*) {} - void visit(const ExpressionMillisecond*) {} - void visit(const ExpressionMinute*) {} - void visit(const ExpressionMonth*) {} - void visit(const ExpressionSecond*) {} - void visit(const ExpressionWeek*) {} - void visit(const ExpressionIsoWeekYear*) {} - void visit(const ExpressionIsoDayOfWeek*) {} - void visit(const ExpressionIsoWeek*) {} - void visit(const ExpressionYear*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionFromAccumulatorN*) {} - void visit(const ExpressionFromAccumulatorN*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionFromAccumulatorN*) {} - void visit(const ExpressionFromAccumulatorN*) {} - void visit(const ExpressionFromAccumulatorQuantile*) {} - void visit(const ExpressionFromAccumulatorQuantile*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionFromAccumulator*) {} - void visit(const ExpressionTests::Testable*) {} - void visit(const ExpressionToHashedIndexKey*) {} - void visit(const ExpressionGetField*) {} - void visit(const ExpressionSetField*) {} - void visit(const ExpressionTsSecond*) {} - void visit(const ExpressionTsIncrement*) {} - void visit(const ExpressionCond*) {} - void visit(const ExpressionSwitch*) {} - void visit(const ExpressionConstant*) {} - void visit(const ExpressionIfNull*) {} - void visit(const ExpressionObject*) {} - void visit(const ExpressionInternalFLEEqual*) {} - void visit(const ExpressionInternalFLEBetween*) {} - void visit(const ExpressionInternalOwningShard*) {} - void visit(const ExpressionInternalIndexKey*) {} - void visit(const ExpressionInternalKeyStringValue*) {} + void visit(const ExpressionAbs*) override {} + void visit(const ExpressionAdd*) override {} + void visit(const ExpressionAllElementsTrue*) override {} + void visit(const ExpressionAnd*) override {} + void visit(const ExpressionAnyElementTrue*) override {} + void visit(const ExpressionArray*) override {} + void visit(const ExpressionArrayElemAt*) override {} + void visit(const ExpressionBitAnd*) override {} + void visit(const ExpressionBitOr*) override {} + void visit(const ExpressionBitXor*) override {} + void visit(const ExpressionBitNot*) override {} + void visit(const ExpressionFirst*) override {} + void visit(const ExpressionLast*) override {} + void visit(const ExpressionObjectToArray*) override {} + void visit(const ExpressionArrayToObject*) override {} + void visit(const ExpressionBsonSize*) override {} + void visit(const ExpressionCeil*) override {} + void visit(const ExpressionCoerceToBool*) override {} + void visit(const ExpressionCompare*) override {} + void visit(const ExpressionConcat*) override {} + void visit(const ExpressionConcatArrays*) override {} + void visit(const ExpressionDateAdd*) override {} + void visit(const ExpressionDateDiff*) override {} + void visit(const ExpressionDateFromString*) override {} + void visit(const ExpressionDateFromParts*) override {} + void visit(const ExpressionDateSubtract*) override {} + void visit(const ExpressionDateToParts*) override {} + void visit(const ExpressionDateToString*) override {} + void visit(const ExpressionDateTrunc*) override {} + void visit(const ExpressionDivide*) override {} + void visit(const ExpressionExp*) override {} + void visit(const ExpressionFilter*) override {} + void visit(const ExpressionFloor*) override {} + void visit(const ExpressionFunction*) override {} + void visit(const ExpressionIn*) override {} + void visit(const ExpressionIndexOfArray*) override {} + void visit(const ExpressionIndexOfBytes*) override {} + void visit(const ExpressionIndexOfCP*) override {} + void visit(const ExpressionInternalJsEmit*) override {} + void visit(const ExpressionIsNumber*) override {} + void visit(const ExpressionLn*) override {} + void visit(const ExpressionLog*) override {} + void visit(const ExpressionLog10*) override {} + void visit(const ExpressionMap*) override {} + void visit(const ExpressionMod*) override {} + void visit(const ExpressionMultiply*) override {} + void visit(const ExpressionNot*) override {} + void visit(const ExpressionOr*) override {} + void visit(const ExpressionPow*) override {} + void visit(const ExpressionRange*) override {} + void visit(const ExpressionReduce*) override {} + void visit(const ExpressionReplaceOne*) override {} + void visit(const ExpressionReplaceAll*) override {} + void visit(const ExpressionSetDifference*) override {} + void visit(const ExpressionSetEquals*) override {} + void visit(const ExpressionSetIntersection*) override {} + void visit(const ExpressionSetIsSubset*) override {} + void visit(const ExpressionSetUnion*) override {} + void visit(const ExpressionSize*) override {} + void visit(const ExpressionReverseArray*) override {} + void visit(const ExpressionSortArray*) override {} + void visit(const ExpressionSlice*) override {} + void visit(const ExpressionIsArray*) override {} + void visit(const ExpressionRound*) override {} + void visit(const ExpressionSplit*) override {} + void visit(const ExpressionSqrt*) override {} + void visit(const ExpressionStrcasecmp*) override {} + void visit(const ExpressionSubstrBytes*) override {} + void visit(const ExpressionSubstrCP*) override {} + void visit(const ExpressionStrLenBytes*) override {} + void visit(const ExpressionBinarySize*) override {} + void visit(const ExpressionStrLenCP*) override {} + void visit(const ExpressionSubtract*) override {} + void visit(const ExpressionTestApiVersion*) override {} + void visit(const ExpressionToLower*) override {} + void visit(const ExpressionToUpper*) override {} + void visit(const ExpressionTrim*) override {} + void visit(const ExpressionTrunc*) override {} + void visit(const ExpressionType*) override {} + void visit(const ExpressionZip*) override {} + void visit(const ExpressionConvert*) override {} + void visit(const ExpressionRegexFind*) override {} + void visit(const ExpressionRegexFindAll*) override {} + void visit(const ExpressionRegexMatch*) override {} + void visit(const ExpressionCosine*) override {} + void visit(const ExpressionSine*) override {} + void visit(const ExpressionTangent*) override {} + void visit(const ExpressionArcCosine*) override {} + void visit(const ExpressionArcSine*) override {} + void visit(const ExpressionArcTangent*) override {} + void visit(const ExpressionArcTangent2*) override {} + void visit(const ExpressionHyperbolicArcTangent*) override {} + void visit(const ExpressionHyperbolicArcCosine*) override {} + void visit(const ExpressionHyperbolicArcSine*) override {} + void visit(const ExpressionHyperbolicTangent*) override {} + void visit(const ExpressionHyperbolicCosine*) override {} + void visit(const ExpressionHyperbolicSine*) override {} + void visit(const ExpressionDegreesToRadians*) override {} + void visit(const ExpressionRadiansToDegrees*) override {} + void visit(const ExpressionDayOfMonth*) override {} + void visit(const ExpressionDayOfWeek*) override {} + void visit(const ExpressionDayOfYear*) override {} + void visit(const ExpressionHour*) override {} + void visit(const ExpressionMillisecond*) override {} + void visit(const ExpressionMinute*) override {} + void visit(const ExpressionMonth*) override {} + void visit(const ExpressionSecond*) override {} + void visit(const ExpressionWeek*) override {} + void visit(const ExpressionIsoWeekYear*) override {} + void visit(const ExpressionIsoDayOfWeek*) override {} + void visit(const ExpressionIsoWeek*) override {} + void visit(const ExpressionYear*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionFromAccumulatorN*) override {} + void visit(const ExpressionFromAccumulatorN*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionFromAccumulatorN*) override {} + void visit(const ExpressionFromAccumulatorN*) override {} + void visit(const ExpressionFromAccumulatorQuantile*) override {} + void visit(const ExpressionFromAccumulatorQuantile*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionFromAccumulator*) override {} + void visit(const ExpressionTests::Testable*) override {} + void visit(const ExpressionToHashedIndexKey*) override {} + void visit(const ExpressionGetField*) override {} + void visit(const ExpressionSetField*) override {} + void visit(const ExpressionTsSecond*) override {} + void visit(const ExpressionTsIncrement*) override {} + void visit(const ExpressionCond*) override {} + void visit(const ExpressionSwitch*) override {} + void visit(const ExpressionConstant*) override {} + void visit(const ExpressionIfNull*) override {} + void visit(const ExpressionObject*) override {} + void visit(const ExpressionInternalFLEEqual*) override {} + void visit(const ExpressionInternalFLEBetween*) override {} + void visit(const ExpressionInternalOwningShard*) override {} + void visit(const ExpressionInternalIndexKey*) override {} + void visit(const ExpressionInternalKeyStringValue*) override {} }; class DependencyVisitor : public DefaultDependencyVisitor { diff --git a/src/mongo/db/pipeline/expression_field_path_test.cpp b/src/mongo/db/pipeline/expression_field_path_test.cpp index 64b22c094fc..11ef2fd31e3 100644 --- a/src/mongo/db/pipeline/expression_field_path_test.cpp +++ b/src/mongo/db/pipeline/expression_field_path_test.cpp @@ -555,7 +555,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("expression") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/expression_hasher.h b/src/mongo/db/pipeline/expression_hasher.h index e1d2edb2fb1..22a67bab47e 100644 --- a/src/mongo/db/pipeline/expression_hasher.h +++ b/src/mongo/db/pipeline/expression_hasher.h @@ -750,11 +750,11 @@ public: combine(OpType::kAccumulatorPercentile, expr->_method); } - void visit(const ExpressionFromAccumulator* expr) { + void visit(const ExpressionFromAccumulator* expr) override { combine(OpType::kAccumulatorStdDevPop); } - void visit(const ExpressionFromAccumulator* expr) { + void visit(const ExpressionFromAccumulator* expr) override { combine(OpType::kAccumulatorStdDevSamp); } diff --git a/src/mongo/db/pipeline/expression_nary_test.cpp b/src/mongo/db/pipeline/expression_nary_test.cpp index 69d97c0f509..68b2a8000dc 100644 --- a/src/mongo/db/pipeline/expression_nary_test.cpp +++ b/src/mongo/db/pipeline/expression_nary_test.cpp @@ -70,7 +70,7 @@ namespace ExpressionTests { /** A dummy child of ExpressionNary used for testing. */ class Testable : public ExpressionNary { public: - virtual Value evaluate(const Document& root, Variables* variables) const { + Value evaluate(const Document& root, Variables* variables) const override { // Just put all the values in a list. // By default, this is not associative/commutative so the results will change if // instantiated as commutative or associative and operations are reordered. @@ -80,15 +80,15 @@ public: return Value(values); } - virtual const char* getOpName() const { + const char* getOpName() const override { return "$testable"; } - virtual Associativity getAssociativity() const { + Associativity getAssociativity() const override { return _associativity; } - virtual bool isCommutative() const { + bool isCommutative() const override { return _isCommutative; } @@ -183,7 +183,7 @@ public: class ExpressionNaryTest : public unittest::Test { public: - virtual void setUp() override { + void setUp() override { _notAssociativeNorCommutative = Testable::create(&expCtx, ExpressionNary::Associativity::kNone, false); _associativeOnly = Testable::create(&expCtx, ExpressionNary::Associativity::kFull, false); @@ -920,7 +920,7 @@ TEST_F(ExpressionTruncTwoArgTest, NullArg2) { class ExpressionSqrtTest : public ExpressionNaryTestOneArg { public: - virtual void assertEvaluates(Value input, Value output) override { + void assertEvaluates(Value input, Value output) override { _expr = new ExpressionSqrt(&expCtx); ExpressionNaryTestOneArg::assertEvaluates(input, output); } @@ -965,7 +965,7 @@ TEST_F(ExpressionSqrtTest, SqrtNaNArg) { class ExpressionExpTest : public ExpressionNaryTestOneArg { public: - virtual void assertEvaluates(Value input, Value output) override { + void assertEvaluates(Value input, Value output) override { _expr = new ExpressionExp(&expCtx); ExpressionNaryTestOneArg::assertEvaluates(input, output); } @@ -1006,7 +1006,7 @@ TEST_F(ExpressionExpTest, ExpNaNArg) { class ExpressionCeilTest : public ExpressionNaryTestOneArg { public: - virtual void assertEvaluates(Value input, Value output) override { + void assertEvaluates(Value input, Value output) override { _expr = new ExpressionCeil(&expCtx); ExpressionNaryTestOneArg::assertEvaluates(input, output); } @@ -1064,7 +1064,7 @@ TEST_F(ExpressionCeilTest, NullArg) { class ExpressionFloorTest : public ExpressionNaryTestOneArg { public: - virtual void assertEvaluates(Value input, Value output) override { + void assertEvaluates(Value input, Value output) override { _expr = new ExpressionFloor(&expCtx); ExpressionNaryTestOneArg::assertEvaluates(input, output); } diff --git a/src/mongo/db/pipeline/expression_or_test.cpp b/src/mongo/db/pipeline/expression_or_test.cpp index d069649d079..478ab89359a 100644 --- a/src/mongo/db/pipeline/expression_or_test.cpp +++ b/src/mongo/db/pipeline/expression_or_test.cpp @@ -140,164 +140,164 @@ protected: }; class NoOptimizeBase : public OptimizeBase { - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return constify(spec()); } }; /** $or without operands. */ class NoOperands : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSONArray()); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $or passed 'true'. */ class True : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $or passed 'false'. */ class False : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $or passed 'true', 'true'. */ class TrueTrue : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(true << true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $or passed 'true', 'false'. */ class TrueFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(true << false)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $or passed 'false', 'true'. */ class FalseTrue : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(false << true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $or passed 'false', 'false'. */ class FalseFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(false << false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $or passed 'false', 'false', 'false'. */ class FalseFalseFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(false << false << false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $or passed 'false', 'false', 'true'. */ class FalseFalseTrue : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(false << false << true)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $or passed '0', '1'. */ class ZeroOne : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << 1)); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** $or passed '0', 'false'. */ class ZeroFalse : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << false)); } - bool expectedResult() { + bool expectedResult() override { return false; } }; /** $or passed a field path. */ class FieldPath : public ExpectedResultBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY("$a")); } - bool expectedResult() { + bool expectedResult() override { return true; } }; /** A constant expression is optimized to a constant. */ class OptimizeConstantExpression : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** A non constant expression is not optimized. */ class NonConstant : public NoOptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY("$a")); } }; /** An expression beginning with a single constant is optimized. */ class ConstantNonConstantTrue : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(1 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** An expression beginning with a single constant is optimized. */ class ConstantNonConstantFalse : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a")); } // note: using $and as serialization of ExpressionCoerceToBool rather than @@ -306,42 +306,42 @@ class ConstantNonConstantFalse : public OptimizeBase { /** An expression with a field path and '1'. */ class NonConstantOne : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY("$a" << 1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** An expression with a field path and '0'. */ class NonConstantZero : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY("$a" << 0)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a")); } }; /** An expression with two field paths and '1'. */ class NonConstantNonConstantOne : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY("$a" << "$b" << 1)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** An expression with two field paths and '0'. */ class NonConstantNonConstantZero : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY("$a" << "$b" << 0)); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$or" << BSON_ARRAY("$a" << "$b")); } @@ -349,31 +349,31 @@ class NonConstantNonConstantZero : public OptimizeBase { /** An expression with '0', '1', and a field path. */ class ZeroOneNonConstant : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << 1 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; /** An expression with '0', '0', and a field path. */ class ZeroZeroNonConstant : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << 0 << "$a")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$and" << BSON_ARRAY("$a")); } }; /** Nested $or expressions. */ class Nested : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << BSON("$or" << BSON_ARRAY(0)) << "$a" << "$b")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$or" << BSON_ARRAY("$a" << "$b")); } @@ -381,12 +381,12 @@ class Nested : public OptimizeBase { /** Nested $or expressions containing a nested value evaluating to false. */ class NestedOne : public OptimizeBase { - BSONObj spec() { + BSONObj spec() override { return BSON("$or" << BSON_ARRAY(0 << BSON("$or" << BSON_ARRAY(BSON("$or" << BSON_ARRAY(1)))) << "$a" << "$b")); } - BSONObj expectedOptimized() { + BSONObj expectedOptimized() override { return BSON("$const" << true); } }; @@ -395,7 +395,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("expression") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp index 85556f07be2..1e75d43816b 100644 --- a/src/mongo/db/pipeline/expression_test.cpp +++ b/src/mongo/db/pipeline/expression_test.cpp @@ -428,8 +428,8 @@ public: /** $add without operands. */ class NoOperands : public ExpectedResultBase { - void populateOperands(intrusive_ptr& expression) {} - virtual BSONObj expectedResult() { + void populateOperands(intrusive_ptr& expression) override {} + BSONObj expectedResult() override { return BSON("" << 0); } }; @@ -457,10 +457,10 @@ public: }; class SingleOperandBase : public ExpectedResultBase { - void populateOperands(intrusive_ptr& expression) { + void populateOperands(intrusive_ptr& expression) override { expression->addOperand(ExpressionConstant::create(&expCtx, valueFromBson(operand()))); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return operand(); } @@ -471,48 +471,48 @@ protected: /** Single int argument. */ class Int : public SingleOperandBase { - BSONObj operand() { + BSONObj operand() override { return BSON("" << 1); } }; /** Single long argument. */ class Long : public SingleOperandBase { - BSONObj operand() { + BSONObj operand() override { return BSON("" << 5555LL); } }; /** Single double argument. */ class Double : public SingleOperandBase { - BSONObj operand() { + BSONObj operand() override { return BSON("" << 99.99); } }; /** Single Date argument. */ class Date : public SingleOperandBase { - BSONObj operand() { + BSONObj operand() override { return BSON("" << Date_t::fromMillisSinceEpoch(12345)); } }; /** Single null argument. */ class Null : public SingleOperandBase { - BSONObj operand() { + BSONObj operand() override { return BSON("" << BSONNULL); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << BSONNULL); } }; /** Single undefined argument. */ class Undefined : public SingleOperandBase { - BSONObj operand() { + BSONObj operand() override { return fromjson("{'':undefined}"); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << BSONNULL); } }; @@ -528,7 +528,7 @@ public: } protected: - void populateOperands(intrusive_ptr& expression) { + void populateOperands(intrusive_ptr& expression) override { auto expCtx = ExpressionContextForTest{}; expression->addOperand( ExpressionConstant::create(&expCtx, valueFromBson(_reverse ? operand2() : operand1()))); @@ -544,52 +544,52 @@ private: /** Add two ints. */ class IntInt : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 1); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << 5); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 6); } }; /** Adding two large ints produces a long, not an overflowed int. */ class IntIntNoOverflow : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << numeric_limits::max()); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << numeric_limits::max()); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << ((long long)(numeric_limits::max()) + numeric_limits::max())); } }; /** Adding an int and a long produces a long. */ class IntLong : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 1); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << 9LL); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 10LL); } }; /** Adding an int and a long produces a double. */ class IntLongOverflowToDouble : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << numeric_limits::max()); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << numeric_limits::max()); } - BSONObj expectedResult() { + BSONObj expectedResult() override { // When the result cannot be represented in a NumberLong, a NumberDouble is returned. const auto im = numeric_limits::max(); const auto llm = numeric_limits::max(); @@ -600,52 +600,52 @@ class IntLongOverflowToDouble : public TwoOperandBase { /** Adding an int and a double produces a double. */ class IntDouble : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 9); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << 1.1); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 10.1); } }; /** Adding an int and a Date produces a Date. */ class IntDate : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 6); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << Date_t::fromMillisSinceEpoch(123450)); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << Date_t::fromMillisSinceEpoch(123456)); } }; /** Adding a long and a double produces a double. */ class LongDouble : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 9LL); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << 1.1); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << 10.1); } }; /** Adding a long and a double does not overflow. */ class LongDoubleNoOverflow : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << numeric_limits::max()); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << double(numeric_limits::max())); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << static_cast(numeric_limits::max()) + static_cast(numeric_limits::max())); } @@ -653,26 +653,26 @@ class LongDoubleNoOverflow : public TwoOperandBase { /** Adding an int and null. */ class IntNull : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 1); } - BSONObj operand2() { + BSONObj operand2() override { return BSON("" << BSONNULL); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << BSONNULL); } }; /** Adding a long and undefined. */ class LongUndefined : public TwoOperandBase { - BSONObj operand1() { + BSONObj operand1() override { return BSON("" << 5LL); } - BSONObj operand2() { + BSONObj operand2() override { return fromjson("{'':undefined}"); } - BSONObj expectedResult() { + BSONObj expectedResult() override { return BSON("" << BSONNULL); } }; @@ -1845,7 +1845,7 @@ private: }; class Same : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << DOC_ARRAY(1 << 2)) << "expected" << DOC("$setIsSubset" << true << "$setEquals" << true << "$setIntersection" << DOC_ARRAY(1 << 2) @@ -1855,7 +1855,7 @@ class Same : public ExpectedResultBase { }; class Redundant : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << DOC_ARRAY(1 << 2 << 2)) << "expected" << DOC("$setIsSubset" << true << "$setEquals" << true << "$setIntersection" << DOC_ARRAY(1 << 2) @@ -1865,7 +1865,7 @@ class Redundant : public ExpectedResultBase { }; class DoubleRedundant : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC( "input" << DOC_ARRAY(DOC_ARRAY(1 << 1 << 2) << DOC_ARRAY(1 << 2 << 2)) << "expected" << DOC("$setIsSubset" << true << "$setEquals" << true << "$setIntersection" @@ -1875,7 +1875,7 @@ class DoubleRedundant : public ExpectedResultBase { }; class Super : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << DOC_ARRAY(1)) << "expected" << DOC("$setIsSubset" << false << "$setEquals" << false << "$setIntersection" << DOC_ARRAY(1) @@ -1885,7 +1885,7 @@ class Super : public ExpectedResultBase { }; class SuperWithRedundant : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2 << 2) << DOC_ARRAY(1)) << "expected" << DOC("$setIsSubset" << false << "$setEquals" << false << "$setIntersection" << DOC_ARRAY(1) @@ -1895,7 +1895,7 @@ class SuperWithRedundant : public ExpectedResultBase { }; class Sub : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1) << DOC_ARRAY(1 << 2)) << "expected" << DOC("$setIsSubset" << true << "$setEquals" << false << "$setIntersection" << DOC_ARRAY(1) @@ -1905,7 +1905,7 @@ class Sub : public ExpectedResultBase { }; class SameBackwards : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << DOC_ARRAY(2 << 1)) << "expected" << DOC("$setIsSubset" << true << "$setEquals" << true << "$setIntersection" << DOC_ARRAY(1 << 2) @@ -1915,7 +1915,7 @@ class SameBackwards : public ExpectedResultBase { }; class NoOverlap : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << DOC_ARRAY(8 << 4)) << "expected" << DOC("$setIsSubset" << false << "$setEquals" << false << "$setIntersection" << vector() @@ -1925,7 +1925,7 @@ class NoOverlap : public ExpectedResultBase { }; class Overlap : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << DOC_ARRAY(8 << 2 << 4)) << "expected" << DOC("$setIsSubset" << false << "$setEquals" << false << "$setIntersection" << DOC_ARRAY(2) @@ -1935,7 +1935,7 @@ class Overlap : public ExpectedResultBase { }; class LastNull : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << Value(BSONNULL)) << "expected" << DOC("$setIntersection" << BSONNULL << "$setUnion" << BSONNULL << "$setDifference" << BSONNULL) @@ -1946,7 +1946,7 @@ class LastNull : public ExpectedResultBase { }; class FirstNull : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(Value(BSONNULL) << DOC_ARRAY(1 << 2)) << "expected" << DOC("$setIntersection" << BSONNULL << "$setUnion" << BSONNULL << "$setDifference" << BSONNULL) @@ -1957,7 +1957,7 @@ class FirstNull : public ExpectedResultBase { }; class LeftNullAndRightEmpty : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(Value(BSONNULL) << vector()) << "expected" << DOC("$setIntersection" << BSONNULL << "$setUnion" << BSONNULL << "$setDifference" << BSONNULL) @@ -1968,7 +1968,7 @@ class LeftNullAndRightEmpty : public ExpectedResultBase { }; class RightNullAndLeftEmpty : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(vector() << Value(BSONNULL)) << "expected" << DOC("$setIntersection" << BSONNULL << "$setUnion" << BSONNULL << "$setDifference" << BSONNULL) @@ -1979,7 +1979,7 @@ class RightNullAndLeftEmpty : public ExpectedResultBase { }; class NoArg : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC( "input" << vector() << "expected" << DOC("$setIntersection" << vector() << "$setUnion" << vector()) @@ -1991,7 +1991,7 @@ class NoArg : public ExpectedResultBase { }; class OneArg : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2)) << "expected" << DOC("$setIntersection" << DOC_ARRAY(1 << 2) << "$setUnion" << DOC_ARRAY(1 << 2)) @@ -2003,7 +2003,7 @@ class OneArg : public ExpectedResultBase { }; class EmptyArg : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC( "input" << DOC_ARRAY(vector()) << "expected" << DOC("$setIntersection" << vector() << "$setUnion" << vector()) @@ -2015,7 +2015,7 @@ class EmptyArg : public ExpectedResultBase { }; class LeftArgEmpty : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(vector() << DOC_ARRAY(1 << 2)) << "expected" << DOC("$setIntersection" << vector() << "$setUnion" << DOC_ARRAY(1 << 2) << "$setIsSubset" << true @@ -2025,7 +2025,7 @@ class LeftArgEmpty : public ExpectedResultBase { }; class RightArgEmpty : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2) << vector()) << "expected" << DOC("$setIntersection" << vector() << "$setUnion" << DOC_ARRAY(1 << 2) << "$setIsSubset" << false @@ -2035,7 +2035,7 @@ class RightArgEmpty : public ExpectedResultBase { }; class ManyArgs : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(8 << 3) << DOC_ARRAY("asdf"_sd << "foo"_sd) @@ -2054,7 +2054,7 @@ class ManyArgs : public ExpectedResultBase { }; class ManyArgsEqual : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1 << 2 << 4) << DOC_ARRAY(1 << 2 << 2 << 4) << DOC_ARRAY(4 << 1 << 2) << DOC_ARRAY(2 << 1 << 1 << 4)) @@ -2104,61 +2104,61 @@ private: }; class NullBegin : public ExpectedResultBase { - string a() { + string a() override { return string("\0ab", 3); } - string b() { + string b() override { return string("\0AB", 3); } - int expectedResult() { + int expectedResult() override { return 0; } }; class NullEnd : public ExpectedResultBase { - string a() { + string a() override { return string("ab\0", 3); } - string b() { + string b() override { return string("aB\0", 3); } - int expectedResult() { + int expectedResult() override { return 0; } }; class NullMiddleLt : public ExpectedResultBase { - string a() { + string a() override { return string("a\0a", 3); } - string b() { + string b() override { return string("a\0B", 3); } - int expectedResult() { + int expectedResult() override { return -1; } }; class NullMiddleEq : public ExpectedResultBase { - string a() { + string a() override { return string("a\0b", 3); } - string b() { + string b() override { return string("a\0B", 3); } - int expectedResult() { + int expectedResult() override { return 0; } }; class NullMiddleGt : public ExpectedResultBase { - string a() { + string a() override { return string("a\0c", 3); } - string b() { + string b() override { return string("a\0B", 3); } - int expectedResult() { + int expectedResult() override { return 1; } }; @@ -2243,96 +2243,96 @@ private: /** Retrieve a full string containing a null character. */ class FullNull : public ExpectedResultBase { - string str() { + string str() override { return string("a\0b", 3); } - int offset() { + int offset() override { return 0; } - int length() { + int length() override { return 3; } - string expectedResult() { + string expectedResult() override { return str(); } }; /** Retrieve a substring beginning with a null character. */ class BeginAtNull : public ExpectedResultBase { - string str() { + string str() override { return string("a\0b", 3); } - int offset() { + int offset() override { return 1; } - int length() { + int length() override { return 2; } - string expectedResult() { + string expectedResult() override { return string("\0b", 2); } }; /** Retrieve a substring ending with a null character. */ class EndAtNull : public ExpectedResultBase { - string str() { + string str() override { return string("a\0b", 3); } - int offset() { + int offset() override { return 0; } - int length() { + int length() override { return 2; } - string expectedResult() { + string expectedResult() override { return string("a\0", 2); } }; /** Drop a beginning null character. */ class DropBeginningNull : public ExpectedResultBase { - string str() { + string str() override { return string("\0b", 2); } - int offset() { + int offset() override { return 1; } - int length() { + int length() override { return 1; } - string expectedResult() { + string expectedResult() override { return "b"; } }; /** Drop an ending null character. */ class DropEndingNull : public ExpectedResultBase { - string str() { + string str() override { return string("a\0", 2); } - int offset() { + int offset() override { return 0; } - int length() { + int length() override { return 1; } - string expectedResult() { + string expectedResult() override { return "a"; } }; /** When length is negative, the remainder of the string should be returned. */ class NegativeLength : public ExpectedResultBase { - string str() { + string str() override { return string("abcdefghij"); } - int offset() { + int offset() override { return 2; } - int length() { + int length() override { return -1; } - string expectedResult() { + string expectedResult() override { return "cdefghij"; } }; @@ -2766,30 +2766,30 @@ private: /** String beginning with a null character. */ class NullBegin : public ExpectedResultBase { - string str() { + string str() override { return string("\0aB", 3); } - string expectedResult() { + string expectedResult() override { return string("\0ab", 3); } }; /** String containing a null character. */ class NullMiddle : public ExpectedResultBase { - string str() { + string str() override { return string("a\0B", 3); } - string expectedResult() { + string expectedResult() override { return string("a\0b", 3); } }; /** String ending with a null character. */ class NullEnd : public ExpectedResultBase { - string str() { + string str() override { return string("aB\0", 3); } - string expectedResult() { + string expectedResult() override { return string("ab\0", 3); } }; @@ -2824,30 +2824,30 @@ private: /** String beginning with a null character. */ class NullBegin : public ExpectedResultBase { - string str() { + string str() override { return string("\0aB", 3); } - string expectedResult() { + string expectedResult() override { return string("\0AB", 3); } }; /** String containing a null character. */ class NullMiddle : public ExpectedResultBase { - string str() { + string str() override { return string("a\0B", 3); } - string expectedResult() { + string expectedResult() override { return string("A\0B", 3); } }; /** String ending with a null character. */ class NullEnd : public ExpectedResultBase { - string str() { + string str() override { return string("aB\0", 3); } - string expectedResult() { + string expectedResult() override { return string("AB\0", 3); } }; @@ -2907,49 +2907,49 @@ private: }; class JustFalse : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(false)) << "expected" << DOC("$allElementsTrue" << false << "$anyElementTrue" << false)); } }; class JustTrue : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(true)) << "expected" << DOC("$allElementsTrue" << true << "$anyElementTrue" << true)); } }; class OneTrueOneFalse : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(true << false)) << "expected" << DOC("$allElementsTrue" << false << "$anyElementTrue" << true)); } }; class Empty : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(vector()) << "expected" << DOC("$allElementsTrue" << true << "$anyElementTrue" << false)); } }; class TrueViaInt : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(1)) << "expected" << DOC("$allElementsTrue" << true << "$anyElementTrue" << true)); } }; class FalseViaInt : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(DOC_ARRAY(0)) << "expected" << DOC("$allElementsTrue" << false << "$anyElementTrue" << false)); } }; class Null : public ExpectedResultBase { - Document getSpec() { + Document getSpec() override { return DOC("input" << DOC_ARRAY(BSONNULL) << "error" << DOC_ARRAY("$allElementsTrue"_sd << "$anyElementTrue"_sd)); @@ -3451,7 +3451,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("expression") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/db/pipeline/expression_trigonometric.h b/src/mongo/db/pipeline/expression_trigonometric.h index e5c7ea101a7..30b96d2fb9e 100644 --- a/src/mongo/db/pipeline/expression_trigonometric.h +++ b/src/mongo/db/pipeline/expression_trigonometric.h @@ -160,7 +160,7 @@ public: /** * evaluateNumericArg evaluates the implented trig function on one numericArg. */ - Value evaluateNumericArg(const Value& numericArg) const { + Value evaluateNumericArg(const Value& numericArg) const override { switch (numericArg.getType()) { case BSONType::NumberDouble: { auto input = numericArg.getDouble(); @@ -205,7 +205,7 @@ public: /** * getOpName returns the name of the operation, e.g., $sin */ - virtual const char* getOpName() const = 0; + const char* getOpName() const override = 0; }; /** @@ -248,7 +248,7 @@ public: /** * getOpName returns the name of the operation, e.g., $sinh */ - virtual const char* getOpName() const = 0; + const char* getOpName() const override = 0; }; class ExpressionArcTangent2 final : public ExpressionTwoNumericArgs { diff --git a/src/mongo/db/pipeline/granularity_rounder.h b/src/mongo/db/pipeline/granularity_rounder.h index d9b53abfe5a..51c4ccfbfe4 100644 --- a/src/mongo/db/pipeline/granularity_rounder.h +++ b/src/mongo/db/pipeline/granularity_rounder.h @@ -144,10 +144,10 @@ public: const boost::intrusive_ptr& expCtx, std::vector baseSeries, std::string name); - Value roundUp(Value value); - Value roundDown(Value value); + Value roundUp(Value value) override; + Value roundDown(Value value) override; - std::string getName(); + std::string getName() override; /** * Returns a vector that represents the preferred number series that this @@ -175,9 +175,9 @@ class GranularityRounderPowersOfTwo final : public GranularityRounder { public: static boost::intrusive_ptr create( const boost::intrusive_ptr& expCtx); - Value roundUp(Value value); - Value roundDown(Value value); - std::string getName(); + Value roundUp(Value value) override; + Value roundDown(Value value) override; + std::string getName() override; private: GranularityRounderPowersOfTwo(const boost::intrusive_ptr& expCtx) diff --git a/src/mongo/db/pipeline/lite_parsed_document_source.h b/src/mongo/db/pipeline/lite_parsed_document_source.h index 633ad3d33ad..95c20c8479d 100644 --- a/src/mongo/db/pipeline/lite_parsed_document_source.h +++ b/src/mongo/db/pipeline/lite_parsed_document_source.h @@ -316,8 +316,8 @@ public: return {_foreignNss}; } - virtual PrivilegeVector requiredPrivileges(bool isMongos, - bool bypassDocumentValidation) const = 0; + PrivilegeVector requiredPrivileges(bool isMongos, + bool bypassDocumentValidation) const override = 0; protected: NamespaceString _foreignNss; @@ -336,10 +336,9 @@ public: boost::optional foreignNss, boost::optional pipeline); - stdx::unordered_set getInvolvedNamespaces() const final override; + stdx::unordered_set getInvolvedNamespaces() const final; - virtual void getForeignExecutionNamespaces( - stdx::unordered_set& nssSet) const override; + void getForeignExecutionNamespaces(stdx::unordered_set& nssSet) const override; Status checkShardedForeignCollAllowed(const NamespaceString& nss, bool inMultiDocumentTransaction) const override; diff --git a/src/mongo/db/pipeline/pipeline_test.cpp b/src/mongo/db/pipeline/pipeline_test.cpp index b88f9312de4..f99a62e63db 100644 --- a/src/mongo/db/pipeline/pipeline_test.cpp +++ b/src/mongo/db/pipeline/pipeline_test.cpp @@ -132,7 +132,8 @@ class StubExplainInterface : public StubMongoProcessInterface { return BSON("pipeline" << bab.arr()); } std::unique_ptr attachCursorSourceToPipelineForLocalRead( - Pipeline* ownedPipeline, boost::optional aggRequest) { + Pipeline* ownedPipeline, + boost::optional aggRequest) override { std::unique_ptr pipeline( ownedPipeline, PipelineDeleter(ownedPipeline->getContext()->opCtx)); return pipeline; diff --git a/src/mongo/db/pipeline/plan_executor_pipeline.h b/src/mongo/db/pipeline/plan_executor_pipeline.h index 203ee2cb413..5d45ac49246 100644 --- a/src/mongo/db/pipeline/plan_executor_pipeline.h +++ b/src/mongo/db/pipeline/plan_executor_pipeline.h @@ -201,9 +201,9 @@ public: return _pipeline->getTypeString(); } - PlanExecutor::QueryFramework getQueryFramework() const override final; + PlanExecutor::QueryFramework getQueryFramework() const final; - bool usesCollectionAcquisitions() const override final { + bool usesCollectionAcquisitions() const final { // TODO SERVER-78724: Replace this whenever aggregations use shard role acquisitions. return false; } diff --git a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.h b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.h index 46ec6677b68..d3fba2e8060 100644 --- a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.h @@ -88,7 +88,7 @@ class CommonMongodProcessInterface : public CommonProcessInterface { public: using CommonProcessInterface::CommonProcessInterface; - virtual ~CommonMongodProcessInterface() = default; + ~CommonMongodProcessInterface() override = default; std::unique_ptr createTransactionHistoryIterator( repl::OpTime time) const final; @@ -118,7 +118,7 @@ public: BSONObjBuilder* builder) const final; Status appendQueryExecStats(OperationContext* opCtx, const NamespaceString& nss, - BSONObjBuilder* builder) const final override; + BSONObjBuilder* builder) const final; BSONObj getCollectionOptions(OperationContext* opCtx, const NamespaceString& nss) override; std::unique_ptr attachCursorSourceToPipelineForLocalRead( Pipeline* pipeline, diff --git a/src/mongo/db/pipeline/process_interface/common_process_interface.h b/src/mongo/db/pipeline/process_interface/common_process_interface.h index bf0320839b6..90f3476b4da 100644 --- a/src/mongo/db/pipeline/process_interface/common_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/common_process_interface.h @@ -65,7 +65,7 @@ namespace mongo { class CommonProcessInterface : public MongoProcessInterface { public: using MongoProcessInterface::MongoProcessInterface; - virtual ~CommonProcessInterface() = default; + ~CommonProcessInterface() override = default; /** * Estimates the size of writes that will be executed on the current node. Note that this @@ -177,10 +177,10 @@ public: CurrentOpCursorMode cursorMode, CurrentOpBacktraceMode backtraceMode) const final; - virtual std::vector collectDocumentKeyFieldsActingAsRouter( + std::vector collectDocumentKeyFieldsActingAsRouter( OperationContext*, const NamespaceString&) const override; - virtual void updateClientOperationTime(OperationContext* opCtx) const final; + void updateClientOperationTime(OperationContext* opCtx) const final; boost::optional refreshAndGetCollectionVersion( const boost::intrusive_ptr& expCtx, diff --git a/src/mongo/db/pipeline/process_interface/mongos_process_interface.h b/src/mongo/db/pipeline/process_interface/mongos_process_interface.h index 49cb02546c2..27ce8e2ad09 100644 --- a/src/mongo/db/pipeline/process_interface/mongos_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/mongos_process_interface.h @@ -92,7 +92,7 @@ class MongosProcessInterface : public CommonProcessInterface { public: using CommonProcessInterface::CommonProcessInterface; - virtual ~MongosProcessInterface() = default; + ~MongosProcessInterface() override = default; std::unique_ptr getWriteSizeEstimator( OperationContext* opCtx, const NamespaceString& ns) const final; diff --git a/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.h b/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.h index f1927504097..fde1ecb1710 100644 --- a/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.h @@ -94,7 +94,8 @@ public: ShardTargetingPolicy shardTargetingPolicy = ShardTargetingPolicy::kAllowed, boost::optional readConcern = boost::none) override; - BSONObj preparePipelineAndExplain(Pipeline* ownedPipeline, ExplainOptions::Verbosity verbosity); + BSONObj preparePipelineAndExplain(Pipeline* ownedPipeline, + ExplainOptions::Verbosity verbosity) override; boost::optional refreshAndGetCollectionVersion( const boost::intrusive_ptr& expCtx, @@ -102,7 +103,7 @@ public: return boost::none; // Nothing is sharded here. } - virtual void checkRoutingInfoEpochOrThrow( + void checkRoutingInfoEpochOrThrow( const boost::intrusive_ptr& expCtx, const NamespaceString& nss, ChunkVersion targetCollectionPlacementVersion) const override { diff --git a/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.h b/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.h index aaaa0e68d81..6284bd12d12 100644 --- a/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.h @@ -86,7 +86,7 @@ public: ReplicaSetNodeProcessInterface(std::shared_ptr executor) : NonShardServerProcessInterface(std::move(executor)) {} - virtual ~ReplicaSetNodeProcessInterface() = default; + ~ReplicaSetNodeProcessInterface() override = default; Status insert(const boost::intrusive_ptr& expCtx, const NamespaceString& ns, @@ -102,30 +102,31 @@ public: bool multi, boost::optional targetEpoch) override; - void renameIfOptionsAndIndexesHaveNotChanged(OperationContext* opCtx, - const NamespaceString& sourceNs, - const NamespaceString& targetNs, - bool dropTarget, - bool stayTemp, - const BSONObj& originalCollectionOptions, - const std::list& originalIndexes); + void renameIfOptionsAndIndexesHaveNotChanged( + OperationContext* opCtx, + const NamespaceString& sourceNs, + const NamespaceString& targetNs, + bool dropTarget, + bool stayTemp, + const BSONObj& originalCollectionOptions, + const std::list& originalIndexes) override; void createCollection(OperationContext* opCtx, const DatabaseName& dbName, - const BSONObj& cmdObj); - void dropCollection(OperationContext* opCtx, const NamespaceString& collection); + const BSONObj& cmdObj) override; + void dropCollection(OperationContext* opCtx, const NamespaceString& collection) override; void createIndexesOnEmptyCollection(OperationContext* opCtx, const NamespaceString& ns, - const std::vector& indexSpecs); + const std::vector& indexSpecs) override; void createTimeseriesView(OperationContext* opCtx, const NamespaceString& ns, const BSONObj& cmdObj, - const TimeseriesOptions& userOpts); + const TimeseriesOptions& userOpts) override; Status insertTimeseries(const boost::intrusive_ptr& expCtx, const NamespaceString& ns, std::unique_ptr insertCommand, const WriteConcernOptions& wc, - boost::optional targetEpoch); + boost::optional targetEpoch) override; private: /** diff --git a/src/mongo/db/pipeline/process_interface/standalone_process_interface.h b/src/mongo/db/pipeline/process_interface/standalone_process_interface.h index 0f8b86bc183..918d4e103e1 100644 --- a/src/mongo/db/pipeline/process_interface/standalone_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/standalone_process_interface.h @@ -54,7 +54,7 @@ public: return std::make_unique(); } - virtual ~StandaloneProcessInterface() = default; + ~StandaloneProcessInterface() override = default; }; } // namespace mongo diff --git a/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h b/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h index 3d9dc1433d2..25a9a20e3a7 100644 --- a/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h @@ -58,7 +58,7 @@ namespace mongo { class StubShardFilterer : public ShardFilterer { public: - std::unique_ptr clone() const { + std::unique_ptr clone() const override { MONGO_UNREACHABLE; } @@ -113,7 +113,7 @@ public: const NamespaceString& nss, UUID collectionUUID, const Document& documentKey, - boost::optional readConcern); + boost::optional readConcern) override; private: std::deque _mockResults; diff --git a/src/mongo/db/pipeline/process_interface/stub_mongo_process_interface.h b/src/mongo/db/pipeline/process_interface/stub_mongo_process_interface.h index 35ced0a481d..5a684f4c3c9 100644 --- a/src/mongo/db/pipeline/process_interface/stub_mongo_process_interface.h +++ b/src/mongo/db/pipeline/process_interface/stub_mongo_process_interface.h @@ -46,7 +46,7 @@ class StubMongoProcessInterface : public MongoProcessInterface { public: StubMongoProcessInterface() : MongoProcessInterface(nullptr) {} using MongoProcessInterface::MongoProcessInterface; - virtual ~StubMongoProcessInterface() = default; + ~StubMongoProcessInterface() override = default; std::unique_ptr createTransactionHistoryIterator( repl::OpTime time) const override { @@ -284,19 +284,19 @@ public: const NamespaceString& nss, UUID collectionUUID, const Document& documentKey, - boost::optional readConcern) { + boost::optional readConcern) override { MONGO_UNREACHABLE; } boost::optional lookupSingleDocumentLocally( const boost::intrusive_ptr& expCtx, const NamespaceString& nss, - const Document& documentKey) { + const Document& documentKey) override { MONGO_UNREACHABLE_TASSERT(6148002); } std::vector getIdleCursors(const boost::intrusive_ptr& expCtx, - CurrentOpUserMode userMode) const { + CurrentOpUserMode userMode) const override { MONGO_UNREACHABLE; } @@ -363,31 +363,31 @@ public: } std::unique_ptr createTemporaryRecordStore( - const boost::intrusive_ptr& expCtx, KeyFormat keyFormat) const { + const boost::intrusive_ptr& expCtx, KeyFormat keyFormat) const override { MONGO_UNREACHABLE; } void writeRecordsToRecordStore(const boost::intrusive_ptr& expCtx, RecordStore* rs, std::vector* records, - const std::vector& ts) const { + const std::vector& ts) const override { MONGO_UNREACHABLE; } Document readRecordFromRecordStore(const boost::intrusive_ptr& expCtx, RecordStore* rs, - RecordId rID) const { + RecordId rID) const override { MONGO_UNREACHABLE; } void deleteRecordFromRecordStore(const boost::intrusive_ptr& expCtx, RecordStore* rs, - RecordId rID) const { + RecordId rID) const override { MONGO_UNREACHABLE; } void truncateRecordStore(const boost::intrusive_ptr& expCtx, - RecordStore* rs) const { + RecordStore* rs) const override { MONGO_UNREACHABLE; } }; diff --git a/src/mongo/db/pipeline/search/document_source_internal_search_id_lookup.h b/src/mongo/db/pipeline/search/document_source_internal_search_id_lookup.h index c5d85b0fa2e..ff3a4d8ebba 100644 --- a/src/mongo/db/pipeline/search/document_source_internal_search_id_lookup.h +++ b/src/mongo/db/pipeline/search/document_source_internal_search_id_lookup.h @@ -80,7 +80,7 @@ public: /** * Serialize this stage - return is of the form { $_internalSearchIdLookup: {} } */ - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; /** * This stage must be run on each shard. diff --git a/src/mongo/db/pipeline/search/document_source_internal_search_mongot_remote.h b/src/mongo/db/pipeline/search/document_source_internal_search_mongot_remote.h index afdd0e89261..1a98618dc91 100644 --- a/src/mongo/db/pipeline/search/document_source_internal_search_mongot_remote.h +++ b/src/mongo/db/pipeline/search/document_source_internal_search_mongot_remote.h @@ -112,14 +112,14 @@ public: const char* getSourceName() const override; - virtual boost::optional distributedPlanLogic() override { + boost::optional distributedPlanLogic() override { // The desugaring of DocumentSourceSearch happens after sharded planning, so we should never // execute distributedPlanLogic here, instead it should be called against // DocumentSourceSearch. MONGO_UNREACHABLE_TASSERT(7815902); } - virtual boost::intrusive_ptr clone( + boost::intrusive_ptr clone( const boost::intrusive_ptr& newExpCtx) const override { auto expCtx = newExpCtx ? newExpCtx : pExpCtx; if (_metadataMergeProtocolVersion) { @@ -216,7 +216,7 @@ protected: */ Value serializeWithoutMergePipeline(const SerializationOptions& opts) const; - virtual Value serialize(const SerializationOptions& opts) const override; + Value serialize(const SerializationOptions& opts) const override; /** * Inspects the cursor to see if it set any vars, and propogates their definitions to the diff --git a/src/mongo/db/pipeline/search/document_source_list_search_indexes.h b/src/mongo/db/pipeline/search/document_source_list_search_indexes.h index 6ac57a0451a..a36e873dc0a 100644 --- a/src/mongo/db/pipeline/search/document_source_list_search_indexes.h +++ b/src/mongo/db/pipeline/search/document_source_list_search_indexes.h @@ -70,11 +70,11 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { return onlyReadConcernLocalSupported(getParseTimeName(), level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(getParseTimeName()); } @@ -96,8 +96,7 @@ public: return kStageName.rawData(); } - virtual Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/pipeline/search/document_source_search.h b/src/mongo/db/pipeline/search/document_source_search.h index 2cfc877cdaa..eb376bd960e 100644 --- a/src/mongo/db/pipeline/search/document_source_search.h +++ b/src/mongo/db/pipeline/search/document_source_search.h @@ -81,7 +81,7 @@ public: _limit(limit), _requiresSearchSequenceToken(requireSearchSequenceToken) {} - const char* getSourceName() const; + const char* getSourceName() const override; StageConstraints constraints(Pipeline::SplitState pipeState) const override; boost::optional distributedPlanLogic() final; void addVariableRefs(std::set* refs) const final {} @@ -151,10 +151,9 @@ public: } private: - virtual Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; - GetNextResult doGetNext() { + GetNextResult doGetNext() override { // We should never execute a DocumentSourceSearch. MONGO_UNREACHABLE_TASSERT(6253716); } diff --git a/src/mongo/db/pipeline/search/document_source_search_meta.h b/src/mongo/db/pipeline/search/document_source_search_meta.h index 7761d2508c1..5990d4651bd 100644 --- a/src/mongo/db/pipeline/search/document_source_search_meta.h +++ b/src/mongo/db/pipeline/search/document_source_search_meta.h @@ -48,7 +48,7 @@ public: // Same construction API as the parent class. using DocumentSourceInternalSearchMongotRemote::DocumentSourceInternalSearchMongotRemote; - const char* getSourceName() const { + const char* getSourceName() const override { return kStageName.rawData(); } @@ -83,8 +83,7 @@ public: } protected: - virtual Value serialize( - const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; executor::TaskExecutorCursor establishCursor() override; diff --git a/src/mongo/db/pipeline/search/lite_parsed_search.h b/src/mongo/db/pipeline/search/lite_parsed_search.h index f863ad8ed47..614457754f6 100644 --- a/src/mongo/db/pipeline/search/lite_parsed_search.h +++ b/src/mongo/db/pipeline/search/lite_parsed_search.h @@ -56,11 +56,11 @@ public: } ReadConcernSupportResult supportsReadConcern(repl::ReadConcernLevel level, - bool isImplicitDefault) const { + bool isImplicitDefault) const override { return onlyReadConcernLocalSupported(getParseTimeName(), level, isImplicitDefault); } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(getParseTimeName()); } diff --git a/src/mongo/db/pipeline/window_function/window_function_avg.h b/src/mongo/db/pipeline/window_function/window_function_avg.h index 8bb3e6b4c4f..660ccc91d4e 100644 --- a/src/mongo/db/pipeline/window_function/window_function_avg.h +++ b/src/mongo/db/pipeline/window_function/window_function_avg.h @@ -105,7 +105,7 @@ public: } } - void reset() { + void reset() override { RemovableSum::reset(); _count = 0; _memUsageTracker.add(sizeof(long long)); diff --git a/src/mongo/db/pipeline/window_function/window_function_exec.h b/src/mongo/db/pipeline/window_function/window_function_exec.h index 16799acea62..d36d3cb02b1 100644 --- a/src/mongo/db/pipeline/window_function/window_function_exec.h +++ b/src/mongo/db/pipeline/window_function/window_function_exec.h @@ -105,7 +105,7 @@ public: return _function->getValue(); } - void reset() { + void reset() override { _function->reset(); _values = std::queue>(); _memTracker->set(_function->getApproximateSize()); diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h b/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h index f37c87722df..f3b927ab6a8 100644 --- a/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h +++ b/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h @@ -106,7 +106,7 @@ public: : WindowFunctionExecForEndpoint( iter, std::move(input), std::move(bounds), defaultValue, memTracker) {} - Value getNext() { + Value getNext() override { return getFirst(); } }; @@ -120,7 +120,7 @@ public: : WindowFunctionExecForEndpoint( iter, std::move(input), std::move(bounds), boost::none, memTracker) {} - Value getNext() { + Value getNext() override { return getLast(); } }; diff --git a/src/mongo/db/pipeline/window_function/window_function_stddev.h b/src/mongo/db/pipeline/window_function/window_function_stddev.h index 375adea5a50..c8ffaeded1a 100644 --- a/src/mongo/db/pipeline/window_function/window_function_stddev.h +++ b/src/mongo/db/pipeline/window_function/window_function_stddev.h @@ -51,11 +51,11 @@ public: return Value(BSONNULL); } - void add(Value value) { + void add(Value value) override { update(std::move(value), +1); } - void remove(Value value) { + void remove(Value value) override { update(std::move(value), -1); } @@ -78,7 +78,7 @@ public: return Value(sqrt(_m2->getValue(false).coerceToDouble() / adjustedCount)); } - void reset() { + void reset() override { _m2->reset(); _sum->reset(); _memUsageTracker.set(sizeof(*this)); diff --git a/src/mongo/db/pipeline/window_function/window_function_sum.h b/src/mongo/db/pipeline/window_function/window_function_sum.h index 1fb36a1b750..4f63d1b7237 100644 --- a/src/mongo/db/pipeline/window_function/window_function_sum.h +++ b/src/mongo/db/pipeline/window_function/window_function_sum.h @@ -76,7 +76,7 @@ public: Value getValue() const override; - void reset() { + void reset() override { _sumAcc->reset(); _posInfiniteValueCount = 0; _negInfiniteValueCount = 0; diff --git a/src/mongo/db/process_health/config_server_health_observer.cpp b/src/mongo/db/process_health/config_server_health_observer.cpp index c08be2fed44..6d273debf0f 100644 --- a/src/mongo/db/process_health/config_server_health_observer.cpp +++ b/src/mongo/db/process_health/config_server_health_observer.cpp @@ -107,7 +107,7 @@ static constexpr Milliseconds kServerRequestTimeout{10000}; class ConfigServerHealthObserver final : public HealthObserverBase { public: explicit ConfigServerHealthObserver(ServiceContext* svcCtx); - ~ConfigServerHealthObserver() = default; + ~ConfigServerHealthObserver() override = default; /** * Health observer unique type. diff --git a/src/mongo/db/process_health/fault_facet_mock.h b/src/mongo/db/process_health/fault_facet_mock.h index e6c9ee5325b..ae4d34fba98 100644 --- a/src/mongo/db/process_health/fault_facet_mock.h +++ b/src/mongo/db/process_health/fault_facet_mock.h @@ -52,7 +52,7 @@ public: invariant(mockType == FaultFacetType::kMock1 || mockType == FaultFacetType::kMock2); } - ~FaultFacetMock() = default; + ~FaultFacetMock() override = default; FaultFacetType getType() const override { return _mockType; diff --git a/src/mongo/db/process_health/fault_facet_test.cpp b/src/mongo/db/process_health/fault_facet_test.cpp index ecafab1287c..ba42f03199c 100644 --- a/src/mongo/db/process_health/fault_facet_test.cpp +++ b/src/mongo/db/process_health/fault_facet_test.cpp @@ -53,7 +53,7 @@ public: FaultFacetType::kMock1, _svcCtx->getFastClockSource(), callback); } - void tearDown() { + void tearDown() override { serverGlobalParams.clusterRole = _saved; } @@ -80,12 +80,12 @@ public: static inline const auto kFailure = HealthCheckStatus(FaultFacetType::kMock1, Severity::kFailure, "test"); - void setUp() { + void setUp() override { _svcCtx = ServiceContext::make(); _svcCtx->setFastClockSource(std::make_unique()); } - void tearDown() { + void tearDown() override { serverGlobalParams.clusterRole = _saved; } diff --git a/src/mongo/db/process_health/health_observer_base.h b/src/mongo/db/process_health/health_observer_base.h index 74f2db3512e..154e7b14de5 100644 --- a/src/mongo/db/process_health/health_observer_base.h +++ b/src/mongo/db/process_health/health_observer_base.h @@ -62,7 +62,7 @@ namespace process_health { class HealthObserverBase : public HealthObserver { public: explicit HealthObserverBase(ServiceContext* svcCtx); - virtual ~HealthObserverBase() = default; + ~HealthObserverBase() override = default; ClockSource* clockSource() const { return _svcCtx->getPreciseClockSource(); diff --git a/src/mongo/db/process_health/health_observer_mock.h b/src/mongo/db/process_health/health_observer_mock.h index b44fd35a368..ca3f705fa62 100644 --- a/src/mongo/db/process_health/health_observer_mock.h +++ b/src/mongo/db/process_health/health_observer_mock.h @@ -67,7 +67,7 @@ public: _periodicCheckImpl(periodicCheckImpl), _observerTimeout(observerTimeout) {} - virtual ~HealthObserverMock() = default; + ~HealthObserverMock() override = default; bool isConfigured() const override { return true; diff --git a/src/mongo/db/process_health/state_machine.h b/src/mongo/db/process_health/state_machine.h index e7e61ca33bf..bfcf322a614 100644 --- a/src/mongo/db/process_health/state_machine.h +++ b/src/mongo/db/process_health/state_machine.h @@ -189,7 +189,7 @@ public: return _state; } - StateEventRegistryPtr enter(StateCallback&& cb) { + StateEventRegistryPtr enter(StateCallback&& cb) override { _onEnter.push_back(std::move(cb)); return this; } @@ -199,7 +199,7 @@ public: cb(previous, _state, m); } - StateEventRegistryPtr exit(StateCallback&& cb) { + StateEventRegistryPtr exit(StateCallback&& cb) override { _onExit.push_back(std::move(cb)); return this; } diff --git a/src/mongo/db/query/ce/benchmark_utils.h b/src/mongo/db/query/ce/benchmark_utils.h index 37eb2291c33..99c4e03a1f0 100644 --- a/src/mongo/db/query/ce/benchmark_utils.h +++ b/src/mongo/db/query/ce/benchmark_utils.h @@ -327,7 +327,7 @@ public: _arrayBuilder.append(results.toBSON()); } - void printResults() { + void printResults() override { std::cout << _arrayBuilder.arr().jsonString( ExtendedCanonicalV2_0_0, 1 /*pretty*/, true /*isArray*/) << std::endl; @@ -347,7 +347,7 @@ public: _results.push_back(results.toString()); } - void printResults() { + void printResults() override { for (auto&& str : _results) { std::cout << str << std::endl; } diff --git a/src/mongo/db/query/ce/heuristic_estimator.h b/src/mongo/db/query/ce/heuristic_estimator.h index 50a565a193c..222b71857e3 100644 --- a/src/mongo/db/query/ce/heuristic_estimator.h +++ b/src/mongo/db/query/ce/heuristic_estimator.h @@ -48,7 +48,7 @@ public: const cascades::Memo& memo, const properties::LogicalProps& /*logicalProps*/, const QueryParameterMap& queryParameters, - ABT::reference_type logicalNodeRef) const override final; + ABT::reference_type logicalNodeRef) const final; }; } // namespace mongo::optimizer::ce diff --git a/src/mongo/db/query/ce/hinted_estimator.h b/src/mongo/db/query/ce/hinted_estimator.h index 64cc7b8fa57..4441747f348 100644 --- a/src/mongo/db/query/ce/hinted_estimator.h +++ b/src/mongo/db/query/ce/hinted_estimator.h @@ -66,7 +66,7 @@ public: const cascades::Memo& memo, const properties::LogicalProps& logicalProps, const QueryParameterMap& queryParameters, - ABT::reference_type logicalNodeRef) const override final; + ABT::reference_type logicalNodeRef) const final; private: // Selectivity hints per PartialSchemaKey. diff --git a/src/mongo/db/query/ce/histogram_estimator.h b/src/mongo/db/query/ce/histogram_estimator.h index f0c0be634f7..1c5390e6ff7 100644 --- a/src/mongo/db/query/ce/histogram_estimator.h +++ b/src/mongo/db/query/ce/histogram_estimator.h @@ -65,7 +65,7 @@ class HistogramEstimator : public cascades::CardinalityEstimator { public: HistogramEstimator(std::shared_ptr stats, std::unique_ptr fallbackCE); - ~HistogramEstimator(); + ~HistogramEstimator() override; CERecord deriveCE(const Metadata& metadata, const cascades::Memo& memo, diff --git a/src/mongo/db/query/ce/sampling_estimator.h b/src/mongo/db/query/ce/sampling_estimator.h index d74b18e138a..e4e41b7d725 100644 --- a/src/mongo/db/query/ce/sampling_estimator.h +++ b/src/mongo/db/query/ce/sampling_estimator.h @@ -79,7 +79,7 @@ public: PrefixId& prefixId, std::unique_ptr fallbackCE, std::unique_ptr executor); - ~SamplingEstimator(); + ~SamplingEstimator() override; CERecord deriveCE(const Metadata& metadata, const cascades::Memo& memo, diff --git a/src/mongo/db/query/ce/sampling_executor.h b/src/mongo/db/query/ce/sampling_executor.h index 4fa1167f033..afb06d7717f 100644 --- a/src/mongo/db/query/ce/sampling_executor.h +++ b/src/mongo/db/query/ce/sampling_executor.h @@ -41,7 +41,7 @@ namespace mongo::optimizer::ce { class SBESamplingExecutor : public SamplingExecutor { public: SBESamplingExecutor(OperationContext* opCtx) : _opCtx(opCtx) {} - ~SBESamplingExecutor(); + ~SBESamplingExecutor() override; std::pair execute( const Metadata& metadata, diff --git a/src/mongo/db/query/classic_runtime_planner/planner_interface.h b/src/mongo/db/query/classic_runtime_planner/planner_interface.h index c3215568426..374fdba2019 100644 --- a/src/mongo/db/query/classic_runtime_planner/planner_interface.h +++ b/src/mongo/db/query/classic_runtime_planner/planner_interface.h @@ -87,7 +87,7 @@ public: * may transfer ownership of some data to returned PlanExecutor. */ std::unique_ptr makeExecutor( - std::unique_ptr canonicalQuery) override final; + std::unique_ptr canonicalQuery) final; protected: std::unique_ptr buildExecutableTree(const QuerySolution& qs); diff --git a/src/mongo/db/query/classic_stage_builder_test.cpp b/src/mongo/db/query/classic_stage_builder_test.cpp index 045ee57877b..17f0f26fa43 100644 --- a/src/mongo/db/query/classic_stage_builder_test.cpp +++ b/src/mongo/db/query/classic_stage_builder_test.cpp @@ -61,12 +61,12 @@ class ClassicStageBuilderTest : public ServiceContextMongoDTest { public: ClassicStageBuilderTest() : ServiceContextMongoDTest(Options{}.useMockClock(true)) {} - void setUp() { + void setUp() override { _opCtx = makeOperationContext(); _workingSet = std::make_unique(); } - void tearDown() { + void tearDown() override { _opCtx.reset(); _workingSet.reset(); } diff --git a/src/mongo/db/query/collation/collator_interface.h b/src/mongo/db/query/collation/collator_interface.h index 365a4998727..85d686f25f4 100644 --- a/src/mongo/db/query/collation/collator_interface.h +++ b/src/mongo/db/query/collation/collator_interface.h @@ -99,7 +99,7 @@ public: */ CollatorInterface(Collation spec) : _spec(std::move(spec)) {} - virtual ~CollatorInterface() {} + ~CollatorInterface() override {} virtual std::unique_ptr clone() const = 0; virtual std::shared_ptr cloneShared() const = 0; @@ -109,7 +109,7 @@ public: * 0 if 'left' is greater than 'right' w.r.t. the collation, and 0 if 'left' and 'right' are * equal w.r.t. the collation. */ - virtual int compare(StringData left, StringData right) const = 0; + int compare(StringData left, StringData right) const override = 0; /** * Hashes the string such that strings which are equal under this collation also have equal diff --git a/src/mongo/db/query/cost_model/cost_estimator_impl.h b/src/mongo/db/query/cost_model/cost_estimator_impl.h index 2bc05377fe6..1447e09d3df 100644 --- a/src/mongo/db/query/cost_model/cost_estimator_impl.h +++ b/src/mongo/db/query/cost_model/cost_estimator_impl.h @@ -54,7 +54,7 @@ public: const optimizer::properties::PhysProps& physProps, optimizer::ABT::reference_type physNodeRef, const optimizer::ChildPropsType& childProps, - const optimizer::NodeCEMap& nodeCEMap) const override final; + const optimizer::NodeCEMap& nodeCEMap) const final; private: const CostModelCoefficients _coefficients; diff --git a/src/mongo/db/query/cqf_command_utils.cpp b/src/mongo/db/query/cqf_command_utils.cpp index ead28236ff9..5ce2e626e23 100644 --- a/src/mongo/db/query/cqf_command_utils.cpp +++ b/src/mongo/db/query/cqf_command_utils.cpp @@ -405,599 +405,598 @@ class ABTUnsupportedAggExpressionVisitor : public ExpressionConstVisitor { public: ABTUnsupportedAggExpressionVisitor() : _eligibility(BonsaiEligibility::FullyEligible) {} - void visit(const ExpressionConstant* expr) override final { + void visit(const ExpressionConstant* expr) final { unsupportedExpression(); } - void visit(const ExpressionAbs* expr) override final { + void visit(const ExpressionAbs* expr) final { unsupportedExpression(); } - void visit(const ExpressionAdd* expr) override final { + void visit(const ExpressionAdd* expr) final { unsupportedExpression(); } - void visit(const ExpressionAllElementsTrue* expr) override final { + void visit(const ExpressionAllElementsTrue* expr) final { unsupportedExpression(); } - void visit(const ExpressionAnd* expr) override final { + void visit(const ExpressionAnd* expr) final { unsupportedExpression(); } - void visit(const ExpressionAnyElementTrue* expr) override final { + void visit(const ExpressionAnyElementTrue* expr) final { unsupportedExpression(); } - void visit(const ExpressionArray* expr) override final { + void visit(const ExpressionArray* expr) final { unsupportedExpression(); } - void visit(const ExpressionArrayElemAt* expr) override final { + void visit(const ExpressionArrayElemAt* expr) final { unsupportedExpression(); } - void visit(const ExpressionBitAnd* expr) override final { + void visit(const ExpressionBitAnd* expr) final { unsupportedExpression(); } - void visit(const ExpressionBitOr* expr) override final { + void visit(const ExpressionBitOr* expr) final { unsupportedExpression(); } - void visit(const ExpressionBitXor* expr) override final { + void visit(const ExpressionBitXor* expr) final { unsupportedExpression(); } - void visit(const ExpressionBitNot* expr) override final { + void visit(const ExpressionBitNot* expr) final { unsupportedExpression(); } - void visit(const ExpressionFirst* expr) override final { + void visit(const ExpressionFirst* expr) final { unsupportedExpression(); } - void visit(const ExpressionLast* expr) override final { + void visit(const ExpressionLast* expr) final { unsupportedExpression(); } - void visit(const ExpressionObjectToArray* expr) override final { + void visit(const ExpressionObjectToArray* expr) final { unsupportedExpression(); } - void visit(const ExpressionArrayToObject* expr) override final { + void visit(const ExpressionArrayToObject* expr) final { unsupportedExpression(); } - void visit(const ExpressionBsonSize* expr) override final { + void visit(const ExpressionBsonSize* expr) final { unsupportedExpression(); } - void visit(const ExpressionCeil* expr) override final { + void visit(const ExpressionCeil* expr) final { unsupportedExpression(); } - void visit(const ExpressionCoerceToBool* expr) override final { + void visit(const ExpressionCoerceToBool* expr) final { unsupportedExpression(); } - void visit(const ExpressionCompare* expr) override final { + void visit(const ExpressionCompare* expr) final { unsupportedExpression(); } - void visit(const ExpressionConcat* expr) override final { + void visit(const ExpressionConcat* expr) final { unsupportedExpression(); } - void visit(const ExpressionConcatArrays* expr) override final { + void visit(const ExpressionConcatArrays* expr) final { unsupportedExpression(); } - void visit(const ExpressionCond* expr) override final { + void visit(const ExpressionCond* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateFromString* expr) override final { + void visit(const ExpressionDateFromString* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateFromParts* expr) override final { + void visit(const ExpressionDateFromParts* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateDiff* expr) override final { + void visit(const ExpressionDateDiff* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateToParts* expr) override final { + void visit(const ExpressionDateToParts* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateToString* expr) override final { + void visit(const ExpressionDateToString* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateTrunc* expr) override final { + void visit(const ExpressionDateTrunc* expr) final { unsupportedExpression(); } - void visit(const ExpressionDivide* expr) override final { + void visit(const ExpressionDivide* expr) final { unsupportedExpression(); } - void visit(const ExpressionExp* expr) override final { + void visit(const ExpressionExp* expr) final { unsupportedExpression(); } - void visit(const ExpressionFieldPath* expr) override final { + void visit(const ExpressionFieldPath* expr) final { unsupportedExpression(); } - void visit(const ExpressionFilter* expr) override final { + void visit(const ExpressionFilter* expr) final { unsupportedExpression(); } - void visit(const ExpressionFloor* expr) override final { + void visit(const ExpressionFloor* expr) final { unsupportedExpression(); } - void visit(const ExpressionIfNull* expr) override final { + void visit(const ExpressionIfNull* expr) final { unsupportedExpression(); } - void visit(const ExpressionIn* expr) override final { + void visit(const ExpressionIn* expr) final { unsupportedExpression(); } - void visit(const ExpressionIndexOfArray* expr) override final { + void visit(const ExpressionIndexOfArray* expr) final { unsupportedExpression(); } - void visit(const ExpressionIndexOfBytes* expr) override final { + void visit(const ExpressionIndexOfBytes* expr) final { unsupportedExpression(); } - void visit(const ExpressionIndexOfCP* expr) override final { + void visit(const ExpressionIndexOfCP* expr) final { unsupportedExpression(); } - void visit(const ExpressionIsNumber* expr) override final { + void visit(const ExpressionIsNumber* expr) final { unsupportedExpression(); } - void visit(const ExpressionLet* expr) override final { + void visit(const ExpressionLet* expr) final { unsupportedExpression(); } - void visit(const ExpressionLn* expr) override final { + void visit(const ExpressionLn* expr) final { unsupportedExpression(); } - void visit(const ExpressionLog* expr) override final { + void visit(const ExpressionLog* expr) final { unsupportedExpression(); } - void visit(const ExpressionLog10* expr) override final { + void visit(const ExpressionLog10* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalFLEEqual* expr) override final { + void visit(const ExpressionInternalFLEEqual* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalFLEBetween* expr) override final { + void visit(const ExpressionInternalFLEBetween* expr) final { unsupportedExpression(); } - void visit(const ExpressionMap* expr) override final { + void visit(const ExpressionMap* expr) final { unsupportedExpression(); } - void visit(const ExpressionMeta* expr) override final { + void visit(const ExpressionMeta* expr) final { unsupportedExpression(); } - void visit(const ExpressionMod* expr) override final { + void visit(const ExpressionMod* expr) final { unsupportedExpression(); } - void visit(const ExpressionMultiply* expr) override final { + void visit(const ExpressionMultiply* expr) final { unsupportedExpression(); } - void visit(const ExpressionNot* expr) override final { + void visit(const ExpressionNot* expr) final { unsupportedExpression(); } - void visit(const ExpressionObject* expr) override final { + void visit(const ExpressionObject* expr) final { unsupportedExpression(); } - void visit(const ExpressionOr* expr) override final { + void visit(const ExpressionOr* expr) final { unsupportedExpression(); } - void visit(const ExpressionPow* expr) override final { + void visit(const ExpressionPow* expr) final { unsupportedExpression(); } - void visit(const ExpressionRange* expr) override final { + void visit(const ExpressionRange* expr) final { unsupportedExpression(); } - void visit(const ExpressionReduce* expr) override final { + void visit(const ExpressionReduce* expr) final { unsupportedExpression(); } - void visit(const ExpressionReplaceOne* expr) override final { + void visit(const ExpressionReplaceOne* expr) final { unsupportedExpression(); } - void visit(const ExpressionReplaceAll* expr) override final { + void visit(const ExpressionReplaceAll* expr) final { unsupportedExpression(); } - void visit(const ExpressionSetDifference* expr) override final { + void visit(const ExpressionSetDifference* expr) final { unsupportedExpression(); } - void visit(const ExpressionSetEquals* expr) override final { + void visit(const ExpressionSetEquals* expr) final { unsupportedExpression(); } - void visit(const ExpressionSetIntersection* expr) override final { + void visit(const ExpressionSetIntersection* expr) final { unsupportedExpression(); } - void visit(const ExpressionSetIsSubset* expr) override final { + void visit(const ExpressionSetIsSubset* expr) final { unsupportedExpression(); } - void visit(const ExpressionSetUnion* expr) override final { + void visit(const ExpressionSetUnion* expr) final { unsupportedExpression(); } - void visit(const ExpressionSize* expr) override final { + void visit(const ExpressionSize* expr) final { unsupportedExpression(); } - void visit(const ExpressionReverseArray* expr) override final { + void visit(const ExpressionReverseArray* expr) final { unsupportedExpression(); } - void visit(const ExpressionSortArray* expr) override final { + void visit(const ExpressionSortArray* expr) final { unsupportedExpression(); } - void visit(const ExpressionSlice* expr) override final { + void visit(const ExpressionSlice* expr) final { unsupportedExpression(); } - void visit(const ExpressionIsArray* expr) override final { + void visit(const ExpressionIsArray* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalFindAllValuesAtPath* expr) override final { + void visit(const ExpressionInternalFindAllValuesAtPath* expr) final { unsupportedExpression(); } - void visit(const ExpressionRound* expr) override final { + void visit(const ExpressionRound* expr) final { unsupportedExpression(); } - void visit(const ExpressionSplit* expr) override final { + void visit(const ExpressionSplit* expr) final { unsupportedExpression(); } - void visit(const ExpressionSqrt* expr) override final { + void visit(const ExpressionSqrt* expr) final { unsupportedExpression(); } - void visit(const ExpressionStrcasecmp* expr) override final { + void visit(const ExpressionStrcasecmp* expr) final { unsupportedExpression(); } - void visit(const ExpressionSubstrBytes* expr) override final { + void visit(const ExpressionSubstrBytes* expr) final { unsupportedExpression(); } - void visit(const ExpressionSubstrCP* expr) override final { + void visit(const ExpressionSubstrCP* expr) final { unsupportedExpression(); } - void visit(const ExpressionStrLenBytes* expr) override final { + void visit(const ExpressionStrLenBytes* expr) final { unsupportedExpression(); } - void visit(const ExpressionBinarySize* expr) override final { + void visit(const ExpressionBinarySize* expr) final { unsupportedExpression(); } - void visit(const ExpressionStrLenCP* expr) override final { + void visit(const ExpressionStrLenCP* expr) final { unsupportedExpression(); } - void visit(const ExpressionSubtract* expr) override final { + void visit(const ExpressionSubtract* expr) final { unsupportedExpression(); } - void visit(const ExpressionSwitch* expr) override final { + void visit(const ExpressionSwitch* expr) final { unsupportedExpression(); } - void visit(const ExpressionTestApiVersion* expr) override final { + void visit(const ExpressionTestApiVersion* expr) final { unsupportedExpression(); } - void visit(const ExpressionToLower* expr) override final { + void visit(const ExpressionToLower* expr) final { unsupportedExpression(); } - void visit(const ExpressionToUpper* expr) override final { + void visit(const ExpressionToUpper* expr) final { unsupportedExpression(); } - void visit(const ExpressionTrim* expr) override final { + void visit(const ExpressionTrim* expr) final { unsupportedExpression(); } - void visit(const ExpressionTrunc* expr) override final { + void visit(const ExpressionTrunc* expr) final { unsupportedExpression(); } - void visit(const ExpressionType* expr) override final { + void visit(const ExpressionType* expr) final { unsupportedExpression(); } - void visit(const ExpressionZip* expr) override final { + void visit(const ExpressionZip* expr) final { unsupportedExpression(); } - void visit(const ExpressionConvert* expr) override final { + void visit(const ExpressionConvert* expr) final { unsupportedExpression(); } - void visit(const ExpressionRegexFind* expr) override final { + void visit(const ExpressionRegexFind* expr) final { unsupportedExpression(); } - void visit(const ExpressionRegexFindAll* expr) override final { + void visit(const ExpressionRegexFindAll* expr) final { unsupportedExpression(); } - void visit(const ExpressionRegexMatch* expr) override final { + void visit(const ExpressionRegexMatch* expr) final { unsupportedExpression(); } - void visit(const ExpressionCosine* expr) override final { + void visit(const ExpressionCosine* expr) final { unsupportedExpression(); } - void visit(const ExpressionSine* expr) override final { + void visit(const ExpressionSine* expr) final { unsupportedExpression(); } - void visit(const ExpressionTangent* expr) override final { + void visit(const ExpressionTangent* expr) final { unsupportedExpression(); } - void visit(const ExpressionArcCosine* expr) override final { + void visit(const ExpressionArcCosine* expr) final { unsupportedExpression(); } - void visit(const ExpressionArcSine* expr) override final { + void visit(const ExpressionArcSine* expr) final { unsupportedExpression(); } - void visit(const ExpressionArcTangent* expr) override final { + void visit(const ExpressionArcTangent* expr) final { unsupportedExpression(); } - void visit(const ExpressionArcTangent2* expr) override final { + void visit(const ExpressionArcTangent2* expr) final { unsupportedExpression(); } - void visit(const ExpressionHyperbolicArcTangent* expr) override final { + void visit(const ExpressionHyperbolicArcTangent* expr) final { unsupportedExpression(); } - void visit(const ExpressionHyperbolicArcCosine* expr) override final { + void visit(const ExpressionHyperbolicArcCosine* expr) final { unsupportedExpression(); } - void visit(const ExpressionHyperbolicArcSine* expr) override final { + void visit(const ExpressionHyperbolicArcSine* expr) final { unsupportedExpression(); } - void visit(const ExpressionHyperbolicTangent* expr) override final { + void visit(const ExpressionHyperbolicTangent* expr) final { unsupportedExpression(); } - void visit(const ExpressionHyperbolicCosine* expr) override final { + void visit(const ExpressionHyperbolicCosine* expr) final { unsupportedExpression(); } - void visit(const ExpressionHyperbolicSine* expr) override final { + void visit(const ExpressionHyperbolicSine* expr) final { unsupportedExpression(); } - void visit(const ExpressionDegreesToRadians* expr) override final { + void visit(const ExpressionDegreesToRadians* expr) final { unsupportedExpression(); } - void visit(const ExpressionRadiansToDegrees* expr) override final { + void visit(const ExpressionRadiansToDegrees* expr) final { unsupportedExpression(); } - void visit(const ExpressionDayOfMonth* expr) override final { + void visit(const ExpressionDayOfMonth* expr) final { unsupportedExpression(); } - void visit(const ExpressionDayOfWeek* expr) override final { + void visit(const ExpressionDayOfWeek* expr) final { unsupportedExpression(); } - void visit(const ExpressionDayOfYear* expr) override final { + void visit(const ExpressionDayOfYear* expr) final { unsupportedExpression(); } - void visit(const ExpressionHour* expr) override final { + void visit(const ExpressionHour* expr) final { unsupportedExpression(); } - void visit(const ExpressionMillisecond* expr) override final { + void visit(const ExpressionMillisecond* expr) final { unsupportedExpression(); } - void visit(const ExpressionMinute* expr) override final { + void visit(const ExpressionMinute* expr) final { unsupportedExpression(); } - void visit(const ExpressionMonth* expr) override final { + void visit(const ExpressionMonth* expr) final { unsupportedExpression(); } - void visit(const ExpressionSecond* expr) override final { + void visit(const ExpressionSecond* expr) final { unsupportedExpression(); } - void visit(const ExpressionWeek* expr) override final { + void visit(const ExpressionWeek* expr) final { unsupportedExpression(); } - void visit(const ExpressionIsoWeekYear* expr) override final { + void visit(const ExpressionIsoWeekYear* expr) final { unsupportedExpression(); } - void visit(const ExpressionIsoDayOfWeek* expr) override final { + void visit(const ExpressionIsoDayOfWeek* expr) final { unsupportedExpression(); } - void visit(const ExpressionIsoWeek* expr) override final { + void visit(const ExpressionIsoWeek* expr) final { unsupportedExpression(); } - void visit(const ExpressionYear* expr) override final { + void visit(const ExpressionYear* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulatorN* expr) override final { + void visit(const ExpressionFromAccumulatorN* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulatorQuantile* expr) override final { + void visit(const ExpressionFromAccumulatorQuantile* expr) final { unsupportedExpression(); } - void visit( - const ExpressionFromAccumulatorQuantile* expr) override final { + void visit(const ExpressionFromAccumulatorQuantile* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionFromAccumulator* expr) override final { + void visit(const ExpressionFromAccumulator* expr) final { unsupportedExpression(); } - void visit(const ExpressionTests::Testable* expr) override final { + void visit(const ExpressionTests::Testable* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalJsEmit* expr) override final { + void visit(const ExpressionInternalJsEmit* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalFindSlice* expr) override final { + void visit(const ExpressionInternalFindSlice* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalFindPositional* expr) override final { + void visit(const ExpressionInternalFindPositional* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalFindElemMatch* expr) override final { + void visit(const ExpressionInternalFindElemMatch* expr) final { unsupportedExpression(); } - void visit(const ExpressionFunction* expr) override final { + void visit(const ExpressionFunction* expr) final { unsupportedExpression(); } - void visit(const ExpressionRandom* expr) override final { + void visit(const ExpressionRandom* expr) final { unsupportedExpression(); } - void visit(const ExpressionToHashedIndexKey* expr) override final { + void visit(const ExpressionToHashedIndexKey* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateAdd* expr) override final { + void visit(const ExpressionDateAdd* expr) final { unsupportedExpression(); } - void visit(const ExpressionDateSubtract* expr) override final { + void visit(const ExpressionDateSubtract* expr) final { unsupportedExpression(); } - void visit(const ExpressionSetField* expr) override final { + void visit(const ExpressionSetField* expr) final { unsupportedExpression(); } - void visit(const ExpressionGetField* expr) override final { + void visit(const ExpressionGetField* expr) final { unsupportedExpression(); } - void visit(const ExpressionTsSecond* expr) override final { + void visit(const ExpressionTsSecond* expr) final { unsupportedExpression(); } - void visit(const ExpressionTsIncrement* expr) override final { + void visit(const ExpressionTsIncrement* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalOwningShard* expr) override final { + void visit(const ExpressionInternalOwningShard* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalIndexKey* expr) override final { + void visit(const ExpressionInternalIndexKey* expr) final { unsupportedExpression(); } - void visit(const ExpressionInternalKeyStringValue* expr) override final { + void visit(const ExpressionInternalKeyStringValue* expr) final { unsupportedExpression(); } diff --git a/src/mongo/db/query/cqf_fast_paths.cpp b/src/mongo/db/query/cqf_fast_paths.cpp index 733c17b53fa..508dda41d69 100644 --- a/src/mongo/db/query/cqf_fast_paths.cpp +++ b/src/mongo/db/query/cqf_fast_paths.cpp @@ -73,19 +73,19 @@ class FastPathPrinter : public AbstractABTPrinter { public: FastPathPrinter(BSONObj fastPathExplain) : _explainBSON(std::move(fastPathExplain)) {} - BSONObj explainBSON() const override final { + BSONObj explainBSON() const final { return _explainBSON; } - BSONObj explainQueryPlannerDebug() const override final { + BSONObj explainQueryPlannerDebug() const final { return {}; } - std::string getPlanSummary() const override final { + std::string getPlanSummary() const final { return "COLLSCAN"; } - BSONObj getQueryParameters() const override final { + BSONObj getQueryParameters() const final { // Fast path queries don't get parameterized. return {}; } @@ -498,7 +498,7 @@ public: return {std::move(sbePlan), std::move(data)}; } - virtual BSONObj generateExplain() const override { + BSONObj generateExplain() const override { return BSON("stage" << "FASTPATH" << "type" diff --git a/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h b/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h index cd3e7195ced..0718b11e13a 100644 --- a/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h +++ b/src/mongo/db/query/fle/encrypted_predicate_test_fixtures.h @@ -54,7 +54,7 @@ public: EncryptedCollScanMode getEncryptedCollScanMode() const override { return _mode; } - ExpressionContext* getExpressionContext() const { + ExpressionContext* getExpressionContext() const override { return _expCtx.get(); } @@ -79,7 +79,7 @@ private: class EncryptedPredicateRewriteTest : public unittest::Test { public: EncryptedPredicateRewriteTest(); - ~EncryptedPredicateRewriteTest(); + ~EncryptedPredicateRewriteTest() override; static std::unique_ptr makeInExpr(StringData fieldname, BSONArray disjunctions) { diff --git a/src/mongo/db/query/fle/equality_predicate_test.cpp b/src/mongo/db/query/fle/equality_predicate_test.cpp index e59f4e5cf57..3c860828c65 100644 --- a/src/mongo/db/query/fle/equality_predicate_test.cpp +++ b/src/mongo/db/query/fle/equality_predicate_test.cpp @@ -87,7 +87,7 @@ protected: return true; } - std::vector generateTags(BSONValue payload) const { + std::vector generateTags(BSONValue payload) const override { return visit(OverloadedVisitor{ [&](BSONElement p) { ASSERT(p.isNumber()); // Only accept numbers as mock FFPs. diff --git a/src/mongo/db/query/fle/server_rewrite.cpp b/src/mongo/db/query/fle/server_rewrite.cpp index 3922e6d7456..c84d9531f83 100644 --- a/src/mongo/db/query/fle/server_rewrite.cpp +++ b/src/mongo/db/query/fle/server_rewrite.cpp @@ -175,7 +175,7 @@ public: std::unique_ptr toRewrite) : RewriteBase(toRewrite->getContext(), nss, encryptInfo), pipeline(std::move(toRewrite)) {} - ~PipelineRewrite(){}; + ~PipelineRewrite() override{}; void doRewrite(FLETagQueryInterface* queryImpl, const NamespaceString& nssEsc) final { auto rewriter = QueryRewriter(expCtx, queryImpl, nssEsc); @@ -204,7 +204,7 @@ public: EncryptedCollScanModeAllowed mode) : RewriteBase(expCtx, nss, encryptInfo), userFilter(toRewrite), _mode(mode) {} - ~FilterRewrite(){}; + ~FilterRewrite() override{}; void doRewrite(FLETagQueryInterface* queryImpl, const NamespaceString& nssEsc) final { rewrittenFilter = rewriteEncryptedFilterV2(queryImpl, nssEsc, expCtx, userFilter, _mode); diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index b6e429de760..b1d2f27a3dc 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -703,7 +703,7 @@ private: return result; } - PlanCacheKey buildPlanCacheKey() const { + PlanCacheKey buildPlanCacheKey() const override { return plan_cache_key_factory::make(*_cq, getCollections().getMainCollection()); } @@ -829,7 +829,7 @@ private: return result; } - sbe::PlanCacheKey buildPlanCacheKey() const { + sbe::PlanCacheKey buildPlanCacheKey() const override { return plan_cache_key_factory::make( *_cq, _collections, canonical_query_encoder::Optimizer::kSbeStageBuilders); } @@ -932,7 +932,7 @@ private: return nullptr; } - sbe::PlanCacheKey buildPlanCacheKey() const { + sbe::PlanCacheKey buildPlanCacheKey() const override { return plan_cache_key_factory::make( *_cq, _collections, canonical_query_encoder::Optimizer::kSbeStageBuilders); } diff --git a/src/mongo/db/query/index_entry.h b/src/mongo/db/query/index_entry.h index 4da3df9436e..5c62f660a4d 100644 --- a/src/mongo/db/query/index_entry.h +++ b/src/mongo/db/query/index_entry.h @@ -197,7 +197,7 @@ struct IndexEntry : CoreIndexInfo { IndexEntry& operator=(const IndexEntry&) = default; IndexEntry& operator=(IndexEntry&&) = default; - ~IndexEntry() { + ~IndexEntry() override { // An IndexEntry should never have both formats of multikey metadata simultaneously. invariant(multikeyPaths.empty() || multikeyPathSet.empty()); } @@ -303,7 +303,7 @@ struct ColumnIndexEntry : CoreIndexInfo { ColumnIndexEntry(ColumnIndexEntry&&) = default; ColumnIndexEntry& operator=(const ColumnIndexEntry&) = default; ColumnIndexEntry& operator=(ColumnIndexEntry&&) = default; - ~ColumnIndexEntry() = default; + ~ColumnIndexEntry() override = default; IndexDescriptor::IndexVersion version; bool unique; diff --git a/src/mongo/db/query/index_tag.h b/src/mongo/db/query/index_tag.h index fe96c9b017f..e2d883f3edf 100644 --- a/src/mongo/db/query/index_tag.h +++ b/src/mongo/db/query/index_tag.h @@ -60,18 +60,18 @@ public: IndexTag(size_t i, size_t p, bool canCombineBounds_) : index(i), pos(p), canCombineBounds(canCombineBounds_) {} - virtual ~IndexTag() {} + ~IndexTag() override {} - virtual void debugString(StringBuilder* builder) const { + void debugString(StringBuilder* builder) const override { *builder << " || Selected Index #" << index << " pos " << pos << " combine " << canCombineBounds << "\n"; } - virtual MatchExpression::TagData* clone() const { + MatchExpression::TagData* clone() const override { return new IndexTag(index, pos, canCombineBounds); } - virtual Type getType() const { + Type getType() const override { return Type::IndexTag; } @@ -123,7 +123,7 @@ public: // compound two predicates sharing a path prefix. std::string pathPrefix; - virtual void debugString(StringBuilder* builder) const { + void debugString(StringBuilder* builder) const override { *builder << " || First: "; for (size_t i = 0; i < first.size(); ++i) { *builder << first[i] << " "; @@ -135,14 +135,14 @@ public: *builder << "full path: " << path << "\n"; } - virtual MatchExpression::TagData* clone() const { + MatchExpression::TagData* clone() const override { RelevantTag* ret = new RelevantTag(); ret->first = first; ret->notFirst = notFirst; return ret; } - virtual Type getType() const { + Type getType() const override { return Type::RelevantTag; } }; diff --git a/src/mongo/db/query/mock_yield_policies.h b/src/mongo/db/query/mock_yield_policies.h index 4107f4971b4..7be743dc6ae 100644 --- a/src/mongo/db/query/mock_yield_policies.h +++ b/src/mongo/db/query/mock_yield_policies.h @@ -45,11 +45,11 @@ public: : PlanYieldPolicy(opCtx, policy, clockSource, 0, Milliseconds{0}, nullptr, nullptr) {} private: - void saveState(OperationContext* opCtx) override final { + void saveState(OperationContext* opCtx) final { MONGO_UNREACHABLE; } - void restoreState(OperationContext* opCtx, const Yieldable* yieldable) override final { + void restoreState(OperationContext* opCtx, const Yieldable* yieldable) final { MONGO_UNREACHABLE; } }; diff --git a/src/mongo/db/query/optimizer/cascades/logical_props_derivation.h b/src/mongo/db/query/optimizer/cascades/logical_props_derivation.h index ca5bd1ab1b1..e15e50ac8f1 100644 --- a/src/mongo/db/query/optimizer/cascades/logical_props_derivation.h +++ b/src/mongo/db/query/optimizer/cascades/logical_props_derivation.h @@ -49,7 +49,7 @@ public: ABT::reference_type nodeRef, NodePropsMap* nodePropsMap = nullptr, const Memo* memo = nullptr, - GroupIdType groupId = -1) const override final; + GroupIdType groupId = -1) const final; }; diff --git a/src/mongo/db/query/optimizer/explain.h b/src/mongo/db/query/optimizer/explain.h index b6c4aa9c6d5..fb71fd77fcf 100644 --- a/src/mongo/db/query/optimizer/explain.h +++ b/src/mongo/db/query/optimizer/explain.h @@ -105,10 +105,10 @@ public: QueryParameterMap qpMap, QueryPlannerOptimizationStagesForDebugExplain queryPlannerOptimizationStages); - BSONObj explainBSON() const override final; - BSONObj explainQueryPlannerDebug() const override final; - std::string getPlanSummary() const override final; - BSONObj getQueryParameters() const override final; + BSONObj explainBSON() const final; + BSONObj explainQueryPlannerDebug() const final; + std::string getPlanSummary() const final; + BSONObj getQueryParameters() const final; private: // Metadata field used to populate index information for index scans in the planSummary field. diff --git a/src/mongo/db/query/plan_cache_key_encoding_agg_bm.cpp b/src/mongo/db/query/plan_cache_key_encoding_agg_bm.cpp index 4f9a026ad22..137037bf0ed 100644 --- a/src/mongo/db/query/plan_cache_key_encoding_agg_bm.cpp +++ b/src/mongo/db/query/plan_cache_key_encoding_agg_bm.cpp @@ -52,7 +52,7 @@ public: void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { std::vector pipeline; if (!matchSpec.isEmpty()) { pipeline.push_back(BSON("$match" << matchSpec)); @@ -63,8 +63,7 @@ public: benchmarkPipeline(state, pipeline); } - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto expCtx = make_intrusive( diff --git a/src/mongo/db/query/plan_cache_key_encoding_find_bm.cpp b/src/mongo/db/query/plan_cache_key_encoding_find_bm.cpp index cc810013824..b95e362a42d 100644 --- a/src/mongo/db/query/plan_cache_key_encoding_find_bm.cpp +++ b/src/mongo/db/query/plan_cache_key_encoding_find_bm.cpp @@ -47,15 +47,14 @@ class CanonicalQueryEncodeSBE : public BonsaiQueryBenchmarkFixture { public: CanonicalQueryEncodeSBE() {} - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { state.SkipWithError("CanonicalQuery encoding fixture cannot encode a pipeline."); return; } void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto nss = NamespaceString::createNamespaceString_forTest("test.bm"); diff --git a/src/mongo/db/query/plan_cache_parse_encode_bm.cpp b/src/mongo/db/query/plan_cache_parse_encode_bm.cpp index 61c29b79d49..a0eb5460d87 100644 --- a/src/mongo/db/query/plan_cache_parse_encode_bm.cpp +++ b/src/mongo/db/query/plan_cache_parse_encode_bm.cpp @@ -62,15 +62,14 @@ public: return canonical_query_encoder::encodeSBE(*cq, canonical_query_encoder::Optimizer::kBonsai); } - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { state.SkipWithError("CanonicalQuery encoding fixture cannot encode a pipeline."); return; } void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto nss = NamespaceString::createNamespaceString_forTest("test.bm"); diff --git a/src/mongo/db/query/plan_cache_parse_encode_pipeline_bm.cpp b/src/mongo/db/query/plan_cache_parse_encode_pipeline_bm.cpp index 2e4e67d110c..e53ec53d783 100644 --- a/src/mongo/db/query/plan_cache_parse_encode_pipeline_bm.cpp +++ b/src/mongo/db/query/plan_cache_parse_encode_pipeline_bm.cpp @@ -69,7 +69,7 @@ public: void benchmarkQueryMatchProject(benchmark::State& state, BSONObj matchSpec, - BSONObj projectSpec) override final { + BSONObj projectSpec) final { std::vector pipeline; if (!matchSpec.isEmpty()) { pipeline.push_back(BSON("$match" << matchSpec)); @@ -80,8 +80,7 @@ public: benchmarkPipeline(state, pipeline); } - void benchmarkPipeline(benchmark::State& state, - const std::vector& pipeline) override final { + void benchmarkPipeline(benchmark::State& state, const std::vector& pipeline) final { QueryTestServiceContext testServiceContext; auto opCtx = testServiceContext.makeOperationContext(); auto expCtx = make_intrusive( diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index 8295bde44d5..4db170c8370 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -910,7 +910,7 @@ TEST_F(PlanCacheTest, GetMatchingStatsMatchesAndSerializesCorrectly) { */ class CachePlanSelectionTest : public unittest::Test { protected: - void setUp() { + void setUp() override { params.options = QueryPlannerParams::INCLUDE_COLLSCAN; addIndex(BSON("_id" << 1), "_id_"); } diff --git a/src/mongo/db/query/plan_executor_impl.h b/src/mongo/db/query/plan_executor_impl.h index 6ef1e7efc27..8a20b3621bd 100644 --- a/src/mongo/db/query/plan_executor_impl.h +++ b/src/mongo/db/query/plan_executor_impl.h @@ -139,7 +139,7 @@ public: PlanYieldPolicy::YieldPolicy yieldPolicy, boost::optional cachedPlanHash = boost::none); - virtual ~PlanExecutorImpl(); + ~PlanExecutorImpl() override; CanonicalQuery* getCanonicalQuery() const final; const NamespaceString& nss() const final; const std::vector& getSecondaryNamespaces() const final; @@ -168,7 +168,7 @@ public: LockPolicy lockPolicy() const final; const PlanExplainer& getPlanExplainer() const final; - PlanExecutor::QueryFramework getQueryFramework() const override final { + PlanExecutor::QueryFramework getQueryFramework() const final { return PlanExecutor::QueryFramework::kClassicOnly; } @@ -191,11 +191,11 @@ public: return false; } - void setReturnOwnedData(bool returnOwnedData) override final { + void setReturnOwnedData(bool returnOwnedData) final { _mustReturnOwnedBson = returnOwnedData; } - bool usesCollectionAcquisitions() const override final; + bool usesCollectionAcquisitions() const final; private: /** diff --git a/src/mongo/db/query/plan_executor_sbe.h b/src/mongo/db/query/plan_executor_sbe.h index 7c0ce33d2d5..d75feecebe6 100644 --- a/src/mongo/db/query/plan_executor_sbe.h +++ b/src/mongo/db/query/plan_executor_sbe.h @@ -119,11 +119,11 @@ public: return _opCtx; } - void saveState(); - void restoreState(const RestoreContext& context); + void saveState() override; + void restoreState(const RestoreContext& context) override; - void detachFromOperationContext(); - void reattachToOperationContext(OperationContext* opCtx); + void detachFromOperationContext() override; + void reattachToOperationContext(OperationContext* opCtx) override; ExecState getNext(BSONObj* out, RecordId* dlOut) override; ExecState getNextDocument(Document* objOut, RecordId* dlOut) override; @@ -161,11 +161,11 @@ public: MONGO_UNREACHABLE; } - void markAsKilled(Status killStatus); + void markAsKilled(Status killStatus) override; - void dispose(OperationContext* opCtx); + void dispose(OperationContext* opCtx) override; - void stashResult(const BSONObj& obj); + void stashResult(const BSONObj& obj) override; bool isMarkedAsKilled() const override { return !_killStatus.isOK(); @@ -203,21 +203,21 @@ public: return _isSaveRecoveryUnitAcrossCommandsEnabled; } - PlanExecutor::QueryFramework getQueryFramework() const override final { + PlanExecutor::QueryFramework getQueryFramework() const final { return _generatedByBonsai ? PlanExecutor::QueryFramework::kCQF : PlanExecutor::QueryFramework::kSBEOnly; } - void setReturnOwnedData(bool returnOwnedData) override final { + void setReturnOwnedData(bool returnOwnedData) final { _mustReturnOwnedBson = returnOwnedData; } - bool usesCollectionAcquisitions() const override final; + bool usesCollectionAcquisitions() const final; /** * For queries that have multiple executors, this can be used to differentiate between them. */ - boost::optional getExecutorType() const override final { + boost::optional getExecutorType() const final { return CursorType_serializer(_cursorType); } diff --git a/src/mongo/db/query/plan_explainer_express.h b/src/mongo/db/query/plan_explainer_express.h index f594a440452..0d95249a462 100644 --- a/src/mongo/db/query/plan_explainer_express.h +++ b/src/mongo/db/query/plan_explainer_express.h @@ -70,7 +70,7 @@ public: return {}; } - BSONObj getOptimizerDebugInfo() const { + BSONObj getOptimizerDebugInfo() const override { return {}; } diff --git a/src/mongo/db/query/plan_ranker.cpp b/src/mongo/db/query/plan_ranker.cpp index 724a919621c..43489b3c10d 100644 --- a/src/mongo/db/query/plan_ranker.cpp +++ b/src/mongo/db/query/plan_ranker.cpp @@ -138,7 +138,7 @@ protected: static_cast(stats->common.works); } - std::string getProductivityFormula(const PlanStageStats* stats) const { + std::string getProductivityFormula(const PlanStageStats* stats) const override { StringBuilder sb; sb << "(" << stats->common.advanced << " advanced)/(" << stats->common.works << " works)"; return sb.str(); diff --git a/src/mongo/db/query/plan_summary_stats_visitor.h b/src/mongo/db/query/plan_summary_stats_visitor.h index 67bdcc5bc92..5683f3035e3 100644 --- a/src/mongo/db/query/plan_summary_stats_visitor.h +++ b/src/mongo/db/query/plan_summary_stats_visitor.h @@ -44,45 +44,45 @@ public: explicit PlanSummaryStatsVisitor(PlanSummaryStats& summary) : _summary(summary) {} - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.totalDocsExamined += stats->numReads; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.totalDocsExamined += stats->numRowStoreFetches + stats->numRowStoreScans; for (auto const& stat : stats->cursorStats) _summary.totalKeysExamined += stat.numNexts + stat.numSeeks; for (auto const& stat : stats->parentCursorStats) _summary.totalKeysExamined += stat.numNexts + stat.numSeeks; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.totalKeysExamined += stats->keysExamined; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.usedDisk |= stats->spilledRecords > 0; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.usedDisk |= stats->spilledRecords > 0; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.hasSortStage = true; _summary.usedDisk = _summary.usedDisk || stats->spills > 0; _summary.sortSpills += stats->spills; _summary.sortTotalDataSizeBytes += stats->totalDataSizeBytes; _summary.keysSorted += stats->keysSorted; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { _summary.usedDisk = _summary.usedDisk || stats->spills > 0; } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { accumulate(stats->planSummaryStats); } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { accumulate(stats->planSummaryStats); } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { accumulate(stats->planSummaryStats); } - void visit(tree_walker::MaybeConstPtr stats) override final { + void visit(tree_walker::MaybeConstPtr stats) final { accumulate(stats->planSummaryStats); } diff --git a/src/mongo/db/query/projection_ast.h b/src/mongo/db/query/projection_ast.h index 7fb3effb087..d43d032bea5 100644 --- a/src/mongo/db/query/projection_ast.h +++ b/src/mongo/db/query/projection_ast.h @@ -141,7 +141,7 @@ public: MatchExpressionASTNode(const MatchExpressionASTNode& other) : ASTNode{other}, _matchExpr{other._matchExpr} {} - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { return std::make_unique(*this); } @@ -181,7 +181,7 @@ public: ProjectionPathASTNode(ProjectionPathASTNode&& other) = default; - ~ProjectionPathASTNode() = default; + ~ProjectionPathASTNode() override = default; ProjectionPathASTNode& operator=(const ProjectionPathASTNode& other) = delete; @@ -200,7 +200,7 @@ public: visitor->visit(this); } - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { auto cloneNode = std::make_unique(*this); if (_fieldToChildMap) { // Change the addresses in the new map to point to the cloned children. @@ -306,7 +306,7 @@ public: visitor->visit(this); } - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { return std::make_unique(*this); } }; @@ -323,7 +323,7 @@ public: visitor->visit(this); } - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { return std::make_unique(*this); } @@ -355,7 +355,7 @@ public: visitor->visit(this); } - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { return std::make_unique(*this); } }; @@ -390,7 +390,7 @@ public: visitor->visit(this); } - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { return std::make_unique(*this); } @@ -422,7 +422,7 @@ public: visitor->visit(this); } - std::unique_ptr clone() const override final { + std::unique_ptr clone() const final { return std::make_unique(*this); } diff --git a/src/mongo/db/query/query_planner_test_fixture.h b/src/mongo/db/query/query_planner_test_fixture.h index 10fad43375e..d7bf27ea8a7 100644 --- a/src/mongo/db/query/query_planner_test_fixture.h +++ b/src/mongo/db/query/query_planner_test_fixture.h @@ -63,7 +63,7 @@ namespace mongo { class QueryPlannerTest : public mongo::unittest::Test { protected: - void setUp(); + void setUp() override; /** * Clean up any previous state from a call to runQuery*() diff --git a/src/mongo/db/query/query_shape/agg_cmd_shape.h b/src/mongo/db/query/query_shape/agg_cmd_shape.h index c0ef5a7b06f..b0a29420090 100644 --- a/src/mongo/db/query/query_shape/agg_cmd_shape.h +++ b/src/mongo/db/query/query_shape/agg_cmd_shape.h @@ -88,7 +88,7 @@ public: void appendLetCmdSpecificShapeComponents(BSONObjBuilder& bob, const boost::intrusive_ptr&, const SerializationOptions&) const final; - size_t extraSize() const final override; + size_t extraSize() const final; private: AggCmdShapeComponents _components; diff --git a/src/mongo/db/query/query_shape/cmd_with_let_shape_test.cpp b/src/mongo/db/query/query_shape/cmd_with_let_shape_test.cpp index 9e36de70e34..45441acb38d 100644 --- a/src/mongo/db/query/query_shape/cmd_with_let_shape_test.cpp +++ b/src/mongo/db/query/query_shape/cmd_with_let_shape_test.cpp @@ -44,7 +44,7 @@ class CmdWithLetShapeTest : public unittest::Test {}; struct DummyInnerComponent : public CmdSpecificShapeComponents { DummyInnerComponent(){}; - void HashValue(absl::HashState state) const {} + void HashValue(absl::HashState state) const override {} size_t size() const final { return sizeof(*this); } diff --git a/src/mongo/db/query/query_shape/distinct_cmd_shape_test.cpp b/src/mongo/db/query/query_shape/distinct_cmd_shape_test.cpp index 40d47a67d73..abdb5cccd69 100644 --- a/src/mongo/db/query/query_shape/distinct_cmd_shape_test.cpp +++ b/src/mongo/db/query/query_shape/distinct_cmd_shape_test.cpp @@ -83,7 +83,7 @@ protected: boost::intrusive_ptr expCtx; SerializationOptions opts; - void setUp() { + void setUp() override { expCtx = make_intrusive(); opts = SerializationOptions(SerializationOptions::kRepresentativeQueryShapeSerializeOptions); diff --git a/src/mongo/db/query/query_shape/query_shape_test.cpp b/src/mongo/db/query/query_shape/query_shape_test.cpp index 775eaaa91bb..cad86cd1bd9 100644 --- a/src/mongo/db/query/query_shape/query_shape_test.cpp +++ b/src/mongo/db/query/query_shape/query_shape_test.cpp @@ -701,7 +701,7 @@ static const NamespaceString kDefaultTestNss = struct DummyShapeSpecificComponents : public query_shape::CmdSpecificShapeComponents { DummyShapeSpecificComponents(){}; - void HashValue(absl::HashState state) const {} + void HashValue(absl::HashState state) const override {} size_t size() const final { return sizeof(DummyShapeSpecificComponents); } @@ -740,7 +740,7 @@ public: } // Random number for testing purposes. - size_t extraSize() const final override { + size_t extraSize() const final { return 125; } void appendCmdSpecificShapeComponents(BSONObjBuilder&, diff --git a/src/mongo/db/query/query_solution.h b/src/mongo/db/query/query_solution.h index 65026d1024e..6a0477f83c0 100644 --- a/src/mongo/db/query/query_solution.h +++ b/src/mongo/db/query/query_solution.h @@ -525,22 +525,22 @@ private: struct CollectionScanNode : public QuerySolutionNodeWithSortSet { CollectionScanNode(); - virtual ~CollectionScanNode() {} + ~CollectionScanNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_COLLSCAN; } - virtual void computeProperties() override; - virtual void appendToString(str::stream* ss, int indent) const; + void computeProperties() override; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { // It's possible this is overly conservative. By definition // a collection scan is sorted by its record ids, so if // we're scanning forward this might be true. However, @@ -646,24 +646,24 @@ struct ColumnIndexScanNode : public QuerySolutionNode { std::unique_ptr postAssemblyFilter, bool extraFieldsPermitted = false); - virtual StageType getType() const { + StageType getType() const override { return STAGE_COLUMN_SCAN; } void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return false; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return outputFields.find(field) != outputFields.end() ? FieldAvailability::kFullyProvided : FieldAvailability::kNotProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return true; } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return kEmptySet; } @@ -723,16 +723,16 @@ struct VirtualScanNode : public QuerySolutionNodeWithSortSet { bool hasRecordId, BSONObj indexKeyPattern = {}); - virtual StageType getType() const { + StageType getType() const override { return STAGE_VIRTUAL_SCAN; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return scanType == ScanType::kCollScan; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { if (scanType == ScanType::kCollScan) { return FieldAvailability::kFullyProvided; } else { @@ -740,7 +740,7 @@ struct VirtualScanNode : public QuerySolutionNodeWithSortSet { : FieldAvailability::kNotProvided; } } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } @@ -772,20 +772,20 @@ struct VirtualScanNode : public QuerySolutionNodeWithSortSet { struct AndHashNode : public QuerySolutionNode { AndHashNode(); - virtual ~AndHashNode(); + ~AndHashNode() override; - virtual StageType getType() const { + StageType getType() const override { return STAGE_AND_HASH; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const; - FieldAvailability getFieldAvailability(const std::string& field) const; - bool sortedByDiskLoc() const { + bool fetched() const override; + FieldAvailability getFieldAvailability(const std::string& field) const override; + bool sortedByDiskLoc() const override { return false; } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children.back()->providedSorts(); } @@ -794,17 +794,17 @@ struct AndHashNode : public QuerySolutionNode { struct AndSortedNode : public QuerySolutionNodeWithSortSet { AndSortedNode(); - virtual ~AndSortedNode(); + ~AndSortedNode() override; - virtual StageType getType() const { + StageType getType() const override { return STAGE_AND_SORTED; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const; - FieldAvailability getFieldAvailability(const std::string& field) const; - bool sortedByDiskLoc() const { + bool fetched() const override; + FieldAvailability getFieldAvailability(const std::string& field) const override; + bool sortedByDiskLoc() const override { return true; } @@ -813,17 +813,17 @@ struct AndSortedNode : public QuerySolutionNodeWithSortSet { struct OrNode : public QuerySolutionNodeWithSortSet { OrNode(); - virtual ~OrNode(); + ~OrNode() override; - virtual StageType getType() const { + StageType getType() const override { return STAGE_OR; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const; - FieldAvailability getFieldAvailability(const std::string& field) const; - bool sortedByDiskLoc() const { + bool fetched() const override; + FieldAvailability getFieldAvailability(const std::string& field) const override; + bool sortedByDiskLoc() const override { // Even if our children are sorted by their diskloc or other fields, we don't maintain // any order on the output. return false; @@ -836,23 +836,23 @@ struct OrNode : public QuerySolutionNodeWithSortSet { struct MergeSortNode : public QuerySolutionNodeWithSortSet { MergeSortNode(); - virtual ~MergeSortNode(); + ~MergeSortNode() override; - virtual StageType getType() const { + StageType getType() const override { return STAGE_SORT_MERGE; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const; - FieldAvailability getFieldAvailability(const std::string& field) const; - bool sortedByDiskLoc() const { + bool fetched() const override; + FieldAvailability getFieldAvailability(const std::string& field) const override; + bool sortedByDiskLoc() const override { return false; } std::unique_ptr clone() const final; - virtual void computeProperties() { + void computeProperties() override { for (size_t i = 0; i < children.size(); ++i) { children[i]->computeProperties(); } @@ -866,24 +866,24 @@ struct MergeSortNode : public QuerySolutionNodeWithSortSet { struct FetchNode : public QuerySolutionNode { FetchNode() {} FetchNode(std::unique_ptr child) : QuerySolutionNode(std::move(child)) {} - virtual ~FetchNode() {} + ~FetchNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_FETCH; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -892,17 +892,17 @@ struct FetchNode : public QuerySolutionNode { struct IndexScanNode : public QuerySolutionNodeWithSortSet { IndexScanNode(IndexEntry index); - virtual ~IndexScanNode() {} + ~IndexScanNode() override {} - virtual void computeProperties(); + void computeProperties() override; - virtual StageType getType() const { + StageType getType() const override { return STAGE_IXSCAN; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return false; } /** @@ -910,8 +910,8 @@ struct IndexScanNode : public QuerySolutionNodeWithSortSet { * to do some special handling in the case of collations. */ bool hasStringBounds(const std::string& field) const; - FieldAvailability getFieldAvailability(const std::string& field) const; - bool sortedByDiskLoc() const; + FieldAvailability getFieldAvailability(const std::string& field) const override; + bool sortedByDiskLoc() const override; std::unique_ptr clone() const final; @@ -967,7 +967,7 @@ struct ReturnKeyNode : public QuerySolutionNode { std::vector sortKeyMetaFields) : QuerySolutionNode(std::move(child)), sortKeyMetaFields(std::move(sortKeyMetaFields)) {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_RETURN_KEY; } @@ -1000,26 +1000,26 @@ struct MatchNode : public QuerySolutionNode { this->filter = std::move(filter); } - virtual StageType getType() const { + StageType getType() const override { return STAGE_MATCH; } /** * Data from the match node is considered fetched iff the child provides fetched data. */ - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return children[0]->getFieldAvailability(field); } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -1040,26 +1040,26 @@ struct UnwindNode : public QuerySolutionNode { preserveNullAndEmptyArrays{preserveNullAndEmptyArrays}, indexPath(indexPath) {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_UNWIND; } /** * Data from the unwind node is considered fetched iff the child provides fetched data. */ - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return children[0]->getFieldAvailability(field); } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -1084,26 +1084,26 @@ struct ReplaceRootNode : public QuerySolutionNode { boost::intrusive_ptr newRoot) : QuerySolutionNode(std::move(child)), newRoot(newRoot) {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_REPLACE_ROOT; } /** * Data from the replaceRoot node is considered fetched iff the child provides fetched data. */ - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kNotProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -1134,11 +1134,11 @@ struct ProjectionNode : public QuerySolutionNodeWithSortSet { /** * Data from the projection node is considered fetch iff the child provides fetched data. */ - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { // If we were to construct a plan where the input to the project stage was a hashed value, // and that field was retained exactly, then we would mistakenly return 'kFullyProvided'. // The important point here is that we are careful to construct plans where we fetch before @@ -1148,7 +1148,7 @@ struct ProjectionNode : public QuerySolutionNodeWithSortSet { : FieldAvailability::kNotProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { // Projections destroy the RecordId. By returning true here, this kind of implies that a // fetch could still be done upstream. // @@ -1179,7 +1179,7 @@ public: struct ProjectionNodeDefault final : ProjectionNode { using ProjectionNode::ProjectionNode; - virtual StageType getType() const { + StageType getType() const override { return STAGE_PROJECTION_DEFAULT; } @@ -1201,7 +1201,7 @@ struct ProjectionNodeCovered final : ProjectionNode { : ProjectionNode(std::move(child), fullExpression, std::move(proj)), coveredKeyObj(std::move(coveredKeyObj)) {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_PROJECTION_COVERED; } @@ -1222,7 +1222,7 @@ struct ProjectionNodeCovered final : ProjectionNode { struct ProjectionNodeSimple final : ProjectionNode { using ProjectionNode::ProjectionNode; - virtual StageType getType() const { + StageType getType() const override { return STAGE_PROJECTION_SIMPLE; } @@ -1234,7 +1234,7 @@ struct ProjectionNodeSimple final : ProjectionNode { }; struct SortKeyGeneratorNode : public QuerySolutionNode { - virtual StageType getType() const { + StageType getType() const override { return STAGE_SORT_KEY_GENERATOR; } @@ -1281,21 +1281,21 @@ struct SortNode : public QuerySolutionNodeWithSortSet { canBeParameterized(canBeParameterized) {} SortNode(const SortNode& other); - virtual ~SortNode() {} + ~SortNode() override {} - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return children[0]->getFieldAvailability(field); } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } - virtual void computeProperties() { + void computeProperties() override { for (size_t i = 0; i < children.size(); ++i) { children[i]->computeProperties(); } @@ -1330,7 +1330,7 @@ private: struct SortNodeDefault final : public SortNode { using SortNode::SortNode; - virtual StageType getType() const { + StageType getType() const override { return STAGE_SORT_DEFAULT; } @@ -1350,7 +1350,7 @@ struct SortNodeDefault final : public SortNode { struct SortNodeSimple final : public SortNode { using SortNode::SortNode; - virtual StageType getType() const { + StageType getType() const override { return STAGE_SORT_SIMPLE; } @@ -1370,24 +1370,24 @@ struct LimitNode : public QuerySolutionNode { canBeParameterized(canBeParameterized) {} LimitNode(const LimitNode& other); - virtual ~LimitNode() {} + ~LimitNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_LIMIT; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return children[0]->getFieldAvailability(field); } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -1406,23 +1406,23 @@ struct SkipNode : public QuerySolutionNode { : QuerySolutionNode(std::move(child)), skip(skip), canBeParameterized(canBeParameterized) {} SkipNode(const SkipNode& other); - virtual ~SkipNode() {} + ~SkipNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_SKIP; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return children[0]->getFieldAvailability(field); } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -1438,20 +1438,20 @@ struct GeoNear2DNode : public QuerySolutionNodeWithSortSet { GeoNear2DNode(IndexEntry index) : index(std::move(index)), addPointMeta(false), addDistMeta(false) {} - virtual ~GeoNear2DNode() {} + ~GeoNear2DNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_GEO_NEAR_2D; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } @@ -1470,20 +1470,20 @@ struct GeoNear2DSphereNode : public QuerySolutionNodeWithSortSet { GeoNear2DSphereNode(IndexEntry index) : index(std::move(index)), addPointMeta(false), addDistMeta(false) {} - virtual ~GeoNear2DSphereNode() {} + ~GeoNear2DSphereNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_GEO_NEAR_2DSPHERE; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } @@ -1510,23 +1510,23 @@ struct GeoNear2DSphereNode : public QuerySolutionNodeWithSortSet { */ struct ShardingFilterNode : public QuerySolutionNode { ShardingFilterNode() {} - virtual ~ShardingFilterNode() {} + ~ShardingFilterNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_SHARDING_FILTER; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return children[0]->getFieldAvailability(field); } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } - const ProvidedSortSet& providedSorts() const { + const ProvidedSortSet& providedSorts() const override { return children[0]->providedSorts(); } @@ -1540,19 +1540,19 @@ struct ShardingFilterNode : public QuerySolutionNode { struct DistinctNode : public QuerySolutionNodeWithSortSet { DistinctNode(IndexEntry index) : index(std::move(index)) {} - virtual ~DistinctNode() {} + ~DistinctNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_DISTINCT_SCAN; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; // This stage is created "on top" of normal planning and as such the properties // below don't really matter. - bool fetched() const { + bool fetched() const override { return false; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { // The distinct scan can return collation keys, but we can still consider the field fully // provided. This is because the logic around when the index bounds might incorporate // collation keys does not rely on 'getFieldAvailability()'. As a future improvement, we @@ -1560,13 +1560,13 @@ struct DistinctNode : public QuerySolutionNodeWithSortSet { return index.keyPattern[field].eoo() ? FieldAvailability::kNotProvided : FieldAvailability::kFullyProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } std::unique_ptr clone() const final; - virtual void computeProperties(); + void computeProperties() override; IndexEntry index; IndexBounds bounds; @@ -1584,20 +1584,20 @@ struct DistinctNode : public QuerySolutionNodeWithSortSet { struct CountScanNode : public QuerySolutionNodeWithSortSet { CountScanNode(IndexEntry index) : index(std::move(index)) {} - virtual ~CountScanNode() {} + ~CountScanNode() override {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_COUNT_SCAN; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return false; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } @@ -1620,21 +1620,21 @@ struct CountScanNode : public QuerySolutionNodeWithSortSet { struct EofNode : public QuerySolutionNodeWithSortSet { EofNode() {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_EOF; } - virtual void appendToString(str::stream* ss, int indent) const; + void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return false; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kNotProvided; } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return false; } @@ -1644,7 +1644,7 @@ struct EofNode : public QuerySolutionNodeWithSortSet { struct TextOrNode : public OrNode { TextOrNode() {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_TEXT_OR; } @@ -1656,17 +1656,17 @@ struct TextMatchNode : public QuerySolutionNodeWithSortSet { TextMatchNode(IndexEntry index, std::unique_ptr ftsQuery, bool wantTextScore) : index(std::move(index)), ftsQuery(std::move(ftsQuery)), wantTextScore(wantTextScore) {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_TEXT_MATCH; } void appendToString(str::stream* ss, int indent) const override; // Text's return is LOC_AND_OBJ so it's fetched and has all fields. - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } bool sortedByDiskLoc() const override { @@ -1718,17 +1718,17 @@ struct GroupNode : public QuerySolutionNode { needsAnyMetadata = deps.getNeedsAnyMetadata(); } - virtual StageType getType() const { + StageType getType() const override { return STAGE_GROUP; } void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { // All fields are available, but none of them map to original document. return FieldAvailability::kNotProvided; } @@ -1821,17 +1821,17 @@ struct EqLookupNode : public QuerySolutionNode { idxEntry(std::move(idxEntry)), shouldProduceBson(shouldProduceBson) {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_EQ_LOOKUP; } void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { if (field == joinField) { // This field is available, but isn't mapped to the original document. return FieldAvailability::kNotProvided; @@ -1928,7 +1928,7 @@ struct EqLookupUnwindNode : public QuerySolutionNode { preserveNullAndEmptyArrays, indexPath} {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_EQ_LOOKUP_UNWIND; } @@ -1938,11 +1938,11 @@ struct EqLookupUnwindNode : public QuerySolutionNode { /** * Data from the LU node is considered fetched iff the child provides fetched data. */ - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { if (field == joinField) { // This field is available, but isn't mapped to the original document. return FieldAvailability::kNotProvided; @@ -1951,7 +1951,7 @@ struct EqLookupUnwindNode : public QuerySolutionNode { } } - bool sortedByDiskLoc() const { + bool sortedByDiskLoc() const override { return children[0]->sortedByDiskLoc(); } @@ -2009,17 +2009,17 @@ struct EqLookupUnwindNode : public QuerySolutionNode { struct SentinelNode : public QuerySolutionNode { SentinelNode() {} - virtual StageType getType() const { + StageType getType() const override { return STAGE_SENTINEL; } void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } bool sortedByDiskLoc() const override { @@ -2057,11 +2057,11 @@ struct SearchNode : public QuerySolutionNode { void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } @@ -2122,11 +2122,11 @@ struct UnpackTsBucketNode : public QuerySolutionNode { *ss << "UNPACK_TS_BUCKET\n"; } - bool fetched() const { + bool fetched() const override { return children[0]->fetched(); } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { if (bucketSpec.fieldSet().contains(field)) { // The 'bucketSpec' has a statically known set of fields which include the computed meta // projections and so, are fully provided. @@ -2201,11 +2201,11 @@ struct WindowNode : public QuerySolutionNode { void appendToString(str::stream* ss, int indent) const override; - bool fetched() const { + bool fetched() const override { return true; } - FieldAvailability getFieldAvailability(const std::string& field) const { + FieldAvailability getFieldAvailability(const std::string& field) const override { return FieldAvailability::kFullyProvided; } bool sortedByDiskLoc() const override { diff --git a/src/mongo/db/query/query_stats/agg_key.h b/src/mongo/db/query/query_stats/agg_key.h index 26ff72efbf2..f09a35773e6 100644 --- a/src/mongo/db/query/query_stats/agg_key.h +++ b/src/mongo/db/query/query_stats/agg_key.h @@ -67,7 +67,7 @@ struct AggCmdComponents : public SpecificKeyComponents { void appendTo(BSONObjBuilder& bob, const SerializationOptions& opts) const; - size_t size() const; + size_t size() const override; stdx::unordered_set involvedNamespaces; bool _bypassDocumentValidation; @@ -113,7 +113,7 @@ public: protected: void appendCommandSpecificComponents(BSONObjBuilder& bob, - const SerializationOptions& opts) const final override; + const SerializationOptions& opts) const final; private: const AggCmdComponents _components; diff --git a/src/mongo/db/query/query_stats/find_key.h b/src/mongo/db/query/query_stats/find_key.h index a7552aced1b..d59cfd6f670 100644 --- a/src/mongo/db/query/query_stats/find_key.h +++ b/src/mongo/db/query/query_stats/find_key.h @@ -49,7 +49,7 @@ struct FindCmdComponents : public SpecificKeyComponents { } {} - std::size_t size() const { + std::size_t size() const override { return sizeof(FindCmdComponents); } @@ -124,7 +124,7 @@ public: return H::combine(std::move(h), *key); } - const SpecificKeyComponents& specificComponents() const { + const SpecificKeyComponents& specificComponents() const override { return _components; } diff --git a/src/mongo/db/query/query_stats/key_test.cpp b/src/mongo/db/query/query_stats/key_test.cpp index 66eb0f92f74..e4fc6a4425c 100644 --- a/src/mongo/db/query/query_stats/key_test.cpp +++ b/src/mongo/db/query/query_stats/key_test.cpp @@ -48,7 +48,7 @@ static const NamespaceString kDefaultTestNss = struct DummyShapeSpecificComponents : public query_shape::CmdSpecificShapeComponents { DummyShapeSpecificComponents(){}; - void HashValue(absl::HashState state) const {} + void HashValue(absl::HashState state) const override {} size_t size() const final { return sizeof(DummyShapeSpecificComponents); } @@ -76,8 +76,8 @@ public: struct DummyKeyComponents : public SpecificKeyComponents { DummyKeyComponents(){}; - void HashValue(absl::HashState state) const {} - size_t size() const { + void HashValue(absl::HashState state) const override {} + size_t size() const override { return sizeof(DummyKeyComponents); } }; @@ -94,11 +94,11 @@ public: : Key(opCtx, std::move(queryShape), hint, readConcern, maxTimeMS, collectionType) { components = dummyComponents; } - const SpecificKeyComponents& specificComponents() const { + const SpecificKeyComponents& specificComponents() const override { return components; }; void appendCommandSpecificComponents(BSONObjBuilder& bob, - const SerializationOptions& opts) const {}; + const SerializationOptions& opts) const override{}; DummyKeyComponents components; }; class UniversalKeyTest : public ServiceContextTest {}; diff --git a/src/mongo/db/query/query_stats/query_stats.cpp b/src/mongo/db/query/query_stats/query_stats.cpp index 158c7509a5e..ee4365d3494 100644 --- a/src/mongo/db/query/query_stats/query_stats.cpp +++ b/src/mongo/db/query/query_stats/query_stats.cpp @@ -142,7 +142,7 @@ public: queryStatsEvictedMetric.increment(numEvicted); } - void updateSamplingRate(ServiceContext* serviceCtx, int samplingRate) { + void updateSamplingRate(ServiceContext* serviceCtx, int samplingRate) override { assertConfigurationAllowed(); QueryStatsStoreManager::getRateLimiter(serviceCtx).get()->setSamplingRate(samplingRate); } diff --git a/src/mongo/db/query/sbe_expression_bm.cpp b/src/mongo/db/query/sbe_expression_bm.cpp index 9f7c6542445..35a969d386f 100644 --- a/src/mongo/db/query/sbe_expression_bm.cpp +++ b/src/mongo/db/query/sbe_expression_bm.cpp @@ -94,7 +94,7 @@ public: void benchmarkExpression(BSONObj expressionSpec, benchmark::State& benchmarkState, - const std::vector& documents) override final { + const std::vector& documents) final { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); auto expCtx = make_intrusive(opCtx.get(), kNss); diff --git a/src/mongo/db/query/sbe_planner_interfaces.h b/src/mongo/db/query/sbe_planner_interfaces.h index 22230523c3d..c903ad02915 100644 --- a/src/mongo/db/query/sbe_planner_interfaces.h +++ b/src/mongo/db/query/sbe_planner_interfaces.h @@ -59,7 +59,7 @@ public: * Consumes the canonical query to create the final 'PlanExecutor'. Must be called at most once. */ std::unique_ptr makeExecutor( - std::unique_ptr canonicalQuery) override final; + std::unique_ptr canonicalQuery) final; private: OperationContext* _opCtx; @@ -95,7 +95,7 @@ public: * Consumes the canonical query to create the final 'PlanExecutor'. Must be called at most once. */ std::unique_ptr makeExecutor( - std::unique_ptr canonicalQuery) override final; + std::unique_ptr canonicalQuery) final; private: OperationContext* _opCtx; diff --git a/src/mongo/db/query/search/mongotmock/mongotmock_commands.cpp b/src/mongo/db/query/search/mongotmock/mongotmock_commands.cpp index a63c0ea5a99..9157c3ee946 100644 --- a/src/mongo/db/query/search/mongotmock/mongotmock_commands.cpp +++ b/src/mongo/db/query/search/mongotmock/mongotmock_commands.cpp @@ -68,7 +68,7 @@ public: MONGO_UNREACHABLE; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const final { + bool supportsWriteConcern(const BSONObj& cmd) const final { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/query/stats/collection_statistics_impl.h b/src/mongo/db/query/stats/collection_statistics_impl.h index bd13e48a36d..10d722dec71 100644 --- a/src/mongo/db/query/stats/collection_statistics_impl.h +++ b/src/mongo/db/query/stats/collection_statistics_impl.h @@ -61,7 +61,7 @@ public: void addHistogram(const std::string& path, std::shared_ptr histogram) const override; - ~CollectionStatisticsImpl() = default; + ~CollectionStatisticsImpl() override = default; private: double _cardinality; diff --git a/src/mongo/db/query/stats/collection_statistics_mock.h b/src/mongo/db/query/stats/collection_statistics_mock.h index 5981381b3d1..e2503058bae 100644 --- a/src/mongo/db/query/stats/collection_statistics_mock.h +++ b/src/mongo/db/query/stats/collection_statistics_mock.h @@ -58,7 +58,7 @@ public: */ const ArrayHistogram* getHistogram(const std::string& path) const override; - ~CollectionStatisticsMock() = default; + ~CollectionStatisticsMock() override = default; private: double _cardinality; diff --git a/src/mongo/db/query/stats/stats_cache_loader_mock.h b/src/mongo/db/query/stats/stats_cache_loader_mock.h index f81bd9abfd8..33eb0c97421 100644 --- a/src/mongo/db/query/stats/stats_cache_loader_mock.h +++ b/src/mongo/db/query/stats/stats_cache_loader_mock.h @@ -47,7 +47,7 @@ public: SemiFuture getStats(OperationContext* opCtx, const StatsPathString& statsPath) override; - void setStatsReturnValueForTest(StatusWith swStats); + void setStatsReturnValueForTest(StatusWith swStats) override; static const Status kInternalErrorStatus; diff --git a/src/mongo/db/query/yield_policy_callbacks_impl.h b/src/mongo/db/query/yield_policy_callbacks_impl.h index c89faa80fe4..f2620d197ab 100644 --- a/src/mongo/db/query/yield_policy_callbacks_impl.h +++ b/src/mongo/db/query/yield_policy_callbacks_impl.h @@ -44,7 +44,7 @@ public: */ explicit YieldPolicyCallbacksImpl(NamespaceString nssForFailpoints); - virtual ~YieldPolicyCallbacksImpl() = default; + ~YieldPolicyCallbacksImpl() override = default; void duringYield(OperationContext*) const override; void handledWriteConflict(OperationContext*) const override; diff --git a/src/mongo/db/read_write_concern_defaults.h b/src/mongo/db/read_write_concern_defaults.h index 447f5011366..7af6369b2e5 100644 --- a/src/mongo/db/read_write_concern_defaults.h +++ b/src/mongo/db/read_write_concern_defaults.h @@ -209,7 +209,7 @@ private: Cache(ServiceContext* service, ThreadPoolInterface& threadPool, FetchDefaultsFn fetchDefaultsFn); - virtual ~Cache() = default; + ~Cache() override = default; boost::optional lookup(OperationContext* opCtx); diff --git a/src/mongo/db/read_write_concern_defaults_test.cpp b/src/mongo/db/read_write_concern_defaults_test.cpp index acbd5d862e3..742709973b0 100644 --- a/src/mongo/db/read_write_concern_defaults_test.cpp +++ b/src/mongo/db/read_write_concern_defaults_test.cpp @@ -740,7 +740,7 @@ TEST_F(ReadWriteConcernDefaultsTest, TestRefreshDefaultsWithHigherEpochNoRWCChan */ class ReadWriteConcernDefaultsTestWithClusterTime : public VectorClockTestFixture { public: - virtual ~ReadWriteConcernDefaultsTestWithClusterTime() { + ~ReadWriteConcernDefaultsTestWithClusterTime() override { ReadWriteConcernDefaults::get(getServiceContext()).invalidate(); } diff --git a/src/mongo/db/repl/all_database_cloner.h b/src/mongo/db/repl/all_database_cloner.h index fb3673b9481..3bedbdce18e 100644 --- a/src/mongo/db/repl/all_database_cloner.h +++ b/src/mongo/db/repl/all_database_cloner.h @@ -69,7 +69,7 @@ public: StorageInterface* storageInterface, ThreadPool* dbPool); - virtual ~AllDatabaseCloner() = default; + ~AllDatabaseCloner() override = default; Stats getStats() const; diff --git a/src/mongo/db/repl/base_cloner.h b/src/mongo/db/repl/base_cloner.h index f3a89a704ec..85692591ab8 100644 --- a/src/mongo/db/repl/base_cloner.h +++ b/src/mongo/db/repl/base_cloner.h @@ -155,7 +155,7 @@ protected: ClonerStage(std::string name, T* cloner, ClonerRunFn stageFunc) : BaseClonerStage(name), _cloner(cloner), _stageFunc(stageFunc) {} - virtual AfterStageBehavior run() { + AfterStageBehavior run() override { return (_cloner->*_stageFunc)(); } diff --git a/src/mongo/db/repl/check_quorum_for_config_change.h b/src/mongo/db/repl/check_quorum_for_config_change.h index e78e5ea8f1b..e8431108cb9 100644 --- a/src/mongo/db/repl/check_quorum_for_config_change.h +++ b/src/mongo/db/repl/check_quorum_for_config_change.h @@ -66,13 +66,13 @@ public: * "rsConfig" must stay in scope until QuorumChecker's destructor completes. */ QuorumChecker(const ReplSetConfig* rsConfig, int myIndex, long long term); - virtual ~QuorumChecker(); + ~QuorumChecker() override; - virtual std::vector getRequests() const; - virtual void processResponse(const executor::RemoteCommandRequest& request, - const executor::RemoteCommandResponse& response); + std::vector getRequests() const override; + void processResponse(const executor::RemoteCommandRequest& request, + const executor::RemoteCommandResponse& response) override; - virtual bool hasReceivedSufficientResponses() const; + bool hasReceivedSufficientResponses() const override; Status getFinalStatus() const { return _finalStatus; diff --git a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp index b3e94e8a45f..f1fe76d0cb5 100644 --- a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp +++ b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp @@ -101,7 +101,7 @@ protected: bool isQuorumCheckDone(); private: - void setUp() { + void setUp() override { executor::ThreadPoolExecutorTest::setUp(); launchExecutorThread(); } @@ -143,14 +143,14 @@ void CheckQuorumTest::_runQuorumCheck(const ReplSetConfig& config, int myIndex) class CheckQuorumForInitiate : public CheckQuorumTest { private: - virtual Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) { + Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) override { return checkQuorumForInitiate(&getExecutor(), config, myIndex, 0); } }; class CheckQuorumForReconfig : public CheckQuorumTest { protected: - virtual Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) { + Status _runQuorumCheckImpl(const ReplSetConfig& config, int myIndex) override { return checkQuorumForReconfig(&getExecutor(), config, myIndex, 0); } }; diff --git a/src/mongo/db/repl/collection_bulk_loader_impl.h b/src/mongo/db/repl/collection_bulk_loader_impl.h index 56a4ca66353..219cc76c25d 100644 --- a/src/mongo/db/repl/collection_bulk_loader_impl.h +++ b/src/mongo/db/repl/collection_bulk_loader_impl.h @@ -71,14 +71,14 @@ public: ServiceContext::UniqueOperationContext opCtx, const NamespaceString& nss, const BSONObj& idIndexSpec); - virtual ~CollectionBulkLoaderImpl(); + ~CollectionBulkLoaderImpl() override; - virtual Status init(const std::vector& secondaryIndexSpecs) override; + Status init(const std::vector& secondaryIndexSpecs) override; - virtual Status insertDocuments(std::vector::const_iterator begin, - std::vector::const_iterator end, - ParseRecordIdAndDocFunc fn) override; - virtual Status commit() override; + Status insertDocuments(std::vector::const_iterator begin, + std::vector::const_iterator end, + ParseRecordIdAndDocFunc fn) override; + Status commit() override; CollectionBulkLoaderImpl::Stats getStats() const; diff --git a/src/mongo/db/repl/collection_cloner.h b/src/mongo/db/repl/collection_cloner.h index 5ccf6d8c1e9..b3ddacfb2bd 100644 --- a/src/mongo/db/repl/collection_cloner.h +++ b/src/mongo/db/repl/collection_cloner.h @@ -109,7 +109,7 @@ public: StorageInterface* storageInterface, ThreadPool* dbPool); - virtual ~CollectionCloner() = default; + ~CollectionCloner() override = default; /** * Waits for any database work to finish or fail. diff --git a/src/mongo/db/repl/collection_cloner_test.cpp b/src/mongo/db/repl/collection_cloner_test.cpp index 75971d4c2ac..d29fa3ffcc8 100644 --- a/src/mongo/db/repl/collection_cloner_test.cpp +++ b/src/mongo/db/repl/collection_cloner_test.cpp @@ -157,7 +157,7 @@ protected: class CollectionClonerTestResumable : public CollectionClonerTest { protected: - void setUp() { + void setUp() override { CollectionClonerTest::setUp(); setInitialSyncId(); } diff --git a/src/mongo/db/repl/data_replicator_external_state_impl.h b/src/mongo/db/repl/data_replicator_external_state_impl.h index dd645691bcd..83f8ff04d39 100644 --- a/src/mongo/db/repl/data_replicator_external_state_impl.h +++ b/src/mongo/db/repl/data_replicator_external_state_impl.h @@ -70,7 +70,7 @@ public: ReplicationCoordinatorExternalState* replicationCoordinatorExternalState); executor::TaskExecutor* getTaskExecutor() const override; - std::shared_ptr getSharedTaskExecutor() const; + std::shared_ptr getSharedTaskExecutor() const override; OpTimeWithTerm getCurrentTermAndLastCommittedOpTime() override; diff --git a/src/mongo/db/repl/database_cloner.h b/src/mongo/db/repl/database_cloner.h index 019e33f255a..897f56bc8a7 100644 --- a/src/mongo/db/repl/database_cloner.h +++ b/src/mongo/db/repl/database_cloner.h @@ -74,7 +74,7 @@ public: StorageInterface* storageInterface, ThreadPool* dbPool); - virtual ~DatabaseCloner() = default; + ~DatabaseCloner() override = default; Stats getStats() const; diff --git a/src/mongo/db/repl/idempotency_test_fixture.h b/src/mongo/db/repl/idempotency_test_fixture.h index 408679727da..f060b2b30dc 100644 --- a/src/mongo/db/repl/idempotency_test_fixture.h +++ b/src/mongo/db/repl/idempotency_test_fixture.h @@ -105,7 +105,7 @@ public: ->setMode(FailPoint::alwaysOn); } - ~IdempotencyTest() { + ~IdempotencyTest() override { globalFailPointRegistry() .find("doUntimestampedWritesForIdempotencyTests") ->setMode(FailPoint::off); diff --git a/src/mongo/db/repl/initial_sync_base_cloner.h b/src/mongo/db/repl/initial_sync_base_cloner.h index 1ceb3b59752..bb7bd0d51b5 100644 --- a/src/mongo/db/repl/initial_sync_base_cloner.h +++ b/src/mongo/db/repl/initial_sync_base_cloner.h @@ -53,7 +53,7 @@ public: DBClientConnection* client, StorageInterface* storageInterface, ThreadPool* dbPool); - virtual ~InitialSyncBaseCloner() = default; + ~InitialSyncBaseCloner() override = default; protected: InitialSyncSharedData* getSharedData() const final { @@ -89,7 +89,7 @@ private: * Checks to see if we are still within our allowed outage duration. * Also probes the sync source for clone-fatal conditions, such as rollback. */ - void handleStageAttemptFailed(BaseClonerStage* stage, Status lastError); + void handleStageAttemptFailed(BaseClonerStage* stage, Status lastError) override; /** * Allows the initial sync fuzzer to pause cloner execution at specific points. @@ -102,12 +102,12 @@ private: * string ' db: { ', followed by the stage name, followed by ': ' and the collection UUID * if known. */ - virtual std::string describeForFuzzer(BaseClonerStage*) const = 0; + std::string describeForFuzzer(BaseClonerStage*) const override = 0; /** * Overriden to allow the BaseCloner to use the initial sync log component. */ - virtual logv2::LogComponent getLogComponent() final; + logv2::LogComponent getLogComponent() final; // Operation that may currently be retrying. InitialSyncSharedData::RetryableOperation _retryableOp; diff --git a/src/mongo/db/repl/initial_syncer.h b/src/mongo/db/repl/initial_syncer.h index 293344f2ecd..7652e3d88ab 100644 --- a/src/mongo/db/repl/initial_syncer.h +++ b/src/mongo/db/repl/initial_syncer.h @@ -170,7 +170,7 @@ public: ReplicationProcess* replicationProcess, const OnCompletionFn& onCompletion); - virtual ~InitialSyncer(); + ~InitialSyncer() override; /** * Returns true if an initial sync is currently running or in the process of shutting down. diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp index 116aaaa2db0..edad19277da 100644 --- a/src/mongo/db/repl/oplog_applier_impl.cpp +++ b/src/mongo/db/repl/oplog_applier_impl.cpp @@ -443,7 +443,7 @@ public: ApplyBatchFinalizerForJournal(ReplicationCoordinator* replCoord) : ApplyBatchFinalizer(replCoord), _waiterThread{&ApplyBatchFinalizerForJournal::_run, this} {}; - ~ApplyBatchFinalizerForJournal(); + ~ApplyBatchFinalizerForJournal() override; void record(const OpTimeAndWallTime& newOpTimeAndWallTime) override; diff --git a/src/mongo/db/repl/oplog_applier_impl.h b/src/mongo/db/repl/oplog_applier_impl.h index 1a6b2e3580a..dae3b9b7361 100644 --- a/src/mongo/db/repl/oplog_applier_impl.h +++ b/src/mongo/db/repl/oplog_applier_impl.h @@ -118,7 +118,8 @@ private: * to at least the last optime of the batch. If 'minValid' is already greater than or equal * to the last optime of this batch, it will not be updated. */ - StatusWith _applyOplogBatch(OperationContext* opCtx, std::vector ops); + StatusWith _applyOplogBatch(OperationContext* opCtx, + std::vector ops) override; void _deriveOpsAndFillWriterVectors(OperationContext* opCtx, std::vector* ops, diff --git a/src/mongo/db/repl/oplog_buffer_batched_queue.h b/src/mongo/db/repl/oplog_buffer_batched_queue.h index 2c4c8b913f7..cfdf3344376 100644 --- a/src/mongo/db/repl/oplog_buffer_batched_queue.h +++ b/src/mongo/db/repl/oplog_buffer_batched_queue.h @@ -63,16 +63,16 @@ public: std::size_t getSize() const override; std::size_t getCount() const override; void clear(OperationContext* opCtx) override; - bool tryPop(OperationContext* opCtx, Value* value) { + bool tryPop(OperationContext* opCtx, Value* value) override { MONGO_UNIMPLEMENTED; } bool tryPopBatch(OperationContext* opCtx, OplogBatch* batch) override; bool waitForDataFor(Milliseconds waitDuration, Interruptible* interruptible) override; bool waitForDataUntil(Date_t deadline, Interruptible* interruptible) override; - bool peek(OperationContext* opCtx, Value* value) { + bool peek(OperationContext* opCtx, Value* value) override { MONGO_UNIMPLEMENTED; } - boost::optional lastObjectPushed(OperationContext* opCtx) const { + boost::optional lastObjectPushed(OperationContext* opCtx) const override { MONGO_UNIMPLEMENTED; }; diff --git a/src/mongo/db/repl/oplog_buffer_proxy_test.cpp b/src/mongo/db/repl/oplog_buffer_proxy_test.cpp index 91e77efbabb..7047a881acf 100644 --- a/src/mongo/db/repl/oplog_buffer_proxy_test.cpp +++ b/src/mongo/db/repl/oplog_buffer_proxy_test.cpp @@ -59,7 +59,7 @@ class OplogBufferMock : public OplogBuffer { public: OplogBufferMock() = default; - virtual ~OplogBufferMock() = default; + ~OplogBufferMock() override = default; void startup(OperationContext*) override { startupCalled = true; diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h index 142f452c5c2..5ffb78ad71f 100644 --- a/src/mongo/db/repl/oplog_fetcher.h +++ b/src/mongo/db/repl/oplog_fetcher.h @@ -170,7 +170,7 @@ public: void fetchSuccessful(OplogFetcher* fetcher) final; - ~OplogFetcherRestartDecisionDefault(){}; + ~OplogFetcherRestartDecisionDefault() override{}; private: // Restarts since the last successful oplog query response. @@ -254,7 +254,7 @@ public: OnShutdownCallbackFn onShutdownCallbackFn, Config config); - virtual ~OplogFetcher(); + ~OplogFetcher() override; /** * Validates documents in current batch of results returned from tailing the remote oplog. diff --git a/src/mongo/db/repl/oplog_fetcher_mock.h b/src/mongo/db/repl/oplog_fetcher_mock.h index bcb9886e9d5..6d5b6fd074c 100644 --- a/src/mongo/db/repl/oplog_fetcher_mock.h +++ b/src/mongo/db/repl/oplog_fetcher_mock.h @@ -60,7 +60,7 @@ public: OnShutdownCallbackFn onShutdownCallbackFn, Config config); - virtual ~OplogFetcherMock(); + ~OplogFetcherMock() override; /** * Simulate a batch received by the OplogFetcher. This is a batch that will be enqueued using diff --git a/src/mongo/db/repl/oplog_interface_mock.cpp b/src/mongo/db/repl/oplog_interface_mock.cpp index 67434197828..193a979939e 100644 --- a/src/mongo/db/repl/oplog_interface_mock.cpp +++ b/src/mongo/db/repl/oplog_interface_mock.cpp @@ -108,7 +108,7 @@ public: MONGO_UNREACHABLE; } - virtual ~TransactionHistoryIteratorMock() {} + ~TransactionHistoryIteratorMock() override {} bool hasNext() const override { return !_nextOpTime.isNull(); diff --git a/src/mongo/db/repl/oplog_writer_batcher_test.cpp b/src/mongo/db/repl/oplog_writer_batcher_test.cpp index 0c39ff7a46a..08ce7bcafd0 100644 --- a/src/mongo/db/repl/oplog_writer_batcher_test.cpp +++ b/src/mongo/db/repl/oplog_writer_batcher_test.cpp @@ -46,19 +46,19 @@ class OplogWriterBufferMock : public OplogBuffer { public: OplogWriterBufferMock() = default; - virtual ~OplogWriterBufferMock() = default; - void startup(OperationContext*) { + ~OplogWriterBufferMock() override = default; + void startup(OperationContext*) override { MONGO_UNIMPLEMENTED; } - void shutdown(OperationContext* opCtx) { + void shutdown(OperationContext* opCtx) override { MONGO_UNIMPLEMENTED; } void push(OperationContext*, Batch::const_iterator begin, Batch::const_iterator end, - boost::optional bytes) { + boost::optional bytes) override { MONGO_UNIMPLEMENTED; } @@ -68,36 +68,36 @@ public: _notEmptyCv.notify_one(); } - void waitForSpace(OperationContext*, std::size_t size) { + void waitForSpace(OperationContext*, std::size_t size) override { MONGO_UNIMPLEMENTED; } - bool isEmpty() const { + bool isEmpty() const override { stdx::lock_guard lk(_mutex); return _queue.empty(); } - std::size_t getMaxSize() const { + std::size_t getMaxSize() const override { MONGO_UNIMPLEMENTED; } - std::size_t getSize() const { + std::size_t getSize() const override { MONGO_UNIMPLEMENTED; } - std::size_t getCount() const { + std::size_t getCount() const override { MONGO_UNIMPLEMENTED; } - void clear(OperationContext*) { + void clear(OperationContext*) override { MONGO_UNIMPLEMENTED; } - bool tryPop(OperationContext*, Value* value) { + bool tryPop(OperationContext*, Value* value) override { MONGO_UNIMPLEMENTED; } - bool tryPopBatch(OperationContext* opCtx, OplogBatch* batch) { + bool tryPopBatch(OperationContext* opCtx, OplogBatch* batch) override { stdx::lock_guard lk(_mutex); if (_queue.empty()) { return false; @@ -107,36 +107,36 @@ public: return true; } - bool waitForDataFor(Milliseconds waitDuration, Interruptible* interruptible) { + bool waitForDataFor(Milliseconds waitDuration, Interruptible* interruptible) override { stdx::unique_lock lk(_mutex); interruptible->waitForConditionOrInterruptFor( _notEmptyCv, lk, waitDuration, [&] { return !_queue.empty(); }); return !_queue.empty(); } - bool waitForDataUntil(Date_t deadline, Interruptible* interruptible) { + bool waitForDataUntil(Date_t deadline, Interruptible* interruptible) override { MONGO_UNIMPLEMENTED; } - bool peek(OperationContext*, Value* value) { + bool peek(OperationContext*, Value* value) override { MONGO_UNIMPLEMENTED; } - boost::optional lastObjectPushed(OperationContext*) const { + boost::optional lastObjectPushed(OperationContext*) const override { MONGO_UNIMPLEMENTED; } - void enterDrainMode() { + void enterDrainMode() override { stdx::lock_guard lk(_mutex); _drainMode = true; } - void exitDrainMode() { + void exitDrainMode() override { stdx::lock_guard lk(_mutex); _drainMode = false; } - bool inDrainModeAndEmpty() { + bool inDrainModeAndEmpty() override { stdx::lock_guard lk(_mutex); return _drainMode && _queue.empty(); } diff --git a/src/mongo/db/repl/oplog_writer_impl_test.cpp b/src/mongo/db/repl/oplog_writer_impl_test.cpp index e6d901916d4..7e52fed7bcd 100644 --- a/src/mongo/db/repl/oplog_writer_impl_test.cpp +++ b/src/mongo/db/repl/oplog_writer_impl_test.cpp @@ -73,12 +73,12 @@ public: class JournalListenerMock : public JournalListener { public: - Token getToken(OperationContext* opCtx) { + Token getToken(OperationContext* opCtx) override { return {repl::ReplicationCoordinator::get(opCtx)->getMyLastWrittenOpTimeAndWallTime(true), false /* isPrimary */}; } - void onDurable(const Token& token) { + void onDurable(const Token& token) override { stdx::lock_guard lock(_mutex); _onDurableToken = token.first; } diff --git a/src/mongo/db/repl/primary_only_service.h b/src/mongo/db/repl/primary_only_service.h index 790eefe1373..3b125c1ac33 100644 --- a/src/mongo/db/repl/primary_only_service.h +++ b/src/mongo/db/repl/primary_only_service.h @@ -184,7 +184,7 @@ public: class TypedInstance : public Instance, public std::enable_shared_from_this { public: TypedInstance() = default; - virtual ~TypedInstance() = default; + ~TypedInstance() override = default; /** * Same functionality as PrimaryOnlyService::lookupInstance, but returns a pointer of @@ -573,7 +573,7 @@ private: class PrimaryOnlyServiceRegistry final : public ReplicaSetAwareService { public: PrimaryOnlyServiceRegistry() = default; - ~PrimaryOnlyServiceRegistry() = default; + ~PrimaryOnlyServiceRegistry() override = default; static PrimaryOnlyServiceRegistry* get(ServiceContext* serviceContext); @@ -621,7 +621,7 @@ public: void onStepUpComplete(OperationContext*, long long term) final; void onStepDown() final; void onRollback() final {} - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "PrimaryOnlyServiceRegistry"; } diff --git a/src/mongo/db/repl/primary_only_service_op_observer.h b/src/mongo/db/repl/primary_only_service_op_observer.h index 65febe0610b..cba3d874509 100644 --- a/src/mongo/db/repl/primary_only_service_op_observer.h +++ b/src/mongo/db/repl/primary_only_service_op_observer.h @@ -56,7 +56,7 @@ class PrimaryOnlyServiceOpObserver final : public OpObserverNoop { public: explicit PrimaryOnlyServiceOpObserver(ServiceContext* serviceContext); - ~PrimaryOnlyServiceOpObserver(); + ~PrimaryOnlyServiceOpObserver() override; NamespaceFilters getNamespaceFilters() const final { return {/*update=*/NamespaceFilter::kNone, /*delete=*/NamespaceFilter::kConfig}; diff --git a/src/mongo/db/repl/primary_only_service_test.cpp b/src/mongo/db/repl/primary_only_service_test.cpp index 2c60c63b423..bb85ec95e8b 100644 --- a/src/mongo/db/repl/primary_only_service_test.cpp +++ b/src/mongo/db/repl/primary_only_service_test.cpp @@ -99,7 +99,7 @@ public: }; explicit TestService(ServiceContext* serviceContext) : PrimaryOnlyService(serviceContext) {} - ~TestService() = default; + ~TestService() override = default; StringData getServiceName() const override { return kTestServiceName; diff --git a/src/mongo/db/repl/primary_only_service_util.h b/src/mongo/db/repl/primary_only_service_util.h index 1971d2f0dbf..d78f303c372 100644 --- a/src/mongo/db/repl/primary_only_service_util.h +++ b/src/mongo/db/repl/primary_only_service_util.h @@ -115,7 +115,7 @@ private: class DefaultPrimaryOnlyServiceInstance : public repl::PrimaryOnlyService::TypedInstance { public: - ~DefaultPrimaryOnlyServiceInstance(); + ~DefaultPrimaryOnlyServiceInstance() override; /** * The name of the 'PrimaryOnlyService::Instance'. diff --git a/src/mongo/db/repl/primary_only_service_util_test.cpp b/src/mongo/db/repl/primary_only_service_util_test.cpp index df51286ecd7..a4fd3885891 100644 --- a/src/mongo/db/repl/primary_only_service_util_test.cpp +++ b/src/mongo/db/repl/primary_only_service_util_test.cpp @@ -138,7 +138,7 @@ public: explicit TestDefaultPrimaryOnlyService(ServiceContext* serviceContext) : repl::PrimaryOnlyService(serviceContext) {} - ~TestDefaultPrimaryOnlyService() = default; + ~TestDefaultPrimaryOnlyService() override = default; StringData getServiceName() const final { return kTestPrimaryOnlyServiceName; diff --git a/src/mongo/db/repl/repl_set_command.h b/src/mongo/db/repl/repl_set_command.h index 502471d6694..74f7fce2b89 100644 --- a/src/mongo/db/repl/repl_set_command.h +++ b/src/mongo/db/repl/repl_set_command.h @@ -64,7 +64,7 @@ protected: return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp index 57366c0e797..2f1673f866c 100644 --- a/src/mongo/db/repl/repl_set_commands.cpp +++ b/src/mongo/db/repl/repl_set_commands.cpp @@ -221,10 +221,10 @@ MONGO_REGISTER_COMMAND(CmdReplSetTest).testOnly().forShard(); class CmdReplSetGetRBID : public ReplSetCommand { public: CmdReplSetGetRBID() : ReplSetCommand("replSetGetRBID") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); @@ -242,10 +242,10 @@ public: "http://dochub.mongodb.org/core/replicasetcommands"; } CmdReplSetGetConfig() : ReplSetCommand("replSetGetConfig") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); @@ -371,10 +371,10 @@ public: return "Initiate/christen a replica set.\n" "http://dochub.mongodb.org/core/replicasetcommands"; } - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { BSONObj configObj; if (cmdObj["replSetInitiate"].type() == Object) { configObj = cmdObj["replSetInitiate"].Obj(); @@ -535,10 +535,10 @@ public: "http://dochub.mongodb.org/core/replicasetcommands"; } CmdReplSetFreeze() : ReplSetCommand("replSetFreeze") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); @@ -580,10 +580,10 @@ public: CmdReplSetStepDown() : ReplSetCommand("replSetStepDown") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { const bool force = cmdObj["force"].trueValue(); if (force) { @@ -658,10 +658,10 @@ public: "Enable or disable maintenance mode."; } CmdReplSetMaintenance() : ReplSetCommand("replSetMaintenance") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); @@ -685,10 +685,10 @@ public: "in-progress initial sync."; } CmdReplSetSyncFrom() : ReplSetCommand("replSetSyncFrom") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); @@ -711,10 +711,10 @@ MONGO_REGISTER_COMMAND(CmdReplSetSyncFrom).forShard(); class CmdReplSetUpdatePosition : public ReplSetCommand { public: CmdReplSetUpdatePosition() : ReplSetCommand("replSetUpdatePosition") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { auto replCoord = repl::ReplicationCoordinator::get(opCtx->getClient()->getServiceContext()); Status status = replCoord->checkReplEnabledForCommand(&result); @@ -789,10 +789,10 @@ MONGO_FAIL_POINT_DEFINE(rsDelayHeartbeatResponse); class CmdReplSetHeartbeat : public ReplSetCommand { public: CmdReplSetHeartbeat() : ReplSetCommand("replSetHeartbeat") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { rsDelayHeartbeatResponse.execute( [&](const BSONObj& data) { sleepsecs(data["delay"].numberInt()); }); @@ -838,10 +838,10 @@ class CmdReplSetStepUp : public ReplSetCommand { public: CmdReplSetStepUp() : ReplSetCommand("replSetStepUp") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); @@ -875,10 +875,10 @@ public: CmdReplSetAbortPrimaryCatchUp() : ReplSetCommand("replSetAbortPrimaryCatchUp") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) override { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { Status status = ReplicationCoordinator::get(opCtx)->checkReplEnabledForCommand(&result); uassertStatusOK(status); LOGV2(21583, "Received replSetAbortPrimaryCatchUp request"); diff --git a/src/mongo/db/repl/repl_set_tag_test.cpp b/src/mongo/db/repl/repl_set_tag_test.cpp index 12b397947d6..5e7654d72ed 100644 --- a/src/mongo/db/repl/repl_set_tag_test.cpp +++ b/src/mongo/db/repl/repl_set_tag_test.cpp @@ -89,7 +89,7 @@ TEST(ReplSetTagConfigTest, MakeAndFindTags) { class ReplSetTagMatchTest : public unittest::Test { public: - void setUp() { + void setUp() override { dcNY = tagConfig.makeTag("dc", "ny"); dcVA = tagConfig.makeTag("dc", "va"); dcRI = tagConfig.makeTag("dc", "ri"); diff --git a/src/mongo/db/repl/replica_set_aware_service.h b/src/mongo/db/repl/replica_set_aware_service.h index f6e94da4863..adc4eaacfe6 100644 --- a/src/mongo/db/repl/replica_set_aware_service.h +++ b/src/mongo/db/repl/replica_set_aware_service.h @@ -255,7 +255,7 @@ public: void onStepDown() final; void onRollback() final; void onBecomeArbiter() final; - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "ReplicaSetAwareServiceRegistry"; } @@ -310,7 +310,7 @@ private: template class ReplicaSetAwareServiceConfigSvr : public ReplicaSetAwareService { private: - virtual bool shouldRegisterReplicaSetAwareService() const final { + bool shouldRegisterReplicaSetAwareService() const final { return serverGlobalParams.clusterRole.has(ClusterRole::ConfigServer); } }; @@ -322,7 +322,7 @@ private: template class ReplicaSetAwareServiceShardSvr : public ReplicaSetAwareService { private: - virtual bool shouldRegisterReplicaSetAwareService() const final { + bool shouldRegisterReplicaSetAwareService() const final { return serverGlobalParams.clusterRole.has(ClusterRole::ShardServer); } }; diff --git a/src/mongo/db/repl/replica_set_aware_service_test.cpp b/src/mongo/db/repl/replica_set_aware_service_test.cpp index 4db0103f308..26be36267d7 100644 --- a/src/mongo/db/repl/replica_set_aware_service_test.cpp +++ b/src/mongo/db/repl/replica_set_aware_service_test.cpp @@ -115,7 +115,7 @@ private: return false; } - std::string getServiceName() const final override { + std::string getServiceName() const final { return "ServiceA"; } }; @@ -141,7 +141,7 @@ private: return true; } - std::string getServiceName() const final override { + std::string getServiceName() const final { return "ServiceB"; } }; @@ -169,7 +169,7 @@ private: return true; } - std::string getServiceName() const final override { + std::string getServiceName() const final { return "ServiceC"; } @@ -257,7 +257,7 @@ private: return true; } - std::string getServiceName() const final override { + std::string getServiceName() const final { return "SlowService"; } diff --git a/src/mongo/db/repl/replication_consistency_markers_impl_bm.cpp b/src/mongo/db/repl/replication_consistency_markers_impl_bm.cpp index 5fa4003b8c9..8d4a5cc0951 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl_bm.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl_bm.cpp @@ -119,7 +119,7 @@ public: return _opCtx.get(); } - ~ReplicationConsistencyMarkersBm() { + ~ReplicationConsistencyMarkersBm() override { tearDown(); } diff --git a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp index c276ce1a3c1..932d9c5ecf8 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp @@ -83,11 +83,11 @@ BSONObj getMinValidDocument(OperationContext* opCtx, const NamespaceString& minV class JournalListenerWithDurabilityTracking : public JournalListener { public: - Token getToken(OperationContext* opCtx) { + Token getToken(OperationContext* opCtx) override { return {}; } - void onDurable(const Token& token) { + void onDurable(const Token& token) override { onDurableCalled = true; } diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h index af1edae2ce1..eb7ef2f28de 100644 --- a/src/mongo/db/repl/replication_coordinator.h +++ b/src/mongo/db/repl/replication_coordinator.h @@ -141,7 +141,7 @@ public: StatusAndDuration(const Status& stat, Milliseconds ms) : status(stat), duration(ms) {} }; - virtual ~ReplicationCoordinator(); + ~ReplicationCoordinator() override; /** * Does any initial bookkeeping needed to start replication, and instructs the other diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.h b/src/mongo/db/repl/replication_coordinator_external_state_impl.h index 8892aa5a503..14dd51980aa 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.h @@ -88,70 +88,70 @@ public: DropPendingCollectionReaper* dropPendingCollectionReaper, StorageInterface* storageInterface, ReplicationProcess* replicationProcess); - virtual ~ReplicationCoordinatorExternalStateImpl(); - virtual void startThreads() override; - virtual void startSteadyStateReplication(OperationContext* opCtx, - ReplicationCoordinator* replCoord) override; - virtual bool isInitialSyncFlagSet(OperationContext* opCtx) override; + ~ReplicationCoordinatorExternalStateImpl() override; + void startThreads() override; + void startSteadyStateReplication(OperationContext* opCtx, + ReplicationCoordinator* replCoord) override; + bool isInitialSyncFlagSet(OperationContext* opCtx) override; - virtual void shutdown(OperationContext* opCtx); + void shutdown(OperationContext* opCtx) override; - virtual executor::TaskExecutor* getTaskExecutor() const override; + executor::TaskExecutor* getTaskExecutor() const override; std::shared_ptr getSharedTaskExecutor() const override; - virtual ThreadPool* getDbWorkThreadPool() const override; - virtual Status initializeReplSetStorage(OperationContext* opCtx, const BSONObj& config); + ThreadPool* getDbWorkThreadPool() const override; + Status initializeReplSetStorage(OperationContext* opCtx, const BSONObj& config) override; void onDrainComplete(OperationContext* opCtx) override; OpTime onTransitionToPrimary(OperationContext* opCtx) override; - virtual void forwardSecondaryProgress(bool prioritized = false); - virtual bool isSelf(const HostAndPort& host, ServiceContext* service); + void forwardSecondaryProgress(bool prioritized = false) override; + bool isSelf(const HostAndPort& host, ServiceContext* service) override; bool isSelfFastPath(const HostAndPort& host) final; bool isSelfSlowPath(const HostAndPort& host, ServiceContext* service, Milliseconds timeout) final; Status createLocalLastVoteCollection(OperationContext* opCtx) final; - virtual StatusWith loadLocalConfigDocument(OperationContext* opCtx); - virtual Status storeLocalConfigDocument(OperationContext* opCtx, - const BSONObj& config, - bool writeOplog); - virtual Status replaceLocalConfigDocument(OperationContext* opCtx, const BSONObj& config); - virtual StatusWith loadLocalLastVoteDocument(OperationContext* opCtx); - virtual Status storeLocalLastVoteDocument(OperationContext* opCtx, const LastVote& lastVote); - virtual void setGlobalTimestamp(ServiceContext* service, const Timestamp& newTime); - virtual Timestamp getGlobalTimestamp(ServiceContext* service); + StatusWith loadLocalConfigDocument(OperationContext* opCtx) override; + Status storeLocalConfigDocument(OperationContext* opCtx, + const BSONObj& config, + bool writeOplog) override; + Status replaceLocalConfigDocument(OperationContext* opCtx, const BSONObj& config) override; + StatusWith loadLocalLastVoteDocument(OperationContext* opCtx) override; + Status storeLocalLastVoteDocument(OperationContext* opCtx, const LastVote& lastVote) override; + void setGlobalTimestamp(ServiceContext* service, const Timestamp& newTime) override; + Timestamp getGlobalTimestamp(ServiceContext* service) override; bool oplogExists(OperationContext* opCtx) final; - virtual StatusWith loadLastOpTimeAndWallTime(OperationContext* opCtx); - virtual HostAndPort getClientHostAndPort(const OperationContext* opCtx); - virtual void closeConnections(); - virtual void onStepDownHook(); - virtual void signalApplierToChooseNewSyncSource(); - virtual void stopProducer(); - virtual void startProducerIfStopped(); + StatusWith loadLastOpTimeAndWallTime(OperationContext* opCtx) override; + HostAndPort getClientHostAndPort(const OperationContext* opCtx) override; + void closeConnections() override; + void onStepDownHook() override; + void signalApplierToChooseNewSyncSource() override; + void stopProducer() override; + void startProducerIfStopped() override; void notifyOtherMemberDataChanged() final; - virtual bool tooStale(); + bool tooStale() override; void clearCommittedSnapshot() final; void updateCommittedSnapshot(const OpTime& newCommitPoint) final; void updateLastAppliedSnapshot(const OpTime& optime) final; - virtual bool snapshotsEnabled() const; - virtual void notifyOplogMetadataWaiters(const OpTime& committedOpTime); + bool snapshotsEnabled() const override; + void notifyOplogMetadataWaiters(const OpTime& committedOpTime) override; boost::optional getEarliestDropPendingOpTime() const final; - virtual double getElectionTimeoutOffsetLimitFraction() const; - virtual bool isReadConcernSnapshotSupportedByStorageEngine(OperationContext* opCtx) const; - virtual std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const override; - virtual std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const override; + double getElectionTimeoutOffsetLimitFraction() const override; + bool isReadConcernSnapshotSupportedByStorageEngine(OperationContext* opCtx) const override; + std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const override; + std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const override; JournalListener* getReplicationJournalListener() final; // Methods from JournalListener. - virtual JournalListener::Token getToken(OperationContext* opCtx); - virtual void onDurable(const JournalListener::Token& token); + JournalListener::Token getToken(OperationContext* opCtx) override; + void onDurable(const JournalListener::Token& token) override; - virtual void setupNoopWriter(Seconds waitTime); - virtual void startNoopWriter(OpTime); - virtual void stopNoopWriter(); + void setupNoopWriter(Seconds waitTime) override; + void startNoopWriter(OpTime) override; + void stopNoopWriter() override; - virtual bool isCWWCSetOnConfigShard(OperationContext* opCtx) const final; + bool isCWWCSetOnConfigShard(OperationContext* opCtx) const final; - virtual bool isShardPartOfShardedCluster(OperationContext* opCtx) const final; + bool isShardPartOfShardedCluster(OperationContext* opCtx) const final; private: /** diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h index 92919857c29..9cd985b5ef5 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h @@ -73,54 +73,54 @@ public: class GlobalSharedLockAcquirer; ReplicationCoordinatorExternalStateMock(); - virtual ~ReplicationCoordinatorExternalStateMock(); - virtual void startThreads() override; - virtual void startSteadyStateReplication(OperationContext* opCtx, - ReplicationCoordinator* replCoord) override; - virtual bool isInitialSyncFlagSet(OperationContext* opCtx) override; + ~ReplicationCoordinatorExternalStateMock() override; + void startThreads() override; + void startSteadyStateReplication(OperationContext* opCtx, + ReplicationCoordinator* replCoord) override; + bool isInitialSyncFlagSet(OperationContext* opCtx) override; - virtual void shutdown(OperationContext* opCtx); - virtual executor::TaskExecutor* getTaskExecutor() const override; - virtual std::shared_ptr getSharedTaskExecutor() const override; - virtual ThreadPool* getDbWorkThreadPool() const override; - virtual Status initializeReplSetStorage(OperationContext* opCtx, const BSONObj& config); + void shutdown(OperationContext* opCtx) override; + executor::TaskExecutor* getTaskExecutor() const override; + std::shared_ptr getSharedTaskExecutor() const override; + ThreadPool* getDbWorkThreadPool() const override; + Status initializeReplSetStorage(OperationContext* opCtx, const BSONObj& config) override; void onDrainComplete(OperationContext* opCtx) override; OpTime onTransitionToPrimary(OperationContext* opCtx) override; - virtual void forwardSecondaryProgress(bool prioritized); - virtual bool isSelf(const HostAndPort& host, ServiceContext* service); + void forwardSecondaryProgress(bool prioritized) override; + bool isSelf(const HostAndPort& host, ServiceContext* service) override; bool isSelfFastPath(const HostAndPort& host) final; bool isSelfSlowPath(const HostAndPort& host, ServiceContext* service, Milliseconds timeout) final; - virtual HostAndPort getClientHostAndPort(const OperationContext* opCtx); - virtual StatusWith loadLocalConfigDocument(OperationContext* opCtx); - virtual Status storeLocalConfigDocument(OperationContext* opCtx, - const BSONObj& config, - bool writeOplog); - virtual Status replaceLocalConfigDocument(OperationContext* opCtx, const BSONObj& config); - virtual StatusWith loadLocalLastVoteDocument(OperationContext* opCtx); - virtual Status storeLocalLastVoteDocument(OperationContext* opCtx, const LastVote& lastVote); - virtual void setGlobalTimestamp(ServiceContext* service, const Timestamp& newTime); - virtual Timestamp getGlobalTimestamp(ServiceContext* service); + HostAndPort getClientHostAndPort(const OperationContext* opCtx) override; + StatusWith loadLocalConfigDocument(OperationContext* opCtx) override; + Status storeLocalConfigDocument(OperationContext* opCtx, + const BSONObj& config, + bool writeOplog) override; + Status replaceLocalConfigDocument(OperationContext* opCtx, const BSONObj& config) override; + StatusWith loadLocalLastVoteDocument(OperationContext* opCtx) override; + Status storeLocalLastVoteDocument(OperationContext* opCtx, const LastVote& lastVote) override; + void setGlobalTimestamp(ServiceContext* service, const Timestamp& newTime) override; + Timestamp getGlobalTimestamp(ServiceContext* service) override; bool oplogExists(OperationContext* opCtx) override; - virtual StatusWith loadLastOpTimeAndWallTime(OperationContext* opCtx); - virtual void closeConnections(); - virtual void onStepDownHook(); - virtual void signalApplierToChooseNewSyncSource(); - virtual void stopProducer(); - virtual void startProducerIfStopped(); + StatusWith loadLastOpTimeAndWallTime(OperationContext* opCtx) override; + void closeConnections() override; + void onStepDownHook() override; + void signalApplierToChooseNewSyncSource() override; + void stopProducer() override; + void startProducerIfStopped() override; void notifyOtherMemberDataChanged() final; - virtual bool tooStale(); - virtual void clearCommittedSnapshot(); - virtual void updateCommittedSnapshot(const OpTime& newCommitPoint); - virtual void updateLastAppliedSnapshot(const OpTime& optime); - virtual bool snapshotsEnabled() const; - virtual void notifyOplogMetadataWaiters(const OpTime& committedOpTime); + bool tooStale() override; + void clearCommittedSnapshot() override; + void updateCommittedSnapshot(const OpTime& newCommitPoint) override; + void updateLastAppliedSnapshot(const OpTime& optime) override; + bool snapshotsEnabled() const override; + void notifyOplogMetadataWaiters(const OpTime& committedOpTime) override; boost::optional getEarliestDropPendingOpTime() const final; - virtual double getElectionTimeoutOffsetLimitFraction() const; - virtual bool isReadConcernSnapshotSupportedByStorageEngine(OperationContext* opCtx) const; - virtual std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const override; - virtual std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const override; + double getElectionTimeoutOffsetLimitFraction() const override; + bool isReadConcernSnapshotSupportedByStorageEngine(OperationContext* opCtx) const override; + std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const override; + std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const override; /** * Adds "host" to the list of hosts that this mock will match when responding to "isSelf" @@ -210,21 +210,21 @@ public: /** * Noop */ - virtual void setupNoopWriter(Seconds waitTime); + void setupNoopWriter(Seconds waitTime) override; /** * Noop */ - virtual void startNoopWriter(OpTime lastKnownOpTime); + void startNoopWriter(OpTime lastKnownOpTime) override; /** * Noop */ - virtual void stopNoopWriter(); + void stopNoopWriter() override; - virtual bool isCWWCSetOnConfigShard(OperationContext* opCtx) const final; + bool isCWWCSetOnConfigShard(OperationContext* opCtx) const final; - virtual bool isShardPartOfShardedCluster(OperationContext* opCtx) const final; + bool isShardPartOfShardedCluster(OperationContext* opCtx) const final; /** * Clear the _otherMemberDataChanged flag so we can check it later. diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index d42c9dbdc6e..15daea23921 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -153,327 +153,323 @@ public: StorageInterface* storage, int64_t prngSeed); - virtual ~ReplicationCoordinatorImpl(); + ~ReplicationCoordinatorImpl() override; // ================== Members of public ReplicationCoordinator API =================== - virtual void startup(OperationContext* opCtx, - StorageEngine::LastShutdownState lastShutdownState) override; + void startup(OperationContext* opCtx, + StorageEngine::LastShutdownState lastShutdownState) override; - virtual void enterTerminalShutdown() override; + void enterTerminalShutdown() override; - virtual bool enterQuiesceModeIfSecondary(Milliseconds quiesceTime) override; + bool enterQuiesceModeIfSecondary(Milliseconds quiesceTime) override; - virtual bool inQuiesceMode() const override; + bool inQuiesceMode() const override; - virtual void shutdown(OperationContext* opCtx, - BSONObjBuilder* shutdownTimeElapsedBuilder) override; + void shutdown(OperationContext* opCtx, BSONObjBuilder* shutdownTimeElapsedBuilder) override; - virtual const ReplSettings& getSettings() const override; + const ReplSettings& getSettings() const override; - virtual MemberState getMemberState() const override; + MemberState getMemberState() const override; - virtual std::vector getMemberData() const override; + std::vector getMemberData() const override; - virtual bool canAcceptNonLocalWrites() const override; + bool canAcceptNonLocalWrites() const override; - virtual Status waitForMemberState(Interruptible* interruptible, - MemberState expectedState, - Milliseconds timeout) override; + Status waitForMemberState(Interruptible* interruptible, + MemberState expectedState, + Milliseconds timeout) override; - virtual bool isInPrimaryOrSecondaryState(OperationContext* opCtx) const override; + bool isInPrimaryOrSecondaryState(OperationContext* opCtx) const override; - virtual bool isInPrimaryOrSecondaryState_UNSAFE() const override; + bool isInPrimaryOrSecondaryState_UNSAFE() const override; - virtual Seconds getSecondaryDelaySecs() const override; + Seconds getSecondaryDelaySecs() const override; - virtual void clearSyncSourceDenylist() override; + void clearSyncSourceDenylist() override; - virtual ReplicationCoordinator::StatusAndDuration awaitReplication( - OperationContext* opCtx, const OpTime& opTime, const WriteConcernOptions& writeConcern); + ReplicationCoordinator::StatusAndDuration awaitReplication( + OperationContext* opCtx, + const OpTime& opTime, + const WriteConcernOptions& writeConcern) override; - virtual SharedSemiFuture awaitReplicationAsyncNoWTimeout( - const OpTime& opTime, const WriteConcernOptions& writeConcern); + SharedSemiFuture awaitReplicationAsyncNoWTimeout( + const OpTime& opTime, const WriteConcernOptions& writeConcern) override; void stepDown(OperationContext* opCtx, bool force, const Milliseconds& waitTime, const Milliseconds& stepdownTime) override; - virtual bool isWritablePrimaryForReportingPurposes(); + bool isWritablePrimaryForReportingPurposes() override; - virtual bool canAcceptWritesForDatabase(OperationContext* opCtx, const DatabaseName& dbName); - virtual bool canAcceptWritesForDatabase_UNSAFE(OperationContext* opCtx, - const DatabaseName& dbName); + bool canAcceptWritesForDatabase(OperationContext* opCtx, const DatabaseName& dbName) override; + bool canAcceptWritesForDatabase_UNSAFE(OperationContext* opCtx, + const DatabaseName& dbName) override; bool canAcceptWritesFor(OperationContext* opCtx, const NamespaceStringOrUUID& nsorUUID) override; bool canAcceptWritesFor_UNSAFE(OperationContext* opCtx, const NamespaceStringOrUUID& nsOrUUID) override; - virtual Status checkIfWriteConcernCanBeSatisfied(const WriteConcernOptions& writeConcern) const; + Status checkIfWriteConcernCanBeSatisfied( + const WriteConcernOptions& writeConcern) const override; - virtual Status checkIfCommitQuorumCanBeSatisfied( + Status checkIfCommitQuorumCanBeSatisfied( const CommitQuorumOptions& commitQuorum) const override; - virtual bool isCommitQuorumSatisfied( - const CommitQuorumOptions& commitQuorum, - const std::vector& members) const override; + bool isCommitQuorumSatisfied(const CommitQuorumOptions& commitQuorum, + const std::vector& members) const override; - virtual Status checkCanServeReadsFor(OperationContext* opCtx, - const NamespaceString& ns, - bool secondaryOk); - virtual Status checkCanServeReadsFor_UNSAFE(OperationContext* opCtx, - const NamespaceString& ns, - bool secondaryOk); + Status checkCanServeReadsFor(OperationContext* opCtx, + const NamespaceString& ns, + bool secondaryOk) override; + Status checkCanServeReadsFor_UNSAFE(OperationContext* opCtx, + const NamespaceString& ns, + bool secondaryOk) override; - virtual bool shouldRelaxIndexConstraints(OperationContext* opCtx, const NamespaceString& ns); + bool shouldRelaxIndexConstraints(OperationContext* opCtx, const NamespaceString& ns) override; - virtual void setMyLastWrittenOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastAppliedOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastDurableOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastAppliedAndLastWrittenOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastDurableAndLastWrittenOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); + void setMyLastWrittenOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastAppliedOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastDurableOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastAppliedAndLastWrittenOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastDurableAndLastWrittenOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; - virtual void resetMyLastOpTimes(); + void resetMyLastOpTimes() override; - virtual void setMyHeartbeatMessage(const std::string& msg); + void setMyHeartbeatMessage(const std::string& msg) override; - virtual OpTime getMyLastWrittenOpTime() const override; - virtual OpTimeAndWallTime getMyLastWrittenOpTimeAndWallTime( - bool rollbackSafe = false) const override; + OpTime getMyLastWrittenOpTime() const override; + OpTimeAndWallTime getMyLastWrittenOpTimeAndWallTime(bool rollbackSafe = false) const override; - virtual OpTime getMyLastAppliedOpTime() const override; - virtual OpTimeAndWallTime getMyLastAppliedOpTimeAndWallTime() const override; + OpTime getMyLastAppliedOpTime() const override; + OpTimeAndWallTime getMyLastAppliedOpTimeAndWallTime() const override; - virtual OpTime getMyLastDurableOpTime() const override; - virtual OpTimeAndWallTime getMyLastDurableOpTimeAndWallTime() const override; + OpTime getMyLastDurableOpTime() const override; + OpTimeAndWallTime getMyLastDurableOpTimeAndWallTime() const override; - virtual Status waitUntilMajorityOpTime(OperationContext* opCtx, - OpTime targetOpTime, - boost::optional deadline = boost::none) override; + Status waitUntilMajorityOpTime(OperationContext* opCtx, + OpTime targetOpTime, + boost::optional deadline = boost::none) override; - virtual Status waitUntilOpTimeForReadUntil(OperationContext* opCtx, - const ReadConcernArgs& readConcern, - boost::optional deadline) override; - virtual Status waitUntilOpTimeWrittenUntil(OperationContext* opCtx, - LogicalTime clusterTime, - boost::optional deadline) override; + Status waitUntilOpTimeForReadUntil(OperationContext* opCtx, + const ReadConcernArgs& readConcern, + boost::optional deadline) override; + Status waitUntilOpTimeWrittenUntil(OperationContext* opCtx, + LogicalTime clusterTime, + boost::optional deadline) override; - virtual Status waitUntilOpTimeForRead(OperationContext* opCtx, - const ReadConcernArgs& readConcern) override; + Status waitUntilOpTimeForRead(OperationContext* opCtx, + const ReadConcernArgs& readConcern) override; Status awaitTimestampCommitted(OperationContext* opCtx, Timestamp ts) override; - virtual OID getElectionId() override; + OID getElectionId() override; - virtual int getMyId() const override; + int getMyId() const override; - virtual HostAndPort getMyHostAndPort() const override; + HostAndPort getMyHostAndPort() const override; - virtual Status setFollowerMode(const MemberState& newState) override; + Status setFollowerMode(const MemberState& newState) override; - virtual Status setFollowerModeRollback(OperationContext* opCtx) override; + Status setFollowerModeRollback(OperationContext* opCtx) override; - virtual ApplierState getApplierState() override; + ApplierState getApplierState() override; - virtual void signalDrainComplete(OperationContext* opCtx, - long long termWhenBufferIsEmpty) noexcept override; + void signalDrainComplete(OperationContext* opCtx, + long long termWhenBufferIsEmpty) noexcept override; - virtual void signalUpstreamUpdater() override; + void signalUpstreamUpdater() override; - virtual StatusWith prepareReplSetUpdatePositionCommand() const override; + StatusWith prepareReplSetUpdatePositionCommand() const override; - virtual Status processReplSetGetStatus(OperationContext* opCtx, - BSONObjBuilder* result, - ReplSetGetStatusResponseStyle responseStyle) override; + Status processReplSetGetStatus(OperationContext* opCtx, + BSONObjBuilder* result, + ReplSetGetStatusResponseStyle responseStyle) override; - virtual void appendSecondaryInfoData(BSONObjBuilder* result) override; + void appendSecondaryInfoData(BSONObjBuilder* result) override; - virtual ReplSetConfig getConfig() const override; + ReplSetConfig getConfig() const override; - virtual ConnectionString getConfigConnectionString() const override; + ConnectionString getConfigConnectionString() const override; - virtual Milliseconds getConfigElectionTimeoutPeriod() const override; + Milliseconds getConfigElectionTimeoutPeriod() const override; - virtual std::vector getConfigVotingMembers() const override; + std::vector getConfigVotingMembers() const override; - virtual size_t getNumConfigVotingMembers() const override; + size_t getNumConfigVotingMembers() const override; - virtual std::int64_t getConfigTerm() const override; + std::int64_t getConfigTerm() const override; - virtual std::int64_t getConfigVersion() const override; + std::int64_t getConfigVersion() const override; - virtual ConfigVersionAndTerm getConfigVersionAndTerm() const override; + ConfigVersionAndTerm getConfigVersionAndTerm() const override; - virtual int getConfigNumMembers() const override; + int getConfigNumMembers() const override; - virtual Milliseconds getConfigHeartbeatTimeoutPeriodMillis() const override; + Milliseconds getConfigHeartbeatTimeoutPeriodMillis() const override; - virtual BSONObj getConfigBSON() const override; + BSONObj getConfigBSON() const override; - virtual boost::optional findConfigMemberByHostAndPort_deprecated( + boost::optional findConfigMemberByHostAndPort_deprecated( const HostAndPort& hap) const override; - virtual bool isConfigLocalHostAllowed() const override; + bool isConfigLocalHostAllowed() const override; - virtual Milliseconds getConfigHeartbeatInterval() const override; + Milliseconds getConfigHeartbeatInterval() const override; - virtual Status validateWriteConcern(const WriteConcernOptions& writeConcern) const override; + Status validateWriteConcern(const WriteConcernOptions& writeConcern) const override; - virtual void processReplSetGetConfig(BSONObjBuilder* result, - bool commitmentStatus = false, - bool includeNewlyAdded = false) override; + void processReplSetGetConfig(BSONObjBuilder* result, + bool commitmentStatus = false, + bool includeNewlyAdded = false) override; - virtual void processReplSetMetadata(const rpc::ReplSetMetadata& replMetadata) override; + void processReplSetMetadata(const rpc::ReplSetMetadata& replMetadata) override; - virtual void advanceCommitPoint(const OpTimeAndWallTime& committedOpTimeAndWallTime, - bool fromSyncSource) override; + void advanceCommitPoint(const OpTimeAndWallTime& committedOpTimeAndWallTime, + bool fromSyncSource) override; - virtual void cancelAndRescheduleElectionTimeout() override; + void cancelAndRescheduleElectionTimeout() override; - virtual Status setMaintenanceMode(OperationContext* opCtx, bool activate) override; + Status setMaintenanceMode(OperationContext* opCtx, bool activate) override; - virtual bool getMaintenanceMode() override; + bool getMaintenanceMode() override; - virtual bool shouldDropSyncSourceAfterShardSplit(OID replicaSetId) const override; + bool shouldDropSyncSourceAfterShardSplit(OID replicaSetId) const override; - virtual Status processReplSetSyncFrom(OperationContext* opCtx, - const HostAndPort& target, - BSONObjBuilder* resultObj) override; + Status processReplSetSyncFrom(OperationContext* opCtx, + const HostAndPort& target, + BSONObjBuilder* resultObj) override; - virtual Status processReplSetFreeze(int secs, BSONObjBuilder* resultObj) override; + Status processReplSetFreeze(int secs, BSONObjBuilder* resultObj) override; - virtual Status processReplSetReconfig(OperationContext* opCtx, - const ReplSetReconfigArgs& args, - BSONObjBuilder* resultObj) override; + Status processReplSetReconfig(OperationContext* opCtx, + const ReplSetReconfigArgs& args, + BSONObjBuilder* resultObj) override; - virtual Status doReplSetReconfig(OperationContext* opCtx, - GetNewConfigFn getNewConfig, - bool force) override; + Status doReplSetReconfig(OperationContext* opCtx, + GetNewConfigFn getNewConfig, + bool force) override; - virtual Status doOptimizedReconfig(OperationContext* opCtx, GetNewConfigFn) override; + Status doOptimizedReconfig(OperationContext* opCtx, GetNewConfigFn) override; - virtual Status awaitConfigCommitment(OperationContext* opCtx, - bool waitForOplogCommitment, - long long term) override; + Status awaitConfigCommitment(OperationContext* opCtx, + bool waitForOplogCommitment, + long long term) override; - virtual Status processReplSetInitiate(OperationContext* opCtx, - const BSONObj& configObj, - BSONObjBuilder* resultObj) override; + Status processReplSetInitiate(OperationContext* opCtx, + const BSONObj& configObj, + BSONObjBuilder* resultObj) override; - virtual Status processReplSetUpdatePosition(const UpdatePositionArgs& updates) override; + Status processReplSetUpdatePosition(const UpdatePositionArgs& updates) override; - virtual bool buildsIndexes() override; + bool buildsIndexes() override; - virtual std::vector getHostsWrittenTo(const OpTime& op, - bool durablyWritten) override; + std::vector getHostsWrittenTo(const OpTime& op, bool durablyWritten) override; - virtual WriteConcernOptions getGetLastErrorDefault() override; + WriteConcernOptions getGetLastErrorDefault() override; - virtual Status checkReplEnabledForCommand(BSONObjBuilder* result) override; + Status checkReplEnabledForCommand(BSONObjBuilder* result) override; - virtual HostAndPort chooseNewSyncSource(const OpTime& lastOpTimeFetched) override; + HostAndPort chooseNewSyncSource(const OpTime& lastOpTimeFetched) override; - virtual void denylistSyncSource(const HostAndPort& host, Date_t until) override; + void denylistSyncSource(const HostAndPort& host, Date_t until) override; - virtual void resetLastOpTimesFromOplog(OperationContext* opCtx) override; + void resetLastOpTimesFromOplog(OperationContext* opCtx) override; - virtual ChangeSyncSourceAction shouldChangeSyncSource( - const HostAndPort& currentSource, - const rpc::ReplSetMetadata& replMetadata, - const rpc::OplogQueryMetadata& oqMetadata, - const OpTime& previousOpTimeFetched, - const OpTime& lastOpTimeFetched) const override; + ChangeSyncSourceAction shouldChangeSyncSource(const HostAndPort& currentSource, + const rpc::ReplSetMetadata& replMetadata, + const rpc::OplogQueryMetadata& oqMetadata, + const OpTime& previousOpTimeFetched, + const OpTime& lastOpTimeFetched) const override; - virtual ChangeSyncSourceAction shouldChangeSyncSourceOnError( + ChangeSyncSourceAction shouldChangeSyncSourceOnError( const HostAndPort& currentSource, const OpTime& lastOpTimeFetched) const override; - virtual OpTime getLastCommittedOpTime() const override; - virtual OpTimeAndWallTime getLastCommittedOpTimeAndWallTime() const override; + OpTime getLastCommittedOpTime() const override; + OpTimeAndWallTime getLastCommittedOpTimeAndWallTime() const override; - virtual Status processReplSetRequestVotes(OperationContext* opCtx, - const ReplSetRequestVotesArgs& args, - ReplSetRequestVotesResponse* response) override; + Status processReplSetRequestVotes(OperationContext* opCtx, + const ReplSetRequestVotesArgs& args, + ReplSetRequestVotesResponse* response) override; - virtual void prepareReplMetadata(const BSONObj& metadataRequestObj, - const OpTime& lastOpTimeFromClient, - BSONObjBuilder* builder) const override; + void prepareReplMetadata(const BSONObj& metadataRequestObj, + const OpTime& lastOpTimeFromClient, + BSONObjBuilder* builder) const override; - virtual Status processHeartbeatV1(const ReplSetHeartbeatArgsV1& args, - ReplSetHeartbeatResponse* response) override; + Status processHeartbeatV1(const ReplSetHeartbeatArgsV1& args, + ReplSetHeartbeatResponse* response) override; - virtual bool getWriteConcernMajorityShouldJournal() override; + bool getWriteConcernMajorityShouldJournal() override; - virtual void clearCommittedSnapshot() override; + void clearCommittedSnapshot() override; /** * Get current term from topology coordinator */ - virtual long long getTerm() const override; + long long getTerm() const override; // Returns the ServiceContext where this instance runs. - virtual ServiceContext* getServiceContext() override { + ServiceContext* getServiceContext() override { return _service; } - virtual Status updateTerm(OperationContext* opCtx, long long term) override; + Status updateTerm(OperationContext* opCtx, long long term) override; - virtual OpTime getCurrentCommittedSnapshotOpTime() const override; + OpTime getCurrentCommittedSnapshotOpTime() const override; - virtual void waitUntilSnapshotCommitted(OperationContext* opCtx, - const Timestamp& untilSnapshot) override; + void waitUntilSnapshotCommitted(OperationContext* opCtx, + const Timestamp& untilSnapshot) override; void appendDiagnosticBSON(BSONObjBuilder*, StringData) override; - virtual void appendConnectionStats(executor::ConnectionPoolStats* stats) const override; + void appendConnectionStats(executor::ConnectionPoolStats* stats) const override; - virtual void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) override; + void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) override; - virtual WriteConcernOptions populateUnsetWriteConcernOptionsSyncMode( - WriteConcernOptions wc) override; + WriteConcernOptions populateUnsetWriteConcernOptionsSyncMode(WriteConcernOptions wc) override; - virtual Status stepUpIfEligible(bool skipDryRun) override; + Status stepUpIfEligible(bool skipDryRun) override; - virtual Status abortCatchupIfNeeded(PrimaryCatchUpConclusionReason reason) override; + Status abortCatchupIfNeeded(PrimaryCatchUpConclusionReason reason) override; - virtual void incrementNumCatchUpOpsIfCatchingUp(long numOps) override; + void incrementNumCatchUpOpsIfCatchingUp(long numOps) override; - virtual boost::optional getRecoveryTimestamp() override; + boost::optional getRecoveryTimestamp() override; - virtual bool setContainsArbiter() const override; + bool setContainsArbiter() const override; - virtual void attemptToAdvanceStableTimestamp() override; + void attemptToAdvanceStableTimestamp() override; - virtual void finishRecoveryIfEligible(OperationContext* opCtx) override; + void finishRecoveryIfEligible(OperationContext* opCtx) override; - virtual void updateAndLogStateTransitionMetrics( + void updateAndLogStateTransitionMetrics( ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, size_t numOpsKilled, size_t numOpsRunning) const override; - virtual TopologyVersion getTopologyVersion() const override; + TopologyVersion getTopologyVersion() const override; - virtual void incrementTopologyVersion() override; + void incrementTopologyVersion() override; using SharedHelloResponse = std::shared_ptr; - virtual SharedSemiFuture getHelloResponseFuture( + SharedSemiFuture getHelloResponseFuture( const SplitHorizon::Parameters& horizonParams, boost::optional clientTopologyVersion) override; - virtual std::shared_ptr awaitHelloResponse( + std::shared_ptr awaitHelloResponse( OperationContext* opCtx, const SplitHorizon::Parameters& horizonParams, boost::optional clientTopologyVersion, boost::optional deadline) override; - virtual StatusWith getLatestWriteOpTime( - OperationContext* opCtx) const noexcept override; + StatusWith getLatestWriteOpTime(OperationContext* opCtx) const noexcept override; - virtual HostAndPort getCurrentPrimaryHostAndPort() const override; + HostAndPort getCurrentPrimaryHostAndPort() const override; void cancelCbkHandle(executor::TaskExecutor::CallbackHandle activeHandle) override; @@ -483,11 +479,11 @@ public: OnRemoteCmdScheduledFn onRemoteCmdScheduled, OnRemoteCmdCompleteFn onRemoteCmdComplete) override; - virtual void restartScheduledHeartbeats_forTest() override; + void restartScheduledHeartbeats_forTest() override; - virtual void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; + void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; - virtual SplitPrepareSessionManager* getSplitPrepareSessionManager() override; + SplitPrepareSessionManager* getSplitPrepareSessionManager() override; // ==================== Private API =================== // Called by AutoGetRstlForStepUpStepDown before taking RSTL when making stepdown transitions @@ -605,7 +601,7 @@ public: class WriteConcernTagChangesImpl : public WriteConcernTagChanges { public: WriteConcernTagChangesImpl() = default; - virtual ~WriteConcernTagChangesImpl() = default; + ~WriteConcernTagChangesImpl() override = default; bool reserveDefaultWriteConcernChange() override { stdx::lock_guard lock(_mutex); diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp index 9463ec16de5..04f7810c09b 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp @@ -970,7 +970,7 @@ TEST_F(ReplCoordHBV1SplitConfigTest, RecipientNodeNonZeroVotes) { class ReplCoordHBV1ReconfigTest : public ReplCoordHBV1Test { public: - void setUp() { + void setUp() override { BSONObj configBson = BSON("_id" << "mySet" << "version" << initConfigVersion << "term" << initConfigTerm diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index 8d4719c4531..1e373171498 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -1656,7 +1656,7 @@ protected: OID rid3; private: - virtual void setUp() { + void setUp() override { ReplCoordTest::setUp(); initAndStart(); } diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h index 1f61e3e430f..f5258c43c37 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.h +++ b/src/mongo/db/repl/replication_coordinator_mock.h @@ -109,56 +109,58 @@ public: */ explicit ReplicationCoordinatorMock(ServiceContext* service); - virtual ~ReplicationCoordinatorMock(); + ~ReplicationCoordinatorMock() override; - virtual void startup(OperationContext* opCtx, - StorageEngine::LastShutdownState lastShutdownState); + void startup(OperationContext* opCtx, + StorageEngine::LastShutdownState lastShutdownState) override; - virtual void enterTerminalShutdown(); + void enterTerminalShutdown() override; - virtual bool enterQuiesceModeIfSecondary(Milliseconds quieseTime); + bool enterQuiesceModeIfSecondary(Milliseconds quieseTime) override; - virtual bool inQuiesceMode() const; + bool inQuiesceMode() const override; - virtual void shutdown(OperationContext* opCtx, BSONObjBuilder* shutdownTimeElapsedBuilder); + void shutdown(OperationContext* opCtx, BSONObjBuilder* shutdownTimeElapsedBuilder) override; void appendDiagnosticBSON(BSONObjBuilder* bob, StringData leafName) override {} - virtual const ReplSettings& getSettings() const; + const ReplSettings& getSettings() const override; - virtual MemberState getMemberState() const; + MemberState getMemberState() const override; - virtual bool canAcceptNonLocalWrites() const; + bool canAcceptNonLocalWrites() const override; - virtual Status waitForMemberState(Interruptible* interruptible, - MemberState expectedState, - Milliseconds timeout) override; + Status waitForMemberState(Interruptible* interruptible, + MemberState expectedState, + Milliseconds timeout) override; - virtual bool isInPrimaryOrSecondaryState(OperationContext* opCtx) const; + bool isInPrimaryOrSecondaryState(OperationContext* opCtx) const override; - virtual bool isInPrimaryOrSecondaryState_UNSAFE() const; + bool isInPrimaryOrSecondaryState_UNSAFE() const override; - virtual Seconds getSecondaryDelaySecs() const; + Seconds getSecondaryDelaySecs() const override; - virtual void clearSyncSourceDenylist(); + void clearSyncSourceDenylist() override; - virtual ReplicationCoordinator::StatusAndDuration awaitReplication( - OperationContext* opCtx, const OpTime& opTime, const WriteConcernOptions& writeConcern); + ReplicationCoordinator::StatusAndDuration awaitReplication( + OperationContext* opCtx, + const OpTime& opTime, + const WriteConcernOptions& writeConcern) override; - virtual SharedSemiFuture awaitReplicationAsyncNoWTimeout( - const OpTime& opTime, const WriteConcernOptions& writeConcern); + SharedSemiFuture awaitReplicationAsyncNoWTimeout( + const OpTime& opTime, const WriteConcernOptions& writeConcern) override; void stepDown(OperationContext* opCtx, bool force, const Milliseconds& waitTime, const Milliseconds& stepdownTime) override; - virtual bool isWritablePrimaryForReportingPurposes(); + bool isWritablePrimaryForReportingPurposes() override; - virtual bool canAcceptWritesForDatabase(OperationContext* opCtx, const DatabaseName& dbName); + bool canAcceptWritesForDatabase(OperationContext* opCtx, const DatabaseName& dbName) override; - virtual bool canAcceptWritesForDatabase_UNSAFE(OperationContext* opCtx, - const DatabaseName& dbName); + bool canAcceptWritesForDatabase_UNSAFE(OperationContext* opCtx, + const DatabaseName& dbName) override; bool canAcceptWritesFor(OperationContext* opCtx, const NamespaceStringOrUUID& nsOrUUID) override; @@ -166,227 +168,228 @@ public: bool canAcceptWritesFor_UNSAFE(OperationContext* opCtx, const NamespaceStringOrUUID& nsOrUUID) override; - virtual Status checkIfWriteConcernCanBeSatisfied(const WriteConcernOptions& writeConcern) const; + Status checkIfWriteConcernCanBeSatisfied( + const WriteConcernOptions& writeConcern) const override; - virtual Status checkIfCommitQuorumCanBeSatisfied(const CommitQuorumOptions& commitQuorum) const; + Status checkIfCommitQuorumCanBeSatisfied( + const CommitQuorumOptions& commitQuorum) const override; - virtual bool isCommitQuorumSatisfied(const CommitQuorumOptions& commitQuorum, - const std::vector& members) const; + bool isCommitQuorumSatisfied(const CommitQuorumOptions& commitQuorum, + const std::vector& members) const override; - virtual Status checkCanServeReadsFor(OperationContext* opCtx, - const NamespaceString& ns, - bool secondaryOk); - virtual Status checkCanServeReadsFor_UNSAFE(OperationContext* opCtx, - const NamespaceString& ns, - bool secondaryOk); + Status checkCanServeReadsFor(OperationContext* opCtx, + const NamespaceString& ns, + bool secondaryOk) override; + Status checkCanServeReadsFor_UNSAFE(OperationContext* opCtx, + const NamespaceString& ns, + bool secondaryOk) override; - virtual bool shouldRelaxIndexConstraints(OperationContext* opCtx, const NamespaceString& ns); + bool shouldRelaxIndexConstraints(OperationContext* opCtx, const NamespaceString& ns) override; - virtual void setMyLastWrittenOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastAppliedOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastDurableOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastAppliedAndLastWrittenOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); - virtual void setMyLastDurableAndLastWrittenOpTimeAndWallTimeForward( - const OpTimeAndWallTime& opTimeAndWallTime); + void setMyLastWrittenOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastAppliedOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastDurableOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastAppliedAndLastWrittenOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; + void setMyLastDurableAndLastWrittenOpTimeAndWallTimeForward( + const OpTimeAndWallTime& opTimeAndWallTime) override; - virtual void resetMyLastOpTimes(); + void resetMyLastOpTimes() override; - virtual void setMyHeartbeatMessage(const std::string& msg); + void setMyHeartbeatMessage(const std::string& msg) override; - virtual OpTime getMyLastWrittenOpTime() const; - virtual OpTimeAndWallTime getMyLastWrittenOpTimeAndWallTime(bool rollbackSafe) const; + OpTime getMyLastWrittenOpTime() const override; + OpTimeAndWallTime getMyLastWrittenOpTimeAndWallTime(bool rollbackSafe) const override; - virtual OpTimeAndWallTime getMyLastAppliedOpTimeAndWallTime() const; - virtual OpTime getMyLastAppliedOpTime() const; + OpTimeAndWallTime getMyLastAppliedOpTimeAndWallTime() const override; + OpTime getMyLastAppliedOpTime() const override; - virtual OpTimeAndWallTime getMyLastDurableOpTimeAndWallTime() const; - virtual OpTime getMyLastDurableOpTime() const; + OpTimeAndWallTime getMyLastDurableOpTimeAndWallTime() const override; + OpTime getMyLastDurableOpTime() const override; - virtual Status waitUntilMajorityOpTime(OperationContext* opCtx, - OpTime targetOpTime, - boost::optional deadline) override; + Status waitUntilMajorityOpTime(OperationContext* opCtx, + OpTime targetOpTime, + boost::optional deadline) override; - virtual Status waitUntilOpTimeForRead(OperationContext* opCtx, - const ReadConcernArgs& settings) override; + Status waitUntilOpTimeForRead(OperationContext* opCtx, + const ReadConcernArgs& settings) override; - virtual Status waitUntilOpTimeForReadUntil(OperationContext* opCtx, - const ReadConcernArgs& settings, - boost::optional deadline) override; - virtual Status waitUntilOpTimeWrittenUntil(OperationContext* opCtx, - LogicalTime clusterTime, - boost::optional deadline) override; - virtual Status awaitTimestampCommitted(OperationContext* opCtx, Timestamp ts); - virtual OID getElectionId(); + Status waitUntilOpTimeForReadUntil(OperationContext* opCtx, + const ReadConcernArgs& settings, + boost::optional deadline) override; + Status waitUntilOpTimeWrittenUntil(OperationContext* opCtx, + LogicalTime clusterTime, + boost::optional deadline) override; + Status awaitTimestampCommitted(OperationContext* opCtx, Timestamp ts) override; + OID getElectionId() override; virtual OID getMyRID() const; - virtual int getMyId() const; + int getMyId() const override; - virtual HostAndPort getMyHostAndPort() const; + HostAndPort getMyHostAndPort() const override; - virtual Status setFollowerMode(const MemberState& newState); + Status setFollowerMode(const MemberState& newState) override; - virtual Status setFollowerModeRollback(OperationContext* opCtx); + Status setFollowerModeRollback(OperationContext* opCtx) override; - virtual ApplierState getApplierState(); + ApplierState getApplierState() override; - virtual void signalDrainComplete(OperationContext*, long long) noexcept; + void signalDrainComplete(OperationContext*, long long) noexcept override; - virtual void signalUpstreamUpdater(); + void signalUpstreamUpdater() override; - virtual StatusWith prepareReplSetUpdatePositionCommand() const override; + StatusWith prepareReplSetUpdatePositionCommand() const override; - virtual Status processReplSetGetStatus(OperationContext* opCtx, - BSONObjBuilder*, - ReplSetGetStatusResponseStyle); + Status processReplSetGetStatus(OperationContext* opCtx, + BSONObjBuilder*, + ReplSetGetStatusResponseStyle) override; - virtual void appendSecondaryInfoData(BSONObjBuilder* result); + void appendSecondaryInfoData(BSONObjBuilder* result) override; void appendConnectionStats(executor::ConnectionPoolStats* stats) const override; - virtual ReplSetConfig getConfig() const; + ReplSetConfig getConfig() const override; - virtual ConnectionString getConfigConnectionString() const override; + ConnectionString getConfigConnectionString() const override; - virtual Milliseconds getConfigElectionTimeoutPeriod() const override; + Milliseconds getConfigElectionTimeoutPeriod() const override; - virtual std::vector getConfigVotingMembers() const override; + std::vector getConfigVotingMembers() const override; - virtual size_t getNumConfigVotingMembers() const override; + size_t getNumConfigVotingMembers() const override; - virtual std::int64_t getConfigTerm() const override; + std::int64_t getConfigTerm() const override; - virtual std::int64_t getConfigVersion() const override; + std::int64_t getConfigVersion() const override; - virtual ConfigVersionAndTerm getConfigVersionAndTerm() const override; + ConfigVersionAndTerm getConfigVersionAndTerm() const override; - virtual int getConfigNumMembers() const override; + int getConfigNumMembers() const override; - virtual Milliseconds getConfigHeartbeatTimeoutPeriodMillis() const override; + Milliseconds getConfigHeartbeatTimeoutPeriodMillis() const override; - virtual BSONObj getConfigBSON() const override; + BSONObj getConfigBSON() const override; - virtual boost::optional findConfigMemberByHostAndPort_deprecated( + boost::optional findConfigMemberByHostAndPort_deprecated( const HostAndPort& hap) const override; - virtual Status validateWriteConcern(const WriteConcernOptions& writeConcern) const override; + Status validateWriteConcern(const WriteConcernOptions& writeConcern) const override; - virtual bool isConfigLocalHostAllowed() const override; + bool isConfigLocalHostAllowed() const override; - virtual Milliseconds getConfigHeartbeatInterval() const override; + Milliseconds getConfigHeartbeatInterval() const override; - virtual void processReplSetGetConfig(BSONObjBuilder* result, - bool commitmentStatus = false, - bool includeNewlyAdded = false); + void processReplSetGetConfig(BSONObjBuilder* result, + bool commitmentStatus = false, + bool includeNewlyAdded = false) override; - virtual void processReplSetMetadata(const rpc::ReplSetMetadata& replMetadata) override; + void processReplSetMetadata(const rpc::ReplSetMetadata& replMetadata) override; - virtual void advanceCommitPoint(const OpTimeAndWallTime& committedOptimeAndWallTime, - bool fromSyncSource) override; + void advanceCommitPoint(const OpTimeAndWallTime& committedOptimeAndWallTime, + bool fromSyncSource) override; - virtual void cancelAndRescheduleElectionTimeout() override; + void cancelAndRescheduleElectionTimeout() override; - virtual Status setMaintenanceMode(OperationContext* opCtx, bool activate); + Status setMaintenanceMode(OperationContext* opCtx, bool activate) override; - virtual bool getMaintenanceMode(); + bool getMaintenanceMode() override; - virtual bool shouldDropSyncSourceAfterShardSplit(OID replicaSetId) const; + bool shouldDropSyncSourceAfterShardSplit(OID replicaSetId) const override; - virtual Status processReplSetSyncFrom(OperationContext* opCtx, - const HostAndPort& target, - BSONObjBuilder* resultObj); + Status processReplSetSyncFrom(OperationContext* opCtx, + const HostAndPort& target, + BSONObjBuilder* resultObj) override; - virtual Status processReplSetFreeze(int secs, BSONObjBuilder* resultObj); + Status processReplSetFreeze(int secs, BSONObjBuilder* resultObj) override; - virtual Status processReplSetReconfig(OperationContext* opCtx, - const ReplSetReconfigArgs& args, - BSONObjBuilder* resultObj); + Status processReplSetReconfig(OperationContext* opCtx, + const ReplSetReconfigArgs& args, + BSONObjBuilder* resultObj) override; BSONObj getLatestReconfig(); - virtual Status doReplSetReconfig(OperationContext* opCtx, - GetNewConfigFn getNewConfig, - bool force); + Status doReplSetReconfig(OperationContext* opCtx, + GetNewConfigFn getNewConfig, + bool force) override; - virtual Status doOptimizedReconfig(OperationContext* opCtx, GetNewConfigFn getNewConfig); + Status doOptimizedReconfig(OperationContext* opCtx, GetNewConfigFn getNewConfig) override; Status awaitConfigCommitment(OperationContext* opCtx, bool waitForOplogCommitment, - long long term); + long long term) override; - virtual Status processReplSetInitiate(OperationContext* opCtx, - const BSONObj& configObj, - BSONObjBuilder* resultObj); + Status processReplSetInitiate(OperationContext* opCtx, + const BSONObj& configObj, + BSONObjBuilder* resultObj) override; - virtual Status processReplSetUpdatePosition(const UpdatePositionArgs& updates); + Status processReplSetUpdatePosition(const UpdatePositionArgs& updates) override; - virtual bool buildsIndexes(); + bool buildsIndexes() override; - virtual std::vector getHostsWrittenTo(const OpTime& op, bool durablyWritten); + std::vector getHostsWrittenTo(const OpTime& op, bool durablyWritten) override; - virtual WriteConcernOptions getGetLastErrorDefault(); + WriteConcernOptions getGetLastErrorDefault() override; - virtual Status checkReplEnabledForCommand(BSONObjBuilder* result); + Status checkReplEnabledForCommand(BSONObjBuilder* result) override; - virtual HostAndPort chooseNewSyncSource(const OpTime& lastOpTimeFetched); + HostAndPort chooseNewSyncSource(const OpTime& lastOpTimeFetched) override; - virtual void denylistSyncSource(const HostAndPort& host, Date_t until); + void denylistSyncSource(const HostAndPort& host, Date_t until) override; - virtual void resetLastOpTimesFromOplog(OperationContext* opCtx); + void resetLastOpTimesFromOplog(OperationContext* opCtx) override; bool lastOpTimesWereReset() const; - virtual ChangeSyncSourceAction shouldChangeSyncSource(const HostAndPort& currentSource, - const rpc::ReplSetMetadata& replMetadata, - const rpc::OplogQueryMetadata& oqMetadata, - const OpTime& previousOpTimeFetched, - const OpTime& lastOpTimeFetched) const; + ChangeSyncSourceAction shouldChangeSyncSource(const HostAndPort& currentSource, + const rpc::ReplSetMetadata& replMetadata, + const rpc::OplogQueryMetadata& oqMetadata, + const OpTime& previousOpTimeFetched, + const OpTime& lastOpTimeFetched) const override; - virtual ChangeSyncSourceAction shouldChangeSyncSourceOnError( - const HostAndPort& currentSource, const OpTime& lastOpTimeFetched) const; + ChangeSyncSourceAction shouldChangeSyncSourceOnError( + const HostAndPort& currentSource, const OpTime& lastOpTimeFetched) const override; - virtual OpTime getLastCommittedOpTime() const; + OpTime getLastCommittedOpTime() const override; - virtual OpTimeAndWallTime getLastCommittedOpTimeAndWallTime() const; + OpTimeAndWallTime getLastCommittedOpTimeAndWallTime() const override; - virtual std::vector getMemberData() const override; + std::vector getMemberData() const override; - virtual Status processReplSetRequestVotes(OperationContext* opCtx, - const ReplSetRequestVotesArgs& args, - ReplSetRequestVotesResponse* response); + Status processReplSetRequestVotes(OperationContext* opCtx, + const ReplSetRequestVotesArgs& args, + ReplSetRequestVotesResponse* response) override; void prepareReplMetadata(const BSONObj& metadataRequestObj, const OpTime& lastOpTimeFromClient, BSONObjBuilder* builder) const override; - virtual Status processHeartbeatV1(const ReplSetHeartbeatArgsV1& args, - ReplSetHeartbeatResponse* response); + Status processHeartbeatV1(const ReplSetHeartbeatArgsV1& args, + ReplSetHeartbeatResponse* response) override; - virtual bool getWriteConcernMajorityShouldJournal(); + bool getWriteConcernMajorityShouldJournal() override; - virtual long long getTerm() const; + long long getTerm() const override; - virtual Status updateTerm(OperationContext* opCtx, long long term); + Status updateTerm(OperationContext* opCtx, long long term) override; - virtual void clearCommittedSnapshot() override; + void clearCommittedSnapshot() override; void setCurrentCommittedSnapshotOpTime(OpTime time); - virtual OpTime getCurrentCommittedSnapshotOpTime() const override; + OpTime getCurrentCommittedSnapshotOpTime() const override; - virtual void waitUntilSnapshotCommitted(OperationContext* opCtx, - const Timestamp& untilSnapshot) override; + void waitUntilSnapshotCommitted(OperationContext* opCtx, + const Timestamp& untilSnapshot) override; - virtual void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) override; + void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) override; - virtual WriteConcernOptions populateUnsetWriteConcernOptionsSyncMode( - WriteConcernOptions wc) override; + WriteConcernOptions populateUnsetWriteConcernOptionsSyncMode(WriteConcernOptions wc) override; - virtual Status stepUpIfEligible(bool skipDryRun) override; + Status stepUpIfEligible(bool skipDryRun) override; /** * Sets the return value for calls to getConfig. @@ -416,47 +419,46 @@ public: */ void alwaysAllowWrites(bool allowWrites); - virtual ServiceContext* getServiceContext() override { + ServiceContext* getServiceContext() override { return _service; } - virtual Status abortCatchupIfNeeded(PrimaryCatchUpConclusionReason reason) override; + Status abortCatchupIfNeeded(PrimaryCatchUpConclusionReason reason) override; - virtual void incrementNumCatchUpOpsIfCatchingUp(long numOps) override; + void incrementNumCatchUpOpsIfCatchingUp(long numOps) override; - virtual boost::optional getRecoveryTimestamp() override; + boost::optional getRecoveryTimestamp() override; - virtual bool setContainsArbiter() const override; + bool setContainsArbiter() const override; - virtual void attemptToAdvanceStableTimestamp() override; + void attemptToAdvanceStableTimestamp() override; - virtual void finishRecoveryIfEligible(OperationContext* opCtx) override; + void finishRecoveryIfEligible(OperationContext* opCtx) override; - virtual void updateAndLogStateTransitionMetrics( + void updateAndLogStateTransitionMetrics( ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, size_t numOpsKilled, size_t numOpsRunning) const override; virtual void setCanAcceptNonLocalWrites(bool canAcceptNonLocalWrites); - virtual TopologyVersion getTopologyVersion() const; + TopologyVersion getTopologyVersion() const override; - virtual void incrementTopologyVersion() override; + void incrementTopologyVersion() override; - virtual std::shared_ptr awaitHelloResponse( + std::shared_ptr awaitHelloResponse( OperationContext* opCtx, const SplitHorizon::Parameters& horizonParams, boost::optional clientTopologyVersion, boost::optional deadline) override; - virtual SharedSemiFuture> getHelloResponseFuture( + SharedSemiFuture> getHelloResponseFuture( const SplitHorizon::Parameters& horizonParams, boost::optional clientTopologyVersion) override; - virtual StatusWith getLatestWriteOpTime( - OperationContext* opCtx) const noexcept override; + StatusWith getLatestWriteOpTime(OperationContext* opCtx) const noexcept override; - virtual HostAndPort getCurrentPrimaryHostAndPort() const override; + HostAndPort getCurrentPrimaryHostAndPort() const override; void cancelCbkHandle(executor::TaskExecutor::CallbackHandle activeHandle) override; BSONObj runCmdOnPrimaryAndAwaitResponse(OperationContext* opCtx, @@ -464,26 +466,26 @@ public: const BSONObj& cmdObj, OnRemoteCmdScheduledFn onRemoteCmdScheduled, OnRemoteCmdCompleteFn onRemoteCmdComplete) override; - virtual void restartScheduledHeartbeats_forTest() override; + void restartScheduledHeartbeats_forTest() override; - virtual void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; + void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; class WriteConcernTagChangesMock : public WriteConcernTagChanges { - virtual ~WriteConcernTagChangesMock() = default; - virtual bool reserveDefaultWriteConcernChange() { + ~WriteConcernTagChangesMock() override = default; + bool reserveDefaultWriteConcernChange() override { return false; }; - virtual void releaseDefaultWriteConcernChange() {} + void releaseDefaultWriteConcernChange() override {} - virtual bool reserveConfigWriteConcernTagChange() { + bool reserveConfigWriteConcernTagChange() override { return false; }; - virtual void releaseConfigWriteConcernTagChange() {} + void releaseConfigWriteConcernTagChange() override {} }; - virtual WriteConcernTagChanges* getWriteConcernTagChanges() override; + WriteConcernTagChanges* getWriteConcernTagChanges() override; - virtual SplitPrepareSessionManager* getSplitPrepareSessionManager() override; + SplitPrepareSessionManager* getSplitPrepareSessionManager() override; /** * If this is true, the mock will update the "committed snapshot" everytime the "last applied" diff --git a/src/mongo/db/repl/replication_coordinator_noop.h b/src/mongo/db/repl/replication_coordinator_noop.h index b4aa04fa3ba..98c97270df3 100644 --- a/src/mongo/db/repl/replication_coordinator_noop.h +++ b/src/mongo/db/repl/replication_coordinator_noop.h @@ -81,7 +81,7 @@ class ReplicationCoordinatorNoOp final : public ReplicationCoordinator { public: ReplicationCoordinatorNoOp(ServiceContext* serviceContext); - ~ReplicationCoordinatorNoOp() = default; + ~ReplicationCoordinatorNoOp() override = default; ReplicationCoordinatorNoOp(ReplicationCoordinatorNoOp&) = delete; ReplicationCoordinatorNoOp& operator=(ReplicationCoordinatorNoOp&) = delete; @@ -333,7 +333,7 @@ public: void appendConnectionStats(executor::ConnectionPoolStats* stats) const final; - virtual void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) final; + void createWMajorityWriteAvailabilityDateWaiter(OpTime opTime) final; Status stepUpIfEligible(bool skipDryRun) final; @@ -380,28 +380,28 @@ public: OnRemoteCmdScheduledFn onRemoteCmdScheduled, OnRemoteCmdCompleteFn onRemoteCmdComplete) override; - virtual void restartScheduledHeartbeats_forTest() final; + void restartScheduledHeartbeats_forTest() final; - virtual void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; + void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; class WriteConcernTagChangesNoOp : public WriteConcernTagChanges { - virtual ~WriteConcernTagChangesNoOp() = default; - virtual bool reserveDefaultWriteConcernChange() { + ~WriteConcernTagChangesNoOp() override = default; + bool reserveDefaultWriteConcernChange() override { return false; }; - virtual void releaseDefaultWriteConcernChange() {} + void releaseDefaultWriteConcernChange() override {} - virtual bool reserveConfigWriteConcernTagChange() { + bool reserveConfigWriteConcernTagChange() override { return false; }; - virtual void releaseConfigWriteConcernTagChange() {} + void releaseConfigWriteConcernTagChange() override {} }; - virtual WriteConcernTagChanges* getWriteConcernTagChanges() override; + WriteConcernTagChanges* getWriteConcernTagChanges() override; - virtual SplitPrepareSessionManager* getSplitPrepareSessionManager() override; + SplitPrepareSessionManager* getSplitPrepareSessionManager() override; - virtual bool isRetryableWrite(OperationContext* opCtx) const override; + bool isRetryableWrite(OperationContext* opCtx) const override; boost::optional getInitialSyncId(OperationContext* opCtx) override; diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.h b/src/mongo/db/repl/replication_coordinator_test_fixture.h index 1f06532c6c7..0f0fd85e155 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.h +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.h @@ -111,7 +111,7 @@ public: protected: explicit ReplCoordTest(Options options = Options{}.useMockClock(true)); - virtual ~ReplCoordTest(); + ~ReplCoordTest() override; /** * Asserts that calling start(configDoc, selfHost) successfully initiates the diff --git a/src/mongo/db/repl/replication_recovery_test.cpp b/src/mongo/db/repl/replication_recovery_test.cpp index 232b72ca704..f61c73bccd7 100644 --- a/src/mongo/db/repl/replication_recovery_test.cpp +++ b/src/mongo/db/repl/replication_recovery_test.cpp @@ -163,7 +163,7 @@ public: _initialDataTimestamp = snapshotName; } - Timestamp getInitialDataTimestamp(ServiceContext* serviceCtx) const { + Timestamp getInitialDataTimestamp(ServiceContext* serviceCtx) const override { stdx::lock_guard lock(_mutex); return _initialDataTimestamp; }; diff --git a/src/mongo/db/repl/reporter_test.cpp b/src/mongo/db/repl/reporter_test.cpp index f15f60fd3eb..c6b52d136c5 100644 --- a/src/mongo/db/repl/reporter_test.cpp +++ b/src/mongo/db/repl/reporter_test.cpp @@ -155,7 +155,7 @@ protected: class ReporterTestNoTriggerAtSetUp : public ReporterTest { private: - virtual bool triggerAtSetUp() const override; + bool triggerAtSetUp() const override; }; ReporterTest::ReporterTest() {} @@ -587,8 +587,8 @@ TEST_F(ReporterTestNoTriggerAtSetUp, public: TaskExecutorWithFailureInScheduleWork(executor::TaskExecutor* executor) : unittest::TaskExecutorProxy(executor) {} - virtual StatusWith scheduleWork( - CallbackFn&& override) { + StatusWith scheduleWork( + CallbackFn&& override) override { return Status(ErrorCodes::OperationFailed, "failed to schedule work"); } }; @@ -610,7 +610,7 @@ TEST_F(ReporterTestNoTriggerAtSetUp, FailingToScheduleRemoteCommandTaskShouldMak public: TaskExecutorWithFailureInScheduleRemoteCommand(executor::TaskExecutor* executor) : unittest::TaskExecutorProxy(executor) {} - virtual StatusWith scheduleRemoteCommandOnAny( + StatusWith scheduleRemoteCommandOnAny( const executor::RemoteCommandRequestOnAny& request, const RemoteCommandOnAnyCallbackFn& cb, const BatonHandle& baton = nullptr) override { @@ -639,8 +639,8 @@ TEST_F(ReporterTest, FailingToScheduleTimeoutShouldMakeReporterInactive) { public: TaskExecutorWithFailureInScheduleWorkAt(executor::TaskExecutor* executor) : unittest::TaskExecutorProxy(executor) {} - virtual StatusWith scheduleWorkAt( - Date_t when, CallbackFn&&) override { + StatusWith scheduleWorkAt(Date_t when, + CallbackFn&&) override { return Status(ErrorCodes::OperationFailed, "failed to schedule work"); } }; diff --git a/src/mongo/db/repl/rollback_impl.h b/src/mongo/db/repl/rollback_impl.h index c84215002e1..0d771861537 100644 --- a/src/mongo/db/repl/rollback_impl.h +++ b/src/mongo/db/repl/rollback_impl.h @@ -268,7 +268,7 @@ public: ReplicationProcess* replicationProcess, ReplicationCoordinator* replicationCoordinator); - virtual ~RollbackImpl(); + ~RollbackImpl() override; /** * Runs the rollback algorithm. diff --git a/src/mongo/db/repl/rollback_test_fixture.h b/src/mongo/db/repl/rollback_test_fixture.h index d8b509d83d7..e54b4cdca2d 100644 --- a/src/mongo/db/repl/rollback_test_fixture.h +++ b/src/mongo/db/repl/rollback_test_fixture.h @@ -225,7 +225,7 @@ public: */ Status setCollectionCount(OperationContext* opCtx, const NamespaceStringOrUUID& nsOrUUID, - long long newCount) { + long long newCount) override { stdx::lock_guard lock(_mutex); if (_setCollectionCountStatus && _setCollectionCountStatusUUID && nsOrUUID.uuid() == _setCollectionCountStatusUUID) { diff --git a/src/mongo/db/repl/scatter_gather_test.cpp b/src/mongo/db/repl/scatter_gather_test.cpp index 79bb2c113a7..a77394e5db4 100644 --- a/src/mongo/db/repl/scatter_gather_test.cpp +++ b/src/mongo/db/repl/scatter_gather_test.cpp @@ -97,7 +97,7 @@ public: _done.store(true); } - virtual bool hasReceivedSufficientResponses() const { + bool hasReceivedSufficientResponses() const override { if (_done.load()) { return _done.load(); } @@ -121,7 +121,7 @@ private: class ScatterGatherTest : public executor::ThreadPoolExecutorTest { protected: int64_t countLogLinesContaining(const std::string& needle); - void setUp() { + void setUp() override { executor::ThreadPoolExecutorTest::setUp(); launchExecutorThread(); } diff --git a/src/mongo/db/repl/shard_merge_recipient_op_observer.h b/src/mongo/db/repl/shard_merge_recipient_op_observer.h index d11c656ed84..88d51c48559 100644 --- a/src/mongo/db/repl/shard_merge_recipient_op_observer.h +++ b/src/mongo/db/repl/shard_merge_recipient_op_observer.h @@ -55,7 +55,7 @@ class ShardMergeRecipientOpObserver final : public OpObserverNoop { public: ShardMergeRecipientOpObserver() = default; - ~ShardMergeRecipientOpObserver() = default; + ~ShardMergeRecipientOpObserver() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfig, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/repl/shard_merge_recipient_op_observer_test.cpp b/src/mongo/db/repl/shard_merge_recipient_op_observer_test.cpp index bbcab48be7a..65016ceeed4 100644 --- a/src/mongo/db/repl/shard_merge_recipient_op_observer_test.cpp +++ b/src/mongo/db/repl/shard_merge_recipient_op_observer_test.cpp @@ -80,7 +80,7 @@ public: return static_cast(AutoGetCollectionForRead(opCtx, nss).getCollection()); } - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); auto serviceContext = getServiceContext(); @@ -100,7 +100,7 @@ public: CreateCommand(NamespaceString::kShardMergeRecipientsNamespace))); } - void tearDown() { + void tearDown() override { TenantMigrationAccessBlockerRegistry::get(getServiceContext()).shutDown(); } diff --git a/src/mongo/db/repl/shard_merge_recipient_service.cpp b/src/mongo/db/repl/shard_merge_recipient_service.cpp index eeedf6800e6..615aa554b7f 100644 --- a/src/mongo/db/repl/shard_merge_recipient_service.cpp +++ b/src/mongo/db/repl/shard_merge_recipient_service.cpp @@ -217,7 +217,7 @@ bool isRetriableOplogFetcherError(Status oplogFetcherStatus) { class OplogFetcherRestartDecisionTenantMigration : public OplogFetcher::OplogFetcherRestartDecision { public: - ~OplogFetcherRestartDecisionTenantMigration(){}; + ~OplogFetcherRestartDecisionTenantMigration() override{}; bool shouldContinue(OplogFetcher* fetcher, Status status) final { return false; } @@ -277,7 +277,7 @@ public: MONGO_UNREACHABLE; }; - virtual StatusWith getCurrentConfig() const final { + StatusWith getCurrentConfig() const final { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/repl/shard_merge_recipient_service.h b/src/mongo/db/repl/shard_merge_recipient_service.h index 4a325a349bb..2aa378efd9e 100644 --- a/src/mongo/db/repl/shard_merge_recipient_service.h +++ b/src/mongo/db/repl/shard_merge_recipient_service.h @@ -105,7 +105,7 @@ public: static constexpr StringData kShardMergeRecipientServiceName = "ShardMergeRecipientService"_sd; explicit ShardMergeRecipientService(ServiceContext* serviceContext); - ~ShardMergeRecipientService() = default; + ~ShardMergeRecipientService() override = default; StringData getServiceName() const final; diff --git a/src/mongo/db/repl/shard_merge_recipient_service_test.cpp b/src/mongo/db/repl/shard_merge_recipient_service_test.cpp index 01bfa7c34b0..e649a84f1fb 100644 --- a/src/mongo/db/repl/shard_merge_recipient_service_test.cpp +++ b/src/mongo/db/repl/shard_merge_recipient_service_test.cpp @@ -639,7 +639,7 @@ private: */ class ShardMergeRecipientServiceTestInsert : public ShardMergeRecipientServiceTest { private: - void addOpObserver(OpObserverRegistry* opObserverRegistry) { + void addOpObserver(OpObserverRegistry* opObserverRegistry) override { opObserverRegistry->addObserver(std::make_unique()); } diff --git a/src/mongo/db/repl/storage_interface_mock.h b/src/mongo/db/repl/storage_interface_mock.h index 2bb0809c8bf..dcb6c82e27b 100644 --- a/src/mongo/db/repl/storage_interface_mock.h +++ b/src/mongo/db/repl/storage_interface_mock.h @@ -78,7 +78,7 @@ class CollectionBulkLoaderMock : public CollectionBulkLoader { public: explicit CollectionBulkLoaderMock(std::shared_ptr collStats) : stats(std::move(collStats)){}; - virtual ~CollectionBulkLoaderMock() = default; + ~CollectionBulkLoaderMock() override = default; Status init(const std::vector& secondaryIndexSpecs) override; Status insertDocuments(std::vector::const_iterator begin, diff --git a/src/mongo/db/repl/storage_timestamp_test.cpp b/src/mongo/db/repl/storage_timestamp_test.cpp index 6526579b07e..c5daa4be7cb 100644 --- a/src/mongo/db/repl/storage_timestamp_test.cpp +++ b/src/mongo/db/repl/storage_timestamp_test.cpp @@ -1854,7 +1854,7 @@ TEST_F(StorageTimestampTest, SetMinValidAppliedThrough) { */ class KVDropDatabase : public StorageTimestampTest { private: - void _doTest() { + void _doTest() override { // Not actually called. } @@ -1985,7 +1985,7 @@ TEST(StorageTimestampTest, KVDropDatabasePrimary) { */ class TimestampIndexBuilds : public StorageTimestampTest { private: - void _doTest() { + void _doTest() override { // Not actually called. } diff --git a/src/mongo/db/repl/sync_source_selector_mock.h b/src/mongo/db/repl/sync_source_selector_mock.h index 2f33176926c..18ea47a75b3 100644 --- a/src/mongo/db/repl/sync_source_selector_mock.h +++ b/src/mongo/db/repl/sync_source_selector_mock.h @@ -52,7 +52,7 @@ public: using ChooseNewSyncSourceHook = std::function; SyncSourceSelectorMock(); - virtual ~SyncSourceSelectorMock(); + ~SyncSourceSelectorMock() override; void clearSyncSourceDenylist() override; HostAndPort chooseNewSyncSource(const OpTime& ot) override; diff --git a/src/mongo/db/repl/tenant_all_database_cloner.h b/src/mongo/db/repl/tenant_all_database_cloner.h index bdbdfeeb9e7..e1623e71db5 100644 --- a/src/mongo/db/repl/tenant_all_database_cloner.h +++ b/src/mongo/db/repl/tenant_all_database_cloner.h @@ -76,7 +76,7 @@ public: ThreadPool* dbPool, StringData tenantId); - virtual ~TenantAllDatabaseCloner() = default; + ~TenantAllDatabaseCloner() override = default; Stats getStats() const; diff --git a/src/mongo/db/repl/tenant_base_cloner.h b/src/mongo/db/repl/tenant_base_cloner.h index 49f01372b05..68963116891 100644 --- a/src/mongo/db/repl/tenant_base_cloner.h +++ b/src/mongo/db/repl/tenant_base_cloner.h @@ -50,7 +50,7 @@ public: DBClientConnection* client, StorageInterface* storageInterface, ThreadPool* dbPool); - virtual ~TenantBaseCloner() = default; + ~TenantBaseCloner() override = default; protected: TenantMigrationSharedData* getSharedData() const override { @@ -61,7 +61,7 @@ private: /** * Overriden to allow the BaseCloner to use the tenant migration log component. */ - virtual logv2::LogComponent getLogComponent() final; + logv2::LogComponent getLogComponent() final; }; } // namespace repl diff --git a/src/mongo/db/repl/tenant_collection_cloner.h b/src/mongo/db/repl/tenant_collection_cloner.h index 95ada9962aa..1eb9f325e5e 100644 --- a/src/mongo/db/repl/tenant_collection_cloner.h +++ b/src/mongo/db/repl/tenant_collection_cloner.h @@ -93,7 +93,7 @@ public: ThreadPool* dbPool, StringData tenantId); - virtual ~TenantCollectionCloner() = default; + ~TenantCollectionCloner() override = default; Stats getStats() const; diff --git a/src/mongo/db/repl/tenant_database_cloner.h b/src/mongo/db/repl/tenant_database_cloner.h index 5db0e471c20..b93d4646874 100644 --- a/src/mongo/db/repl/tenant_database_cloner.h +++ b/src/mongo/db/repl/tenant_database_cloner.h @@ -81,7 +81,7 @@ public: ThreadPool* dbPool, StringData tenantId); - virtual ~TenantDatabaseCloner() = default; + ~TenantDatabaseCloner() override = default; Stats getStats() const; diff --git a/src/mongo/db/repl/tenant_file_cloner.h b/src/mongo/db/repl/tenant_file_cloner.h index 7434462a800..ec83b725b95 100644 --- a/src/mongo/db/repl/tenant_file_cloner.h +++ b/src/mongo/db/repl/tenant_file_cloner.h @@ -110,7 +110,7 @@ public: StorageInterface* storageInterface, ThreadPool* dbPool); - virtual ~TenantFileCloner() = default; + ~TenantFileCloner() override = default; /** * Waits for any file system work to finish or fail. diff --git a/src/mongo/db/repl/tenant_file_importer_service.h b/src/mongo/db/repl/tenant_file_importer_service.h index f78f5b548b0..5b327463e25 100644 --- a/src/mongo/db/repl/tenant_file_importer_service.h +++ b/src/mongo/db/repl/tenant_file_importer_service.h @@ -158,9 +158,9 @@ public: BSONObj getStats(boost::optional migrationId = boost::none); void getStats(BSONObjBuilder& bob, boost::optional migrationId = boost::none); - void onInitialDataAvailable(OperationContext*, bool) override final {} + void onInitialDataAvailable(OperationContext*, bool) final {} - void onShutdown() override final { + void onShutdown() final { { stdx::lock_guard lk(_mutex); // Prevents a new migration from starting up during or after shutdown. @@ -170,24 +170,24 @@ public: _resetMigrationHandle(); } - void onRollback() override final { + void onRollback() final { interruptAll(); _resetMigrationHandle(); } - void onStartup(OperationContext*) override final {} + void onStartup(OperationContext*) final {} - void onSetCurrentConfig(OperationContext* opCtx) override final {} + void onSetCurrentConfig(OperationContext* opCtx) final {} - void onStepUpBegin(OperationContext*, long long) override final {} + void onStepUpBegin(OperationContext*, long long) final {} - void onStepUpComplete(OperationContext*, long long) override final {} + void onStepUpComplete(OperationContext*, long long) final {} - void onStepDown() override final {} + void onStepDown() final {} - void onBecomeArbiter() override final {} + void onBecomeArbiter() final {} - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "TenantFileImporterService"; } diff --git a/src/mongo/db/repl/tenant_migration_access_blocker_registry_test.cpp b/src/mongo/db/repl/tenant_migration_access_blocker_registry_test.cpp index 5d2319289e5..241b71412d6 100644 --- a/src/mongo/db/repl/tenant_migration_access_blocker_registry_test.cpp +++ b/src/mongo/db/repl/tenant_migration_access_blocker_registry_test.cpp @@ -52,12 +52,12 @@ namespace mongo { class TenantMigrationAccessBlockerRegistryTest : public ServiceContextTest { public: - void setUp() { + void setUp() override { _opCtx = makeOperationContext(); TenantMigrationAccessBlockerRegistry::get(getServiceContext()).startup(); } - void tearDown() { + void tearDown() override { TenantMigrationAccessBlockerRegistry::get(getServiceContext()).shutDown(); } diff --git a/src/mongo/db/repl/tenant_migration_access_blocker_util_test.cpp b/src/mongo/db/repl/tenant_migration_access_blocker_util_test.cpp index bdbccec810a..890beb74579 100644 --- a/src/mongo/db/repl/tenant_migration_access_blocker_util_test.cpp +++ b/src/mongo/db/repl/tenant_migration_access_blocker_util_test.cpp @@ -85,7 +85,7 @@ public: const DatabaseName kTenantDB = DatabaseName::createDatabaseName_forTest(boost::none, kTenantId.toString() + "_ db"); - void setUp() { + void setUp() override { _opCtx = makeOperationContext(); auto service = getServiceContext(); @@ -95,7 +95,7 @@ public: TenantMigrationAccessBlockerRegistry::get(getServiceContext()).startup(); } - void tearDown() { + void tearDown() override { TenantMigrationAccessBlockerRegistry::get(getServiceContext()).shutDown(); } @@ -307,7 +307,7 @@ TEST_F(TenantMigrationAccessBlockerUtilTest, TestValidateNssBeingMigrated) { class RecoverAccessBlockerTest : public ServiceContextMongoDTest { public: - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); auto serviceContext = getServiceContext(); @@ -326,7 +326,7 @@ public: repl::createOplog(_opCtx.get()); } - void tearDown() { + void tearDown() override { TenantMigrationAccessBlockerRegistry::get(getServiceContext()).shutDown(); } diff --git a/src/mongo/db/repl/tenant_migration_donor_op_observer.h b/src/mongo/db/repl/tenant_migration_donor_op_observer.h index 7234ff5eb53..0d3a0cd34ea 100644 --- a/src/mongo/db/repl/tenant_migration_donor_op_observer.h +++ b/src/mongo/db/repl/tenant_migration_donor_op_observer.h @@ -56,7 +56,7 @@ class TenantMigrationDonorOpObserver final : public OpObserverNoop { public: TenantMigrationDonorOpObserver() = default; - ~TenantMigrationDonorOpObserver() = default; + ~TenantMigrationDonorOpObserver() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfig, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/repl/tenant_migration_donor_service.cpp b/src/mongo/db/repl/tenant_migration_donor_service.cpp index 8fcad757760..42573d67031 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.cpp +++ b/src/mongo/db/repl/tenant_migration_donor_service.cpp @@ -195,7 +195,7 @@ public: : RetryWithBackoffOnErrorCategories(b), _protocol{p} {} /** Returns true if we should retry sending SyncData given the error */ - bool recordAndEvaluateRetry(Status status) { + bool recordAndEvaluateRetry(Status status) override { if (_protocol == MigrationProtocolEnum::kShardMerge || status.isOK()) { return false; } diff --git a/src/mongo/db/repl/tenant_migration_donor_service.h b/src/mongo/db/repl/tenant_migration_donor_service.h index 90d947338b4..35d1b2b7d85 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.h +++ b/src/mongo/db/repl/tenant_migration_donor_service.h @@ -76,7 +76,7 @@ public: explicit TenantMigrationDonorService(ServiceContext* const serviceContext) : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {} - ~TenantMigrationDonorService() = default; + ~TenantMigrationDonorService() override = default; StringData getServiceName() const override { return kServiceName; @@ -118,7 +118,7 @@ public: const TenantMigrationDonorService* donorService, const BSONObj& initialState); - ~Instance(); + ~Instance() override; SemiFuture run(std::shared_ptr executor, const CancellationToken& token) noexcept override; diff --git a/src/mongo/db/repl/tenant_migration_recipient_op_observer.h b/src/mongo/db/repl/tenant_migration_recipient_op_observer.h index 3046721b85e..a09c37ea10d 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_op_observer.h +++ b/src/mongo/db/repl/tenant_migration_recipient_op_observer.h @@ -56,7 +56,7 @@ class TenantMigrationRecipientOpObserver final : public OpObserverNoop { public: TenantMigrationRecipientOpObserver() = default; - ~TenantMigrationRecipientOpObserver() = default; + ~TenantMigrationRecipientOpObserver() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfig, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.cpp b/src/mongo/db/repl/tenant_migration_recipient_service.cpp index 71335c403bc..daf0eff09df 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_service.cpp +++ b/src/mongo/db/repl/tenant_migration_recipient_service.cpp @@ -232,7 +232,7 @@ namespace { class OplogFetcherRestartDecisionTenantMigration : public OplogFetcher::OplogFetcherRestartDecision { public: - ~OplogFetcherRestartDecisionTenantMigration(){}; + ~OplogFetcherRestartDecisionTenantMigration() override{}; bool shouldContinue(OplogFetcher* fetcher, Status status) final { return false; } @@ -292,7 +292,7 @@ public: MONGO_UNREACHABLE; }; - virtual StatusWith getCurrentConfig() const final { + StatusWith getCurrentConfig() const final { MONGO_UNREACHABLE; } diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.h b/src/mongo/db/repl/tenant_migration_recipient_service.h index 0ee0583e8af..1b17402561b 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_service.h +++ b/src/mongo/db/repl/tenant_migration_recipient_service.h @@ -103,7 +103,7 @@ public: static constexpr StringData kNoopMsg = "Resume token noop"_sd; explicit TenantMigrationRecipientService(ServiceContext* serviceContext); - ~TenantMigrationRecipientService() = default; + ~TenantMigrationRecipientService() override = default; StringData getServiceName() const final; diff --git a/src/mongo/db/repl/tenant_oplog_applier.h b/src/mongo/db/repl/tenant_oplog_applier.h index 70350637caa..5408d4098ae 100644 --- a/src/mongo/db/repl/tenant_oplog_applier.h +++ b/src/mongo/db/repl/tenant_oplog_applier.h @@ -129,7 +129,7 @@ public: ThreadPool* writerPool, Timestamp resumeBatchingTs = Timestamp()); - virtual ~TenantOplogApplier(); + ~TenantOplogApplier() override; /** * Return a future which will be notified when that optime has been reached. Future will diff --git a/src/mongo/db/repl/tenant_oplog_batcher.h b/src/mongo/db/repl/tenant_oplog_batcher.h index b7cf06bbeb7..03915efa30c 100644 --- a/src/mongo/db/repl/tenant_oplog_batcher.h +++ b/src/mongo/db/repl/tenant_oplog_batcher.h @@ -94,7 +94,7 @@ public: Timestamp resumeBatchingTs, OpTime beginApplyingAfterOpTime); - virtual ~TenantOplogBatcher(); + ~TenantOplogBatcher() override; /** * Returns a future for the next oplog batch. Client must not ask for another batch until diff --git a/src/mongo/db/repl/topology_coordinator_v1_test.cpp b/src/mongo/db/repl/topology_coordinator_v1_test.cpp index 15a9262c73d..bbf55a91623 100644 --- a/src/mongo/db/repl/topology_coordinator_v1_test.cpp +++ b/src/mongo/db/repl/topology_coordinator_v1_test.cpp @@ -124,7 +124,7 @@ bool stringContains(const std::string& haystack, const std::string& needle) { class TopoCoordTest : public mongo::unittest::Test { public: - virtual void setUp() { + void setUp() override { _options = TopologyCoordinator::Options{}; _options.maxSyncSourceLagSecs = Seconds{100}; _topo = std::make_unique(_options); @@ -139,7 +139,7 @@ public: changeSyncSourceThresholdMillis.store(0LL); } - virtual void tearDown() { + void tearDown() override { _topo = nullptr; _cbData = nullptr; } @@ -2437,7 +2437,7 @@ TEST_F(TopoCoordTest, ChangedTooOftenRecentlyReturnsFalseWhenNotFilled) { class PrepareHeartbeatResponseV1Test : public TopoCoordTest { public: - virtual void setUp() { + void setUp() override { TopoCoordTest::setUp(); updateConfig(BSON("_id" << "rs0" @@ -3919,7 +3919,7 @@ TEST_F(TopoCoordTest, NodeBecomesSecondaryAsNormalWhenReadCommittedSupportedAndC class HeartbeatResponseTestV1 : public TopoCoordTest { public: - virtual void setUp() { + void setUp() override { TopoCoordTest::setUp(); updateConfig(BSON("_id" << "rs0" @@ -4665,7 +4665,7 @@ TEST_F(HeartbeatResponseTestV1, class ReevalSyncSourceTest : public TopoCoordTest { public: - virtual void setUp() { + void setUp() override { TopoCoordTest::setUp(); updateConfig(BSON("_id" << "rs0" @@ -5212,7 +5212,7 @@ DEATH_TEST_F(ReevalSyncSourceTest, CrashOnSyncSourceParameterIsSelf, "7785601") class HeartbeatResponseReconfigTestV1 : public TopoCoordTest { public: - virtual void setUp() { + void setUp() override { TopoCoordTest::setUp(); updateConfig(makeRSConfigWithVersionAndTerm(initConfigVersion, initConfigTerm), 0); setSelfMemberState(MemberState::RS_SECONDARY); @@ -8028,7 +8028,7 @@ TEST_F(HeartbeatResponseTestV1, ShouldNotChangeSyncSourceIfSyncSourceHasDifferen class HeartbeatResponseTestOneRetryV1 : public HeartbeatResponseTestV1 { public: - virtual void setUp() { + void setUp() override { HeartbeatResponseTestV1::setUp(); // Bring up the node we are heartbeating. @@ -8127,7 +8127,7 @@ TEST_F(HeartbeatResponseTestOneRetryV1, class HeartbeatResponseTestTwoRetriesV1 : public HeartbeatResponseTestOneRetryV1 { public: - virtual void setUp() { + void setUp() override { HeartbeatResponseTestOneRetryV1::setUp(); // First retry fails at t + 4500ms HeartbeatResponseAction action = getTopoCoord().processHeartbeatResponse( diff --git a/src/mongo/db/repl/topology_version_observer_test.cpp b/src/mongo/db/repl/topology_version_observer_test.cpp index 1c7f0f0800d..16b0223da45 100644 --- a/src/mongo/db/repl/topology_version_observer_test.cpp +++ b/src/mongo/db/repl/topology_version_observer_test.cpp @@ -86,7 +86,7 @@ protected: } public: - virtual void setUp() { + void setUp() override { auto configObj = getConfigObj(); assertStartSuccess(configObj, HostAndPort("node1", 12345)); ReplSetConfig config = assertMakeRSConfig(configObj); @@ -107,7 +107,7 @@ public: observer->init(serviceContext, replCoord); } - virtual void tearDown() { + void tearDown() override { observer->shutdown(); ASSERT(observer->isShutdown()); observer.reset(); diff --git a/src/mongo/db/repl/vote_requester.h b/src/mongo/db/repl/vote_requester.h index a7983470201..316ed52cde2 100644 --- a/src/mongo/db/repl/vote_requester.h +++ b/src/mongo/db/repl/vote_requester.h @@ -74,11 +74,11 @@ public: OpTime lastWrittenOpTime, OpTime lastAppliedOpTime, int primaryIndex); - virtual ~Algorithm(); - virtual std::vector getRequests() const; - virtual void processResponse(const executor::RemoteCommandRequest& request, - const executor::RemoteCommandResponse& response); - virtual bool hasReceivedSufficientResponses() const; + ~Algorithm() override; + std::vector getRequests() const override; + void processResponse(const executor::RemoteCommandRequest& request, + const executor::RemoteCommandResponse& response) override; + bool hasReceivedSufficientResponses() const override; /** * Returns a VoteRequest::Result indicating the result of the election. diff --git a/src/mongo/db/repl/vote_requester_test.cpp b/src/mongo/db/repl/vote_requester_test.cpp index 7fd5a99bb4e..1d98fb2d7b6 100644 --- a/src/mongo/db/repl/vote_requester_test.cpp +++ b/src/mongo/db/repl/vote_requester_test.cpp @@ -94,7 +94,7 @@ TEST(ReplSetRequestVotes, ResponseAcceptsUnknownField) { class VoteRequesterTest : public mongo::unittest::Test { public: - virtual void setUp() { + void setUp() override { ReplSetConfig config( ReplSetConfig::parse(BSON("_id" << "rs0" @@ -126,7 +126,7 @@ public: -1)); } - virtual void tearDown() { + void tearDown() override { _requester.reset(nullptr); } @@ -243,7 +243,7 @@ protected: class VoteRequesterDryRunTest : public VoteRequesterTest { public: - virtual void setUp() { + void setUp() override { ReplSetConfig config( ReplSetConfig::parse(BSON("_id" << "rs0" @@ -278,7 +278,7 @@ public: class VoteRequesterCatchupTakeoverDryRunTest : public VoteRequesterTest { public: - virtual void setUp() { + void setUp() override { ReplSetConfig config( ReplSetConfig::parse(BSON("_id" << "rs0" diff --git a/src/mongo/db/replica_set_endpoint_util_test.cpp b/src/mongo/db/replica_set_endpoint_util_test.cpp index c1ede8fdf56..df7a4ca48f4 100644 --- a/src/mongo/db/replica_set_endpoint_util_test.cpp +++ b/src/mongo/db/replica_set_endpoint_util_test.cpp @@ -65,7 +65,7 @@ protected: explicit ReplicaSetEndpointUtilTest(Options options = {}) : ServiceContextMongoDTest(options.useReplSettings(true)) {} - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); // The requirements for a mongod to be a replica set endpoint. diff --git a/src/mongo/db/s/auto_split_vector_test.cpp b/src/mongo/db/s/auto_split_vector_test.cpp index 690bead11ad..b24fb3bf379 100644 --- a/src/mongo/db/s/auto_split_vector_test.cpp +++ b/src/mongo/db/s/auto_split_vector_test.cpp @@ -84,7 +84,7 @@ public: * Before each test case: * - Creates a sharded collection with shard key `_id` */ - void setUp() { + void setUp() override { ShardServerTestFixture::setUp(); auto opCtx = operationContext(); @@ -135,7 +135,7 @@ class AutoSplitVectorTest10MB : public AutoSplitVectorTest { * - Creates a sharded collection with shard key `_id` * - Inserts `10` documents of ~1MB size (shard keys [0...9]) */ - void setUp() { + void setUp() override { AutoSplitVectorTest::setUp(); auto opCtx = operationContext(); diff --git a/src/mongo/db/s/balancer/auto_merger_policy.h b/src/mongo/db/s/balancer/auto_merger_policy.h index 4dbfd323a75..4388e127e74 100644 --- a/src/mongo/db/s/balancer/auto_merger_policy.h +++ b/src/mongo/db/s/balancer/auto_merger_policy.h @@ -68,7 +68,7 @@ public: _firstAction(true), _withinRound(true) {} - ~AutoMergerPolicy() {} + ~AutoMergerPolicy() override {} /* * Enables/disables the AutoMerger. diff --git a/src/mongo/db/s/balancer/balancer.h b/src/mongo/db/s/balancer/balancer.h index b11ddff2082..fbdcd41010d 100644 --- a/src/mongo/db/s/balancer/balancer.h +++ b/src/mongo/db/s/balancer/balancer.h @@ -85,7 +85,7 @@ public: static Balancer* get(OperationContext* operationContext); Balancer(); - ~Balancer(); + ~Balancer() override; /** * Invoked when the config server primary enters the 'PRIMARY' state and is invoked while the @@ -205,7 +205,7 @@ private: void onStepUpComplete(OperationContext* opCtx, long long term) final; void onStepDown() final; void onBecomeArbiter() final; - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "Balancer"; } diff --git a/src/mongo/db/s/balancer/balancer_commands_scheduler_impl.h b/src/mongo/db/s/balancer/balancer_commands_scheduler_impl.h index ac17f1efc7e..5c23f17aebb 100644 --- a/src/mongo/db/s/balancer/balancer_commands_scheduler_impl.h +++ b/src/mongo/db/s/balancer/balancer_commands_scheduler_impl.h @@ -461,7 +461,7 @@ class BalancerCommandsSchedulerImpl : public BalancerCommandsScheduler { public: BalancerCommandsSchedulerImpl(); - ~BalancerCommandsSchedulerImpl(); + ~BalancerCommandsSchedulerImpl() override; void start(OperationContext* opCtx) override; diff --git a/src/mongo/db/s/balancer/balancer_defragmentation_policy.h b/src/mongo/db/s/balancer/balancer_defragmentation_policy.h index d85dab91409..35ba4fc4fed 100644 --- a/src/mongo/db/s/balancer/balancer_defragmentation_policy.h +++ b/src/mongo/db/s/balancer/balancer_defragmentation_policy.h @@ -101,7 +101,7 @@ public: const std::function& onStateUpdated) : _clusterStats(clusterStats), _onStateUpdated(onStateUpdated) {} - ~BalancerDefragmentationPolicy() {} + ~BalancerDefragmentationPolicy() override {} StringData getName() const override; diff --git a/src/mongo/db/s/balancer/cluster_statistics_impl.h b/src/mongo/db/s/balancer/cluster_statistics_impl.h index e35f19ca6a0..c605573a5ef 100644 --- a/src/mongo/db/s/balancer/cluster_statistics_impl.h +++ b/src/mongo/db/s/balancer/cluster_statistics_impl.h @@ -46,7 +46,7 @@ namespace mongo { */ class ClusterStatisticsImpl final : public ClusterStatistics { public: - ~ClusterStatisticsImpl(); + ~ClusterStatisticsImpl() override; StatusWith> getStats(OperationContext* opCtx) override; diff --git a/src/mongo/db/s/balancer/cluster_statistics_mock.h b/src/mongo/db/s/balancer/cluster_statistics_mock.h index 62da81db68a..c2f26f22a8d 100644 --- a/src/mongo/db/s/balancer/cluster_statistics_mock.h +++ b/src/mongo/db/s/balancer/cluster_statistics_mock.h @@ -41,7 +41,7 @@ class ClusterStatisticsMock final : public ClusterStatistics { public: ClusterStatisticsMock() {} - ~ClusterStatisticsMock() {} + ~ClusterStatisticsMock() override {} void setStats(std::vector&& clusterStats, std::map>&& collStats) { diff --git a/src/mongo/db/s/balancer/move_unsharded_policy.h b/src/mongo/db/s/balancer/move_unsharded_policy.h index f84eaa58e24..345ce72e4e0 100644 --- a/src/mongo/db/s/balancer/move_unsharded_policy.h +++ b/src/mongo/db/s/balancer/move_unsharded_policy.h @@ -41,7 +41,7 @@ class MoveUnshardedPolicy : public ActionsStreamPolicy { public: MoveUnshardedPolicy(); - virtual StringData getName() const { + StringData getName() const override { static StringData name("MoveUnshardedPolicy"); return name; }; diff --git a/src/mongo/db/s/balancer_stats_registry.h b/src/mongo/db/s/balancer_stats_registry.h index 242087f9978..4bb1e924421 100644 --- a/src/mongo/db/s/balancer_stats_registry.h +++ b/src/mongo/db/s/balancer_stats_registry.h @@ -94,18 +94,17 @@ public: const UUID& collectionUUID) const; private: - void onSetCurrentConfig(OperationContext* opCtx) override final {} - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final {} - void onBecomeArbiter() override final {} - void onShutdown() override final {} - void onRollback() override final {} + void onSetCurrentConfig(OperationContext* opCtx) final {} + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final {} + void onBecomeArbiter() final {} + void onShutdown() final {} + void onRollback() final {} - void onStartup(OperationContext* opCtx) override final; - void onStepUpComplete(OperationContext* opCtx, long long term) override final; - void onStepDown() override final; - inline std::string getServiceName() const override final { + void onStartup(OperationContext* opCtx) final; + void onStepUpComplete(OperationContext* opCtx, long long term) final; + void onStepDown() final; + inline std::string getServiceName() const final { return "BalancerStatsRegistry"; } diff --git a/src/mongo/db/s/clone_catalog_data_command.cpp b/src/mongo/db/s/clone_catalog_data_command.cpp index 4c867e9d5ca..413b5bc5635 100644 --- a/src/mongo/db/s/clone_catalog_data_command.cpp +++ b/src/mongo/db/s/clone_catalog_data_command.cpp @@ -118,15 +118,15 @@ public: return AllowedOnSecondary::kNever; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return true; } - virtual bool supportsRetryableWrite() const override { + bool supportsRetryableWrite() const override { return true; } diff --git a/src/mongo/db/s/config/config_server_test_fixture.h b/src/mongo/db/s/config/config_server_test_fixture.h index 70228560b49..d6326fd9db5 100644 --- a/src/mongo/db/s/config/config_server_test_fixture.h +++ b/src/mongo/db/s/config/config_server_test_fixture.h @@ -94,7 +94,7 @@ inline void assertBSONObjsSame(const std::vector& expectedBSON, class ConfigServerTestFixture : public ShardingMongoDTestFixture { protected: explicit ConfigServerTestFixture(Options options = {}, bool setUpMajorityReads = true); - ~ConfigServerTestFixture(); + ~ConfigServerTestFixture() override; void setUp() override; void tearDown() override; diff --git a/src/mongo/db/s/config/configsvr_coordinator.h b/src/mongo/db/s/config/configsvr_coordinator.h index 3c4d1bd187a..afba6c6010f 100644 --- a/src/mongo/db/s/config/configsvr_coordinator.h +++ b/src/mongo/db/s/config/configsvr_coordinator.h @@ -68,7 +68,7 @@ class ConfigsvrCoordinator : public repl::PrimaryOnlyService::TypedInstance getCompletionFuture() { return _completionPromise.getFuture(); @@ -86,14 +86,14 @@ protected: const ConfigsvrCoordinatorId _coordId; SemiFuture run(std::shared_ptr executor, - const CancellationToken& token) noexcept override final; + const CancellationToken& token) noexcept final; virtual ExecutorFuture _runImpl(std::shared_ptr executor, const CancellationToken& token) noexcept = 0; virtual const ConfigsvrCoordinatorMetadata& metadata() const = 0; - void interrupt(Status status) noexcept override final; + void interrupt(Status status) noexcept final; void _removeStateDocument(OperationContext* opCtx); @@ -110,7 +110,7 @@ public: : ConfigsvrCoordinator(stateDoc), _doc(StateDoc::parse(IDLParserContext("CoordinatorDocument"), stateDoc)) {} - ~ConfigsvrCoordinatorImpl() {} + ~ConfigsvrCoordinatorImpl() override {} protected: /** diff --git a/src/mongo/db/s/config/configsvr_coordinator_service.h b/src/mongo/db/s/config/configsvr_coordinator_service.h index f290887cca8..51458122457 100644 --- a/src/mongo/db/s/config/configsvr_coordinator_service.h +++ b/src/mongo/db/s/config/configsvr_coordinator_service.h @@ -52,7 +52,7 @@ public: explicit ConfigsvrCoordinatorService(ServiceContext* serviceContext) : PrimaryOnlyService(serviceContext) {} - ~ConfigsvrCoordinatorService() = default; + ~ConfigsvrCoordinatorService() override = default; static ConfigsvrCoordinatorService* getService(OperationContext* opCtx); diff --git a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp index 9e827489470..f4a5a101eaf 100644 --- a/src/mongo/db/s/config/configsvr_remove_shard_command.cpp +++ b/src/mongo/db/s/config/configsvr_remove_shard_command.cpp @@ -173,7 +173,7 @@ public: return true; } - void validateResult(const BSONObj& resultObj) override final {} + void validateResult(const BSONObj& resultObj) final {} }; MONGO_REGISTER_COMMAND(ConfigSvrRemoveShardCommand).forShard(); diff --git a/src/mongo/db/s/config/configsvr_run_restore_command.cpp b/src/mongo/db/s/config/configsvr_run_restore_command.cpp index 3b067a15cd9..5dd322367eb 100644 --- a/src/mongo/db/s/config/configsvr_run_restore_command.cpp +++ b/src/mongo/db/s/config/configsvr_run_restore_command.cpp @@ -193,7 +193,7 @@ public: return AllowedOnSecondary::kNever; } - bool adminOnly() const { + bool adminOnly() const override { return true; } diff --git a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp index 9adad5a3c5d..e083d0a4fb4 100644 --- a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp +++ b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp @@ -118,7 +118,7 @@ public: return Status::OK(); } - NamespaceString parseNs(const DatabaseName& dbName, const BSONObj& cmdObj) const { + NamespaceString parseNs(const DatabaseName& dbName, const BSONObj& cmdObj) const override { return NamespaceStringUtil::deserialize(dbName.tenantId(), CommandHelpers::parseNsFullyQualified(cmdObj), SerializationContext::stateDefault()); diff --git a/src/mongo/db/s/config/placement_history_cleaner.h b/src/mongo/db/s/config/placement_history_cleaner.h index 7ad1937eb42..86a155bc1c8 100644 --- a/src/mongo/db/s/config/placement_history_cleaner.h +++ b/src/mongo/db/s/config/placement_history_cleaner.h @@ -89,7 +89,7 @@ private: void onBecomeArbiter() final {} - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "PlacementHistoryCleaner"; } diff --git a/src/mongo/db/s/config/sharding_catalog_manager_bump_collection_version_and_change_metadata_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_bump_collection_version_and_change_metadata_test.cpp index 6b7d758d423..e2958acbb8f 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_bump_collection_version_and_change_metadata_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_bump_collection_version_and_change_metadata_test.cpp @@ -79,7 +79,7 @@ const ShardType kShard1("shard0001", "shard0001:1234"); class ShardingCatalogManagerBumpCollectionPlacementVersionAndChangeMetadataTest : public ConfigServerTestFixture { - void setUp() { + void setUp() override { ConfigServerTestFixture::setUp(); setupShards({kShard0, kShard1}); @@ -96,7 +96,7 @@ class ShardingCatalogManagerBumpCollectionPlacementVersionAndChangeMetadataTest ->onShardingInitialization(operationContext(), true); } - void tearDown() { + void tearDown() override { TransactionCoordinatorService::get(operationContext())->onStepDown(); ConfigServerTestFixture::tearDown(); } diff --git a/src/mongo/db/s/config_server_op_observer.h b/src/mongo/db/s/config_server_op_observer.h index ac0f4e79717..2d34fc4bf43 100644 --- a/src/mongo/db/s/config_server_op_observer.h +++ b/src/mongo/db/s/config_server_op_observer.h @@ -57,7 +57,7 @@ class ConfigServerOpObserver final : public OpObserverNoop { public: ConfigServerOpObserver(); - ~ConfigServerOpObserver(); + ~ConfigServerOpObserver() override; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfigAndSystem, NamespaceFilter::kConfigAndSystem}; diff --git a/src/mongo/db/s/create_collection_coordinator.h b/src/mongo/db/s/create_collection_coordinator.h index 1e737571e53..4c09c7ff766 100644 --- a/src/mongo/db/s/create_collection_coordinator.h +++ b/src/mongo/db/s/create_collection_coordinator.h @@ -127,7 +127,7 @@ public: << NamespaceStringUtil::serialize( originalNss(), SerializationContext::stateDefault()))) {} - ~CreateCollectionCoordinatorLegacy() = default; + ~CreateCollectionCoordinatorLegacy() override = default; void checkIfOptionsConflict(const BSONObj& coorDoc) const override; @@ -192,7 +192,7 @@ public: << NamespaceStringUtil::serialize( originalNss(), SerializationContext::stateDefault()))) {} - ~CreateCollectionCoordinator() = default; + ~CreateCollectionCoordinator() override = default; void checkIfOptionsConflict(const BSONObj& coorDoc) const override; diff --git a/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.h b/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.h index 3ef22cf4edf..81ad4414cd2 100644 --- a/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.h +++ b/src/mongo/db/s/document_source_analyze_shard_key_read_write_distribution.h @@ -97,7 +97,7 @@ public: return true; } - void assertSupportsMultiDocumentTransaction() const { + void assertSupportsMultiDocumentTransaction() const override { transactionNotSupported(kStageName); } @@ -110,7 +110,7 @@ public: DocumentSourceAnalyzeShardKeyReadWriteDistributionSpec spec) : DocumentSource(kStageName, pExpCtx), _spec(std::move(spec)) {} - virtual ~DocumentSourceAnalyzeShardKeyReadWriteDistribution() = default; + ~DocumentSourceAnalyzeShardKeyReadWriteDistribution() override = default; StageConstraints constraints( Pipeline::SplitState = Pipeline::SplitState::kUnsplit) const override { @@ -135,7 +135,7 @@ public: return kStageName.rawData(); } - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; void addVariableRefs(std::set* refs) const final {} diff --git a/src/mongo/db/s/drop_collection_coordinator.h b/src/mongo/db/s/drop_collection_coordinator.h index 254b91c9d09..f86b8ab8eda 100644 --- a/src/mongo/db/s/drop_collection_coordinator.h +++ b/src/mongo/db/s/drop_collection_coordinator.h @@ -69,7 +69,7 @@ public: << NamespaceStringUtil::serialize( originalNss(), SerializationContext::stateDefault()))) {} - ~DropCollectionCoordinator() = default; + ~DropCollectionCoordinator() override = default; void checkIfOptionsConflict(const BSONObj& doc) const final {} diff --git a/src/mongo/db/s/drop_database_coordinator.h b/src/mongo/db/s/drop_database_coordinator.h index 7a1c5623011..442c5ce9c99 100644 --- a/src/mongo/db/s/drop_database_coordinator.h +++ b/src/mongo/db/s/drop_database_coordinator.h @@ -65,7 +65,7 @@ public: _dbName(nss().dbName()), _critSecReason(BSON("dropDatabase" << DatabaseNameUtil::serialize( _dbName, SerializationContext::stateCommandRequest()))) {} - ~DropDatabaseCoordinator() = default; + ~DropDatabaseCoordinator() override = default; void checkIfOptionsConflict(const BSONObj& doc) const final {} diff --git a/src/mongo/db/s/flush_database_cache_updates_command.cpp b/src/mongo/db/s/flush_database_cache_updates_command.cpp index 09a40fe06e8..5219861d2c3 100644 --- a/src/mongo/db/s/flush_database_cache_updates_command.cpp +++ b/src/mongo/db/s/flush_database_cache_updates_command.cpp @@ -139,7 +139,7 @@ public: /** * ns() is the database to flush, with no collection. */ - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(_dbName()); } diff --git a/src/mongo/db/s/global_index/global_index_cumulative_metrics_field_name_provider.h b/src/mongo/db/s/global_index/global_index_cumulative_metrics_field_name_provider.h index a3c3d4de2b9..5ce7aba5626 100644 --- a/src/mongo/db/s/global_index/global_index_cumulative_metrics_field_name_provider.h +++ b/src/mongo/db/s/global_index/global_index_cumulative_metrics_field_name_provider.h @@ -38,8 +38,8 @@ namespace global_index { class GlobalIndexCumulativeMetricsFieldNameProvider : public ShardingDataTransformCumulativeMetricsFieldNameProvider { public: - virtual StringData getForDocumentsProcessed() const override; - virtual StringData getForBytesWritten() const override; + StringData getForDocumentsProcessed() const override; + StringData getForBytesWritten() const override; // TODO: Replace this placeholder method with one method per global index coordinator // role/state combination. See ReshardingCumulativeMetricsFieldNameProvider for an diff --git a/src/mongo/db/s/global_index/global_index_cumulative_metrics_test.cpp b/src/mongo/db/s/global_index/global_index_cumulative_metrics_test.cpp index 9e481a36f2b..3e7a0bbdc24 100644 --- a/src/mongo/db/s/global_index/global_index_cumulative_metrics_test.cpp +++ b/src/mongo/db/s/global_index/global_index_cumulative_metrics_test.cpp @@ -51,8 +51,7 @@ protected: _fieldNames = std::make_unique(); } - virtual std::unique_ptr initializeCumulativeMetrics() - override { + std::unique_ptr initializeCumulativeMetrics() override { return std::make_unique(); } GlobalIndexCumulativeMetrics* _globalIndexCumulativeMetrics; diff --git a/src/mongo/db/s/global_index/global_index_metrics.h b/src/mongo/db/s/global_index/global_index_metrics.h index 9430b05f0ff..9de8506db7e 100644 --- a/src/mongo/db/s/global_index/global_index_metrics.h +++ b/src/mongo/db/s/global_index/global_index_metrics.h @@ -113,7 +113,7 @@ public: Date_t startTime, ClockSource* clockSource, ShardingDataTransformCumulativeMetrics* cumulativeMetrics); - ~GlobalIndexMetrics(); + ~GlobalIndexMetrics() override; static std::unique_ptr makeInstance(UUID uuid, NamespaceString nss, diff --git a/src/mongo/db/s/metadata_manager.cpp b/src/mongo/db/s/metadata_manager.cpp index 6b140573223..c5d1f63f0c1 100644 --- a/src/mongo/db/s/metadata_manager.cpp +++ b/src/mongo/db/s/metadata_manager.cpp @@ -78,7 +78,7 @@ public: ++_metadataTracker->usageCounter; } - ~RangePreserver() { + ~RangePreserver() override { stdx::lock_guard managerLock(_metadataManager->_managerLock); invariant(_metadataTracker->usageCounter != 0); @@ -96,7 +96,7 @@ public: // This will only ever refer to the active metadata, so CollectionMetadata should never be // boost::none - const CollectionMetadata& get() { + const CollectionMetadata& get() override { invariant(_metadataTracker->metadata); return _metadataTracker->metadata.value(); } diff --git a/src/mongo/db/s/metrics/field_names/with_document_copy_approximation_field_name_overrides.h b/src/mongo/db/s/metrics/field_names/with_document_copy_approximation_field_name_overrides.h index 58a27370179..c48225ed7c9 100644 --- a/src/mongo/db/s/metrics/field_names/with_document_copy_approximation_field_name_overrides.h +++ b/src/mongo/db/s/metrics/field_names/with_document_copy_approximation_field_name_overrides.h @@ -36,11 +36,11 @@ namespace mongo { template class WithDocumentCopyApproximationFieldNameOverrides : public Base { public: - virtual StringData getForApproxDocumentsToProcess() const override { + StringData getForApproxDocumentsToProcess() const override { return kApproxDocumentsToCopy; } - virtual StringData getForApproxBytesToScan() const override { + StringData getForApproxBytesToScan() const override { return kApproxBytesToCopy; } diff --git a/src/mongo/db/s/metrics/field_names/with_document_copy_count_field_name_overrides.h b/src/mongo/db/s/metrics/field_names/with_document_copy_count_field_name_overrides.h index b1e40134968..9139d8638e9 100644 --- a/src/mongo/db/s/metrics/field_names/with_document_copy_count_field_name_overrides.h +++ b/src/mongo/db/s/metrics/field_names/with_document_copy_count_field_name_overrides.h @@ -36,11 +36,11 @@ namespace mongo { template class WithDocumentCopyCountFieldNameOverrides : public Base { public: - virtual StringData getForDocumentsProcessed() const override { + StringData getForDocumentsProcessed() const override { return kDocumentsCopied; } - virtual StringData getForBytesWritten() const override { + StringData getForBytesWritten() const override { return kBytesCopied; } diff --git a/src/mongo/db/s/metrics/sharding_data_transform_instance_metrics_test.cpp b/src/mongo/db/s/metrics/sharding_data_transform_instance_metrics_test.cpp index 638686df71e..703a4d9deac 100644 --- a/src/mongo/db/s/metrics/sharding_data_transform_instance_metrics_test.cpp +++ b/src/mongo/db/s/metrics/sharding_data_transform_instance_metrics_test.cpp @@ -115,7 +115,7 @@ public: std::move(observer)}, _scopedObserver(registerInstanceMetrics()) {} - boost::optional getRecipientHighEstimateRemainingTimeMillis() const { + boost::optional getRecipientHighEstimateRemainingTimeMillis() const override { return boost::none; } diff --git a/src/mongo/db/s/metrics/sharding_data_transform_metrics_test_fixture.h b/src/mongo/db/s/metrics/sharding_data_transform_metrics_test_fixture.h index 4aa64547b0a..bad182bf35e 100644 --- a/src/mongo/db/s/metrics/sharding_data_transform_metrics_test_fixture.h +++ b/src/mongo/db/s/metrics/sharding_data_transform_metrics_test_fixture.h @@ -59,23 +59,23 @@ public: invariant(timeRemainingHigh >= timeRemainingLow); } - virtual const UUID& getUuid() const override { + const UUID& getUuid() const override { return _uuid; } - virtual boost::optional getHighEstimateRemainingTimeMillis() const override { + boost::optional getHighEstimateRemainingTimeMillis() const override { return _timeRemainingHigh; } - virtual boost::optional getLowEstimateRemainingTimeMillis() const override { + boost::optional getLowEstimateRemainingTimeMillis() const override { return _timeRemainingLow; } - virtual Date_t getStartTimestamp() const override { + Date_t getStartTimestamp() const override { return _startTime; } - virtual ShardingDataTransformMetrics::Role getRole() const override { + ShardingDataTransformMetrics::Role getRole() const override { return _role; } @@ -90,11 +90,11 @@ private: class ShardingDataTransformCumulativeMetricsFieldNameProviderForTest : public ShardingDataTransformCumulativeMetricsFieldNameProvider { public: - virtual ~ShardingDataTransformCumulativeMetricsFieldNameProviderForTest() = default; - virtual StringData getForDocumentsProcessed() const override { + ~ShardingDataTransformCumulativeMetricsFieldNameProviderForTest() override = default; + StringData getForDocumentsProcessed() const override { return "documentsProcessed"; } - virtual StringData getForBytesWritten() const override { + StringData getForBytesWritten() const override { return "bytesWritten"; } }; diff --git a/src/mongo/db/s/migration_blocking_operation/migration_blocking_operation_coordinator.h b/src/mongo/db/s/migration_blocking_operation/migration_blocking_operation_coordinator.h index 35af69ea49b..eca8db6e98d 100644 --- a/src/mongo/db/s/migration_blocking_operation/migration_blocking_operation_coordinator.h +++ b/src/mongo/db/s/migration_blocking_operation/migration_blocking_operation_coordinator.h @@ -52,15 +52,15 @@ public: MigrationBlockingOperationCoordinator(ShardingDDLCoordinatorService* service, const BSONObj& initialState); - virtual void checkIfOptionsConflict(const BSONObj& stateDoc) const override; + void checkIfOptionsConflict(const BSONObj& stateDoc) const override; void beginOperation(OperationContext* opCtx, const UUID& operationUUID); void endOperation(OperationContext* opCtx, const UUID& operationUUID); private: - virtual StringData serializePhase(const Phase& phase) const override; - virtual ExecutorFuture _runImpl(std::shared_ptr executor, - const CancellationToken& token) noexcept override; + StringData serializePhase(const Phase& phase) const override; + ExecutorFuture _runImpl(std::shared_ptr executor, + const CancellationToken& token) noexcept override; Phase _getCurrentPhase() const; bool _isFirstOperation(WithLock lk) const; diff --git a/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_external_state.h b/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_external_state.h index f55604cd43f..059990ff167 100644 --- a/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_external_state.h +++ b/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_external_state.h @@ -70,8 +70,8 @@ public: bool isUpdatePending(OperationContext* opCtx, const NamespaceString& nss, AggregateCommandRequest& request) const override; - virtual InternalSessionPool::Session acquireSession() override; - virtual void releaseSession(InternalSessionPool::Session session) override; + InternalSessionPool::Session acquireSession() override; + void releaseSession(InternalSessionPool::Session session) override; private: InternalSessionPool* _sessionPool; diff --git a/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_test.cpp b/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_test.cpp index 9ffc789f7a2..3690b5c0c51 100644 --- a/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_test.cpp +++ b/src/mongo/db/s/migration_blocking_operation/multi_update_coordinator_test.cpp @@ -225,7 +225,7 @@ public: MultiUpdateCoordinatorExternalStateFactoryForTest(std::shared_ptr fakeState) : _fakeState{fakeState} {} - std::unique_ptr createExternalState() const { + std::unique_ptr createExternalState() const override { return std::make_unique(_fakeState); } diff --git a/src/mongo/db/s/migration_chunk_cloner_source.h b/src/mongo/db/s/migration_chunk_cloner_source.h index e91dd449b6a..9aab63be12f 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source.h +++ b/src/mongo/db/s/migration_chunk_cloner_source.h @@ -104,9 +104,9 @@ public: const std::vector& stmts, repl::OpTime prepareOrCommitOpTime); - void commit(OperationContext* opCtx, boost::optional); + void commit(OperationContext* opCtx, boost::optional) override; - void rollback(OperationContext* opCtx){}; + void rollback(OperationContext* opCtx) override{}; private: const LogicalSessionId _lsid; @@ -179,9 +179,9 @@ public: LogRetryableApplyOpsForShardingHandler(std::vector namespaces, std::vector opTimes); - void commit(OperationContext* opCtx, boost::optional); + void commit(OperationContext* opCtx, boost::optional) override; - void rollback(OperationContext* opCtx){}; + void rollback(OperationContext* opCtx) override{}; private: std::vector _namespaces; diff --git a/src/mongo/db/s/migration_chunk_cloner_source_commands.cpp b/src/mongo/db/s/migration_chunk_cloner_source_commands.cpp index 7bcfcf1c3a2..05ce4faf248 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_commands.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_commands.cpp @@ -161,7 +161,7 @@ public: return "internal"; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -169,7 +169,7 @@ public: return AllowedOnSecondary::kNever; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } @@ -188,7 +188,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { const MigrationSessionId migrationSessionId( uassertStatusOK(MigrationSessionId::extractFromBSON(cmdObj))); @@ -232,7 +232,7 @@ public: return "internal"; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -240,7 +240,7 @@ public: return AllowedOnSecondary::kNever; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } @@ -259,7 +259,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { const MigrationSessionId migrationSessionId( uassertStatusOK(MigrationSessionId::extractFromBSON(cmdObj))); @@ -377,7 +377,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName&, const BSONObj& cmdObj, - BSONObjBuilder& result) { + BSONObjBuilder& result) override { const MigrationSessionId migrationSessionId( uassertStatusOK(MigrationSessionId::extractFromBSON(cmdObj))); diff --git a/src/mongo/db/s/migration_chunk_cloner_source_test.cpp b/src/mongo/db/s/migration_chunk_cloner_source_test.cpp index d5c2845d734..837227f6d13 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_test.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_test.cpp @@ -191,7 +191,7 @@ public: MONGO_UNREACHABLE; } - RecordStore* getRecordStore() const { + RecordStore* getRecordStore() const override { return _coll->getRecordStore(); } @@ -534,7 +534,7 @@ public: uint64_t getIndexSize(OperationContext* opCtx, BSONObjBuilder* details = nullptr, - int scale = 1) const { + int scale = 1) const override { return _coll->getIndexSize(opCtx, details, scale); } @@ -568,12 +568,12 @@ public: } StatusWith> addCollationDefaultsToIndexSpecsForCreate( - OperationContext* opCtx, const std::vector& indexSpecs) const { + OperationContext* opCtx, const std::vector& indexSpecs) const override { return _coll->addCollationDefaultsToIndexSpecsForCreate(opCtx, indexSpecs); } - StatusWith addCollationDefaultsToIndexSpecsForCreate(OperationContext* opCtx, - const BSONObj& indexSpecs) const { + StatusWith addCollationDefaultsToIndexSpecsForCreate( + OperationContext* opCtx, const BSONObj& indexSpecs) const override { return _coll->addCollationDefaultsToIndexSpecsForCreate(opCtx, indexSpecs); } diff --git a/src/mongo/db/s/migration_destination_manager.h b/src/mongo/db/s/migration_destination_manager.h index 485632f3691..01df01824a0 100644 --- a/src/mongo/db/s/migration_destination_manager.h +++ b/src/mongo/db/s/migration_destination_manager.h @@ -115,7 +115,7 @@ public: }; MigrationDestinationManager(); - ~MigrationDestinationManager(); + ~MigrationDestinationManager() override; /** * Returns the singleton instance of the migration destination manager. @@ -304,7 +304,7 @@ private: void onStepDown() final; void onRollback() final {} void onBecomeArbiter() final {} - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "MigrationDestinationManager"; } diff --git a/src/mongo/db/s/move_primary_coordinator.h b/src/mongo/db/s/move_primary_coordinator.h index d1c11a22cdc..a5522ca8f57 100644 --- a/src/mongo/db/s/move_primary_coordinator.h +++ b/src/mongo/db/s/move_primary_coordinator.h @@ -64,7 +64,7 @@ public: using Phase = MovePrimaryCoordinatorPhaseEnum; MovePrimaryCoordinator(ShardingDDLCoordinatorService* service, const BSONObj& initialState); - virtual ~MovePrimaryCoordinator() = default; + ~MovePrimaryCoordinator() override = default; void checkIfOptionsConflict(const BSONObj& doc) const override; bool canAlwaysStartWhenUserWritesAreDisabled() const override; diff --git a/src/mongo/db/s/op_observer_sharding_test.cpp b/src/mongo/db/s/op_observer_sharding_test.cpp index 3040d1b9a73..94d0644dc49 100644 --- a/src/mongo/db/s/op_observer_sharding_test.cpp +++ b/src/mongo/db/s/op_observer_sharding_test.cpp @@ -102,7 +102,7 @@ void setCollectionFilteringMetadata(OperationContext* opCtx, CollectionMetadata class DocumentKeyStateTest : public ShardServerTestFixture { protected: - virtual void setUp() override { + void setUp() override { ShardServerTestFixture::setUp(); OperationShardingState::ScopedAllowImplicitCollectionCreate_UNSAFE unsafeCreateCollection( diff --git a/src/mongo/db/s/placement_history_bm.cpp b/src/mongo/db/s/placement_history_bm.cpp index 3076908bc03..f981e3e2b5f 100644 --- a/src/mongo/db/s/placement_history_bm.cpp +++ b/src/mongo/db/s/placement_history_bm.cpp @@ -98,7 +98,7 @@ public: ->initializeConfigDatabaseIfNeeded(operationContext())); } - ~BenchmarkConfigServerTestFixture() { + ~BenchmarkConfigServerTestFixture() override { TransactionCoordinatorService::get(operationContext())->onStepDown(); WaitForMajorityService::get(getServiceContext()).shutDown(); ShardingCatalogManager::get(operationContext())->shutDown(); diff --git a/src/mongo/db/s/query_analysis_coordinator.h b/src/mongo/db/s/query_analysis_coordinator.h index f7cafb72801..3b6d2f64443 100644 --- a/src/mongo/db/s/query_analysis_coordinator.h +++ b/src/mongo/db/s/query_analysis_coordinator.h @@ -105,9 +105,9 @@ public: static QueryAnalysisCoordinator* get(OperationContext* opCtx); static QueryAnalysisCoordinator* get(ServiceContext* serviceContext); - void onStartup(OperationContext* opCtx) override final; + void onStartup(OperationContext* opCtx) final; - void onStepUpBegin(OperationContext* opCtx, long long term) override final; + void onStepUpBegin(OperationContext* opCtx, long long term) final; /** * Creates, updates and deletes the configuration for the collection with the given @@ -154,28 +154,27 @@ public: } private: - bool shouldRegisterReplicaSetAwareService() const override final; + bool shouldRegisterReplicaSetAwareService() const final; /** * On a standalone replica set, creates, updates and removes samplers based on the current * replica set configuration. */ - void onSetCurrentConfig(OperationContext* opCtx) override final; + void onSetCurrentConfig(OperationContext* opCtx) final; - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final {} + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final {} - void onShutdown() override final {} + void onShutdown() final {} - void onStepUpComplete(OperationContext* opCtx, long long term) override final {} + void onStepUpComplete(OperationContext* opCtx, long long term) final {} - void onStepDown() override final {} + void onStepDown() final {} - void onRollback() override final {} + void onRollback() final {} - void onBecomeArbiter() override final {} + void onBecomeArbiter() final {} - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "QueryAnalysisCoordinator"; } diff --git a/src/mongo/db/s/query_analysis_op_observer.h b/src/mongo/db/s/query_analysis_op_observer.h index e203fba5391..54d9f7e4ecd 100644 --- a/src/mongo/db/s/query_analysis_op_observer.h +++ b/src/mongo/db/s/query_analysis_op_observer.h @@ -51,27 +51,27 @@ class QueryAnalysisOpObserver : public OpObserverNoop { public: QueryAnalysisOpObserver() = default; - ~QueryAnalysisOpObserver() = default; + ~QueryAnalysisOpObserver() override = default; - virtual void onInserts(OperationContext* opCtx, - const CollectionPtr& coll, - std::vector::const_iterator first, - std::vector::const_iterator last, - const std::vector& recordIds, - std::vector fromMigrate, - bool defaultFromMigrate, - OpStateAccumulator* opAccumulator = nullptr) = 0; + void onInserts(OperationContext* opCtx, + const CollectionPtr& coll, + std::vector::const_iterator first, + std::vector::const_iterator last, + const std::vector& recordIds, + std::vector fromMigrate, + bool defaultFromMigrate, + OpStateAccumulator* opAccumulator = nullptr) override = 0; - virtual void onUpdate(OperationContext* opCtx, - const OplogUpdateEntryArgs& args, - OpStateAccumulator* opAccumulator = nullptr) = 0; + void onUpdate(OperationContext* opCtx, + const OplogUpdateEntryArgs& args, + OpStateAccumulator* opAccumulator = nullptr) override = 0; - virtual void onDelete(OperationContext* opCtx, - const CollectionPtr& coll, - StmtId stmtId, - const BSONObj& doc, - const OplogDeleteEntryArgs& args, - OpStateAccumulator* opAccumulator = nullptr) = 0; + void onDelete(OperationContext* opCtx, + const CollectionPtr& coll, + StmtId stmtId, + const BSONObj& doc, + const OplogDeleteEntryArgs& args, + OpStateAccumulator* opAccumulator = nullptr) override = 0; protected: void insertInConfigQueryAnalyzersNamespaceImpl( diff --git a/src/mongo/db/s/query_analysis_op_observer_configsvr.h b/src/mongo/db/s/query_analysis_op_observer_configsvr.h index 16d1b5215e5..dd1fab11543 100644 --- a/src/mongo/db/s/query_analysis_op_observer_configsvr.h +++ b/src/mongo/db/s/query_analysis_op_observer_configsvr.h @@ -51,7 +51,7 @@ class QueryAnalysisOpObserverConfigSvr final : public QueryAnalysisOpObserver { public: QueryAnalysisOpObserverConfigSvr() = default; - ~QueryAnalysisOpObserverConfigSvr() = default; + ~QueryAnalysisOpObserverConfigSvr() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfig, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/s/query_analysis_op_observer_rs.h b/src/mongo/db/s/query_analysis_op_observer_rs.h index a50704b62a9..b247c9580f8 100644 --- a/src/mongo/db/s/query_analysis_op_observer_rs.h +++ b/src/mongo/db/s/query_analysis_op_observer_rs.h @@ -51,7 +51,7 @@ class QueryAnalysisOpObserverRS final : public QueryAnalysisOpObserver { public: QueryAnalysisOpObserverRS() = default; - ~QueryAnalysisOpObserverRS() = default; + ~QueryAnalysisOpObserverRS() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kAll, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/s/query_analysis_op_observer_shardsvr.h b/src/mongo/db/s/query_analysis_op_observer_shardsvr.h index 79a78b64210..3df17f1752b 100644 --- a/src/mongo/db/s/query_analysis_op_observer_shardsvr.h +++ b/src/mongo/db/s/query_analysis_op_observer_shardsvr.h @@ -51,7 +51,7 @@ class QueryAnalysisOpObserverShardSvr final : public QueryAnalysisOpObserver { public: QueryAnalysisOpObserverShardSvr() = default; - ~QueryAnalysisOpObserverShardSvr() = default; + ~QueryAnalysisOpObserverShardSvr() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kAll, NamespaceFilter::kNone}; diff --git a/src/mongo/db/s/query_analysis_writer.h b/src/mongo/db/s/query_analysis_writer.h index 7fad08983b0..0d27cf5cc3e 100644 --- a/src/mongo/db/s/query_analysis_writer.h +++ b/src/mongo/db/s/query_analysis_writer.h @@ -148,7 +148,7 @@ public: }; QueryAnalysisWriter() = default; - ~QueryAnalysisWriter() = default; + ~QueryAnalysisWriter() override = default; QueryAnalysisWriter(QueryAnalysisWriter&& source) = delete; QueryAnalysisWriter& operator=(QueryAnalysisWriter&& other) = delete; @@ -164,10 +164,10 @@ public: /** * ReplicaSetAwareService methods: */ - void onStartup(OperationContext* opCtx); - void onShutdown(); - void onStepUpComplete(OperationContext* opCtx, long long term); - inline std::string getServiceName() const override final { + void onStartup(OperationContext* opCtx) override; + void onShutdown() override; + void onStepUpComplete(OperationContext* opCtx, long long term) override; + inline std::string getServiceName() const final { return "QueryAnalysisWriter"; } @@ -247,20 +247,19 @@ public: } private: - bool shouldRegisterReplicaSetAwareService() const override final; + bool shouldRegisterReplicaSetAwareService() const final; - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final {} + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final {} - void onStepDown() override final {} + void onStepDown() final {} - void onRollback() override final {} + void onRollback() final {} - void onBecomeArbiter() override final {} + void onBecomeArbiter() final {} - void onSetCurrentConfig(OperationContext* opCtx) override final {} + void onSetCurrentConfig(OperationContext* opCtx) final {} ExecutorFuture _addReadQuery(const UUID& sampleId, const NamespaceString& nss, diff --git a/src/mongo/db/s/query_analysis_writer_test.cpp b/src/mongo/db/s/query_analysis_writer_test.cpp index 635a9194af9..9fd8d2350da 100644 --- a/src/mongo/db/s/query_analysis_writer_test.cpp +++ b/src/mongo/db/s/query_analysis_writer_test.cpp @@ -202,7 +202,7 @@ void assertBsonObjEqualUnordered(const BSONObj& lhs, const BSONObj& rhs) { struct QueryAnalysisWriterTest : public ShardServerTestFixture { public: - void setUp() { + void setUp() override { ShardServerTestFixture::setUp(); QueryAnalysisWriter::get(operationContext())->onStartup(operationContext()); @@ -218,7 +218,7 @@ public: tracker.refreshConfigurations({configuration0, configuration1}); } - void tearDown() { + void tearDown() override { QueryAnalysisWriter::get(operationContext())->onShutdown(); ShardServerTestFixture::tearDown(); } diff --git a/src/mongo/db/s/range_deleter_service.h b/src/mongo/db/s/range_deleter_service.h index 62fadc72b50..b47b861fede 100644 --- a/src/mongo/db/s/range_deleter_service.h +++ b/src/mongo/db/s/range_deleter_service.h @@ -268,7 +268,7 @@ public: void onStepUpComplete(OperationContext* opCtx, long long term) override; void onStepDown() override; void onShutdown() override; - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "RangeDeleterService"; } @@ -303,10 +303,9 @@ private: void _stopService(); /* ReplicaSetAwareServiceShardSvr "empty implemented" methods */ - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final{}; - void onBecomeArbiter() override final {} + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final{}; + void onBecomeArbiter() final {} }; /** diff --git a/src/mongo/db/s/range_deleter_service_op_observer.h b/src/mongo/db/s/range_deleter_service_op_observer.h index b24aae8e092..d2d89e08940 100644 --- a/src/mongo/db/s/range_deleter_service_op_observer.h +++ b/src/mongo/db/s/range_deleter_service_op_observer.h @@ -51,7 +51,7 @@ class RangeDeleterServiceOpObserver final : public OpObserverNoop { public: RangeDeleterServiceOpObserver(); - ~RangeDeleterServiceOpObserver(); + ~RangeDeleterServiceOpObserver() override; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfig, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/s/read_only_catalog_cache_loader.h b/src/mongo/db/s/read_only_catalog_cache_loader.h index b81500433bb..6ccd6506bb6 100644 --- a/src/mongo/db/s/read_only_catalog_cache_loader.h +++ b/src/mongo/db/s/read_only_catalog_cache_loader.h @@ -48,7 +48,7 @@ namespace mongo { class ReadOnlyCatalogCacheLoader final : public CatalogCacheLoader { public: ReadOnlyCatalogCacheLoader() = default; - ~ReadOnlyCatalogCacheLoader(); + ~ReadOnlyCatalogCacheLoader() override; void initializeReplicaSetRole(bool isPrimary) override {} void onStepDown() override {} diff --git a/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp b/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp index df2446ed76e..f0050dd5721 100644 --- a/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp +++ b/src/mongo/db/s/refresh_query_analyzer_configuration_cmd.cpp @@ -87,7 +87,7 @@ public: } private: - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(DatabaseName::kAdmin); } diff --git a/src/mongo/db/s/rename_collection_participant_service.h b/src/mongo/db/s/rename_collection_participant_service.h index 873481d4a7d..0ff18b5fffc 100644 --- a/src/mongo/db/s/rename_collection_participant_service.h +++ b/src/mongo/db/s/rename_collection_participant_service.h @@ -66,7 +66,7 @@ public: explicit RenameCollectionParticipantService(ServiceContext* serviceContext) : PrimaryOnlyService(serviceContext) {} - ~RenameCollectionParticipantService() = default; + ~RenameCollectionParticipantService() override = default; static RenameCollectionParticipantService* getService(OperationContext* opCtx); @@ -113,7 +113,7 @@ public: IDLParserContext("RenameCollectionParticipantDocument"), participantDoc.getOwned())), _request(_doc.getRenameCollectionRequest()) {} - ~RenameParticipantInstance(); + ~RenameParticipantInstance() override; /* * Check if the given participant document has the same options as the current instance. @@ -159,12 +159,12 @@ private: const RenameCollectionRequest _request; SemiFuture run(std::shared_ptr executor, - const CancellationToken& token) noexcept override final; + const CancellationToken& token) noexcept final; SemiFuture _runImpl(std::shared_ptr executor, const CancellationToken& token) noexcept; - void interrupt(Status status) noexcept override final; + void interrupt(Status status) noexcept final; template auto _buildPhaseHandler(const Phase& newPhase, Func&& handlerFn) { diff --git a/src/mongo/db/s/resharding/document_source_resharding_add_resume_id.h b/src/mongo/db/s/resharding/document_source_resharding_add_resume_id.h index 87abdf0c7f5..f2f1925912a 100644 --- a/src/mongo/db/s/resharding/document_source_resharding_add_resume_id.h +++ b/src/mongo/db/s/resharding/document_source_resharding_add_resume_id.h @@ -70,7 +70,7 @@ public: DocumentSource::GetModPathsReturn getModifiedPaths() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; @@ -78,7 +78,7 @@ public: return boost::none; } - const char* getSourceName() const { + const char* getSourceName() const override { return DocumentSourceReshardingAddResumeId::kStageName.rawData(); } diff --git a/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h b/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h index 1be9ec5dcb5..effc8c692e5 100644 --- a/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h +++ b/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h @@ -90,7 +90,7 @@ public: DocumentSource::GetModPathsReturn getModifiedPaths() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; @@ -98,7 +98,7 @@ public: return boost::none; } - const char* getSourceName() const { + const char* getSourceName() const override { return DocumentSourceReshardingIterateTransaction::kStageName.rawData(); } diff --git a/src/mongo/db/s/resharding/document_source_resharding_ownership_match.h b/src/mongo/db/s/resharding/document_source_resharding_ownership_match.h index 7d29d979603..0ee43e13c69 100644 --- a/src/mongo/db/s/resharding/document_source_resharding_ownership_match.h +++ b/src/mongo/db/s/resharding/document_source_resharding_ownership_match.h @@ -76,7 +76,7 @@ public: DocumentSource::GetModPathsReturn getModifiedPaths() const final; - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final; diff --git a/src/mongo/db/s/resharding/resharding_agg_test.cpp b/src/mongo/db/s/resharding/resharding_agg_test.cpp index f7539f0fd17..e98ae24b464 100644 --- a/src/mongo/db/s/resharding/resharding_agg_test.cpp +++ b/src/mongo/db/s/resharding/resharding_agg_test.cpp @@ -112,13 +112,13 @@ public: _oplogIt(_oplogContents.rbegin()), _nextOpTime(std::move(startTime)) {} - virtual ~MockTransactionHistoryIterator() = default; + ~MockTransactionHistoryIterator() override = default; - bool hasNext() const { + bool hasNext() const override { return !_nextOpTime.isNull(); } - repl::OplogEntry next(OperationContext* opCtx) { + repl::OplogEntry next(OperationContext* opCtx) override { BSONObj oplogBSON = findOneOplogEntry(_nextOpTime); auto oplogEntry = uassertStatusOK(repl::OplogEntry::parse(oplogBSON)); @@ -132,7 +132,7 @@ public: return oplogEntry; } - repl::OpTime nextOpTime(OperationContext* opCtx) { + repl::OpTime nextOpTime(OperationContext* opCtx) override { BSONObj oplogBSON = findOneOplogEntry(_nextOpTime); auto prevOpTime = oplogBSON[repl::OplogEntry::kPrevWriteOpTimeInTransactionFieldName]; @@ -195,7 +195,7 @@ public: } std::unique_ptr createTransactionHistoryIterator( - repl::OpTime time) const { + repl::OpTime time) const override { return std::unique_ptr( new MockTransactionHistoryIterator(_mockResults, time)); } @@ -213,7 +213,7 @@ public: const NamespaceString& nss, UUID collectionUUID, const Document& documentKey, - boost::optional readConcern) { + boost::optional readConcern) override { DBDirectClient client(expCtx->opCtx); auto result = client.findOne(nss, documentKey.toBson()); if (result.isEmpty()) { diff --git a/src/mongo/db/s/resharding/resharding_coordinator_service.h b/src/mongo/db/s/resharding/resharding_coordinator_service.h index 3560e253280..075df599961 100644 --- a/src/mongo/db/s/resharding/resharding_coordinator_service.h +++ b/src/mongo/db/s/resharding/resharding_coordinator_service.h @@ -251,7 +251,7 @@ public: explicit ReshardingCoordinatorService(ServiceContext* serviceContext) : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {} - ~ReshardingCoordinatorService() = default; + ~ReshardingCoordinatorService() override = default; friend ReshardingCoordinator; @@ -303,7 +303,7 @@ public: const ReshardingCoordinatorDocument& coordinatorDoc, std::shared_ptr externalState, ServiceContext* serviceContext); - ~ReshardingCoordinator() = default; + ~ReshardingCoordinator() override = default; SemiFuture run(std::shared_ptr executor, const CancellationToken& token) noexcept override; diff --git a/src/mongo/db/s/resharding/resharding_cumulative_metrics.h b/src/mongo/db/s/resharding/resharding_cumulative_metrics.h index 404a750b6de..9157b71ec9d 100644 --- a/src/mongo/db/s/resharding/resharding_cumulative_metrics.h +++ b/src/mongo/db/s/resharding/resharding_cumulative_metrics.h @@ -67,9 +67,9 @@ public: void onCanceled(bool isSameKeyResharding); private: - virtual void reportActive(BSONObjBuilder* bob) const; - virtual void reportLatencies(BSONObjBuilder* bob) const; - virtual void reportCurrentInSteps(BSONObjBuilder* bob) const; + void reportActive(BSONObjBuilder* bob) const override; + void reportLatencies(BSONObjBuilder* bob) const override; + void reportCurrentInSteps(BSONObjBuilder* bob) const override; const ReshardingCumulativeMetricsFieldNameProvider* _fieldNames; diff --git a/src/mongo/db/s/resharding/resharding_cumulative_metrics_test.cpp b/src/mongo/db/s/resharding/resharding_cumulative_metrics_test.cpp index 574660fb505..c1343d5fca2 100644 --- a/src/mongo/db/s/resharding/resharding_cumulative_metrics_test.cpp +++ b/src/mongo/db/s/resharding/resharding_cumulative_metrics_test.cpp @@ -68,12 +68,11 @@ protected: _fieldNames = std::make_unique(); } - virtual std::unique_ptr initializeCumulativeMetrics() - override { + std::unique_ptr initializeCumulativeMetrics() override { return std::make_unique(); } - virtual StringData getRootSectionName() override { + StringData getRootSectionName() override { return kResharding; } diff --git a/src/mongo/db/s/resharding/resharding_data_replication.h b/src/mongo/db/s/resharding/resharding_data_replication.h index 4962d498688..a81f63cb211 100644 --- a/src/mongo/db/s/resharding/resharding_data_replication.h +++ b/src/mongo/db/s/resharding/resharding_data_replication.h @@ -153,7 +153,7 @@ private: struct TrustedInitTag {}; public: - virtual ~ReshardingDataReplication(); + ~ReshardingDataReplication() override; static std::unique_ptr make( OperationContext* opCtx, ReshardingMetrics* metrics, diff --git a/src/mongo/db/s/resharding/resharding_donor_service.cpp b/src/mongo/db/s/resharding/resharding_donor_service.cpp index cb5bbb5a46d..d288408c533 100644 --- a/src/mongo/db/s/resharding/resharding_donor_service.cpp +++ b/src/mongo/db/s/resharding/resharding_donor_service.cpp @@ -233,7 +233,7 @@ public: void clearFilteringMetadata(OperationContext* opCtx, const NamespaceString& sourceNss, - const NamespaceString& tempReshardingNss) { + const NamespaceString& tempReshardingNss) override { stdx::unordered_set namespacesToRefresh{sourceNss, tempReshardingNss}; resharding::clearFilteringMetadata( opCtx, namespacesToRefresh, true /* scheduleAsyncRefresh */); diff --git a/src/mongo/db/s/resharding/resharding_donor_service.h b/src/mongo/db/s/resharding/resharding_donor_service.h index 280f59c93bb..8c42e199470 100644 --- a/src/mongo/db/s/resharding/resharding_donor_service.h +++ b/src/mongo/db/s/resharding/resharding_donor_service.h @@ -67,7 +67,7 @@ public: explicit ReshardingDonorService(ServiceContext* serviceContext) : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {} - ~ReshardingDonorService() = default; + ~ReshardingDonorService() override = default; class DonorStateMachine; @@ -107,7 +107,7 @@ public: std::unique_ptr externalState, ServiceContext* serviceContext); - ~DonorStateMachine() = default; + ~DonorStateMachine() override = default; SemiFuture run(std::shared_ptr executor, const CancellationToken& stepdownToken) noexcept override; diff --git a/src/mongo/db/s/resharding/resharding_metrics.h b/src/mongo/db/s/resharding/resharding_metrics.h index 4029c235cb3..ecbdc87086b 100644 --- a/src/mongo/db/s/resharding/resharding_metrics.h +++ b/src/mongo/db/s/resharding/resharding_metrics.h @@ -134,7 +134,7 @@ public: State state, ProvenanceEnum provenance = ProvenanceEnum::kReshardCollection); - ~ReshardingMetrics(); + ~ReshardingMetrics() override; static std::unique_ptr makeInstance(UUID instanceId, BSONObj shardKey, @@ -213,7 +213,7 @@ public: protected: boost::optional getRecipientHighEstimateRemainingTimeMillis() const override; - virtual StringData getStateString() const noexcept override; + StringData getStateString() const noexcept override; private: std::string createOperationDescription() const noexcept override; diff --git a/src/mongo/db/s/resharding/resharding_metrics_test.cpp b/src/mongo/db/s/resharding/resharding_metrics_test.cpp index 948fc07eab2..4bf725a76b5 100644 --- a/src/mongo/db/s/resharding/resharding_metrics_test.cpp +++ b/src/mongo/db/s/resharding/resharding_metrics_test.cpp @@ -70,8 +70,7 @@ const auto kShardKey = BSON("newKey" << 1); class ReshardingMetricsTest : public ShardingDataTransformMetricsTestFixture { public: - virtual std::unique_ptr initializeCumulativeMetrics() - override { + std::unique_ptr initializeCumulativeMetrics() override { return std::make_unique(); } @@ -87,7 +86,7 @@ public: getCumulativeMetrics()); } - virtual StringData getRootSectionName() override { + StringData getRootSectionName() override { return kResharding; } diff --git a/src/mongo/db/s/resharding/resharding_oplog_applier_metrics_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_applier_metrics_test.cpp index d4913f0d3e4..cfb356b0ed4 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_applier_metrics_test.cpp +++ b/src/mongo/db/s/resharding/resharding_oplog_applier_metrics_test.cpp @@ -53,8 +53,7 @@ namespace { class ReshardingOplogApplierMetricsTest : public ShardingDataTransformMetricsTestFixture { public: - virtual std::unique_ptr initializeCumulativeMetrics() - override { + std::unique_ptr initializeCumulativeMetrics() override { return std::make_unique(); } diff --git a/src/mongo/db/s/resharding/resharding_oplog_applier_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_applier_test.cpp index 93b90666fb7..b73356762cd 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_applier_test.cpp +++ b/src/mongo/db/s/resharding/resharding_oplog_applier_test.cpp @@ -223,7 +223,7 @@ public: _cancelableOpCtxExecutor->startup(); } - void tearDown() { + void tearDown() override { _executor->shutdown(); _executor->join(); diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher.h b/src/mongo/db/s/resharding/resharding_oplog_fetcher.h index fabd02237e1..f9775dd59dc 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_fetcher.h +++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher.h @@ -90,7 +90,7 @@ public: ShardId recipientShard, NamespaceString toWriteInto); - ~ReshardingOplogFetcher(); + ~ReshardingOplogFetcher() override; Future awaitInsert(const ReshardingDonorOplogId& lastSeen) override; diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp index 95f93af1988..4635bb28dd7 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp +++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp @@ -194,7 +194,7 @@ public: * ShardRegistry reload is done over DBClient, not the NetworkInterface, and there is no * DBClientMock analogous to the NetworkInterfaceMock. */ - std::unique_ptr makeShardingCatalogClient() { + std::unique_ptr makeShardingCatalogClient() override { class StaticCatalogClient final : public ShardingCatalogClientMock { public: diff --git a/src/mongo/db/s/resharding/resharding_recipient_service.h b/src/mongo/db/s/resharding/resharding_recipient_service.h index 43bc871a24b..05cdf5f80b7 100644 --- a/src/mongo/db/s/resharding/resharding_recipient_service.h +++ b/src/mongo/db/s/resharding/resharding_recipient_service.h @@ -75,7 +75,7 @@ public: explicit ReshardingRecipientService(ServiceContext* serviceContext) : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {} - ~ReshardingRecipientService() = default; + ~ReshardingRecipientService() override = default; class RecipientStateMachine; @@ -142,7 +142,7 @@ public: ReshardingDataReplicationFactory dataReplicationFactory, ServiceContext* serviceContext); - ~RecipientStateMachine() = default; + ~RecipientStateMachine() override = default; /** * Runs up until the recipient is in state kStrictConsistency or encountered an error. diff --git a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp index f34d7ce76c4..8346eb6c1de 100644 --- a/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp +++ b/src/mongo/db/s/resharding/resharding_recipient_service_test.cpp @@ -184,7 +184,7 @@ public: } boost::optional getCollectionIndexInfoWithRefresh( - OperationContext* opCtx, const NamespaceString& nss) { + OperationContext* opCtx, const NamespaceString& nss) override { return boost::none; } diff --git a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp index 08a05f61120..4b354a75cb0 100644 --- a/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp +++ b/src/mongo/db/s/resharding/resharding_txn_cloner_test.cpp @@ -140,7 +140,7 @@ namespace mongo { namespace { class ReshardingTxnClonerTest : public ShardServerTestFixtureWithCatalogCacheLoaderMock { - void setUp() { + void setUp() override { ShardServerTestFixtureWithCatalogCacheLoaderMock::setUp(); // The config database's primary shard is always config, and it is always sharded. @@ -168,7 +168,7 @@ class ReshardingTxnClonerTest : public ShardServerTestFixtureWithCatalogCacheLoa LogicalSessionCache::set(getServiceContext(), std::make_unique()); } - void tearDown() { + void tearDown() override { WaitForMajorityService::get(getServiceContext()).shutDown(); ShardServerTestFixtureWithCatalogCacheLoaderMock::tearDown(); } @@ -179,7 +179,7 @@ class ReshardingTxnClonerTest : public ShardServerTestFixtureWithCatalogCacheLoa * ShardRegistry reload is done over DBClient, not the NetworkInterface, and there is no * DBClientMock analogous to the NetworkInterfaceMock. */ - std::unique_ptr makeShardingCatalogClient() { + std::unique_ptr makeShardingCatalogClient() override { class StaticCatalogClient final : public ShardingCatalogClientMock { public: diff --git a/src/mongo/db/s/scoped_operation_completion_sharding_actions.h b/src/mongo/db/s/scoped_operation_completion_sharding_actions.h index baea9099032..3d85fe61e8c 100644 --- a/src/mongo/db/s/scoped_operation_completion_sharding_actions.h +++ b/src/mongo/db/s/scoped_operation_completion_sharding_actions.h @@ -48,7 +48,7 @@ class ScopedOperationCompletionShardingActions : public PolymorphicScoped { public: ScopedOperationCompletionShardingActions(OperationContext* opCtx); - ~ScopedOperationCompletionShardingActions() noexcept; + ~ScopedOperationCompletionShardingActions() noexcept override; private: OperationContext* _opCtx; diff --git a/src/mongo/db/s/shard_local.h b/src/mongo/db/s/shard_local.h index 868559a2f8f..b631afdb059 100644 --- a/src/mongo/db/s/shard_local.h +++ b/src/mongo/db/s/shard_local.h @@ -67,7 +67,7 @@ public: explicit ShardLocal(const ShardId& id); - ~ShardLocal() = default; + ~ShardLocal() override = default; /** * These functions are implemented for the Shard interface's sake. They should not be called on @@ -87,11 +87,11 @@ public: const DatabaseName& dbName, const BSONObj& cmdObj) override; - Status runAggregation( - OperationContext* opCtx, - const AggregateCommandRequest& aggRequest, - std::function& batch, - const boost::optional& postBatchResumeToken)> callback); + Status runAggregation(OperationContext* opCtx, + const AggregateCommandRequest& aggRequest, + std::function& batch, + const boost::optional& postBatchResumeToken)> + callback) override; private: StatusWith _runCommand(OperationContext* opCtx, diff --git a/src/mongo/db/s/shard_local_test.cpp b/src/mongo/db/s/shard_local_test.cpp index 37b16e6edc4..18d9b1c14ee 100644 --- a/src/mongo/db/s/shard_local_test.cpp +++ b/src/mongo/db/s/shard_local_test.cpp @@ -68,7 +68,7 @@ protected: ClusterRole::ShardServer, ClusterRole::ConfigServer, ClusterRole::RouterServer}; } - ~ShardLocalTest() { + ~ShardLocalTest() override { serverGlobalParams.clusterRole = ClusterRole::None; } diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.h b/src/mongo/db/s/shard_server_catalog_cache_loader.h index 514b155afca..34fd4375ef3 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.h +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.h @@ -73,7 +73,7 @@ class ShardServerCatalogCacheLoader : public CatalogCacheLoader { public: ShardServerCatalogCacheLoader(std::unique_ptr configServerLoader); - ~ShardServerCatalogCacheLoader(); + ~ShardServerCatalogCacheLoader() override; /** * Initializes internal state so that the loader behaves as a primary or secondary. This can @@ -98,7 +98,7 @@ public: * in case of rollback. Primaries must step down before going through rollback, so this should * only be run on secondaries. */ - void onReplicationRollback(); + void onReplicationRollback() override; /** * Sets any notifications waiting for this version to arrive and invalidates the catalog cache's diff --git a/src/mongo/db/s/shard_server_op_observer.h b/src/mongo/db/s/shard_server_op_observer.h index 17bb2d7db0a..c78ee271caf 100644 --- a/src/mongo/db/s/shard_server_op_observer.h +++ b/src/mongo/db/s/shard_server_op_observer.h @@ -59,7 +59,7 @@ class ShardServerOpObserver final : public OpObserverNoop { public: ShardServerOpObserver(); - ~ShardServerOpObserver(); + ~ShardServerOpObserver() override; NamespaceFilters getNamespaceFilters() const final { diff --git a/src/mongo/db/s/shard_server_op_observer_test.cpp b/src/mongo/db/s/shard_server_op_observer_test.cpp index d1667bdf093..4fb9630f328 100644 --- a/src/mongo/db/s/shard_server_op_observer_test.cpp +++ b/src/mongo/db/s/shard_server_op_observer_test.cpp @@ -56,7 +56,7 @@ protected: explicit ShardServerOpObserverReplicaSetEndpointTest(Options options = {}) : ServiceContextMongoDTest(options.useReplSettings(true)) {} - virtual void setUp() override { + void setUp() override { // Set up mongod. ServiceContextMongoDTest::setUp(); diff --git a/src/mongo/db/s/shard_server_test_fixture.h b/src/mongo/db/s/shard_server_test_fixture.h index 306fb7ec8b0..60f571da30e 100644 --- a/src/mongo/db/s/shard_server_test_fixture.h +++ b/src/mongo/db/s/shard_server_test_fixture.h @@ -51,7 +51,7 @@ namespace mongo { class ShardServerTestFixture : public ShardingMongoDTestFixture { protected: ShardServerTestFixture(Options options = {}, bool setUpMajorityReads = true); - ~ShardServerTestFixture(); + ~ShardServerTestFixture() override; void setUp() override; @@ -81,7 +81,7 @@ protected: class ShardServerTestFixtureWithCatalogCacheMock : public ShardServerTestFixture { protected: void setUp() override; - virtual std::unique_ptr makeCatalogCache() override; + std::unique_ptr makeCatalogCache() override; CatalogCacheMock* getCatalogCacheMock(); CatalogCacheLoaderMock* getCatalogCacheLoaderMock(); diff --git a/src/mongo/db/s/sharding_ddl_coordinator.h b/src/mongo/db/s/sharding_ddl_coordinator.h index 34922a427d2..76e34367d88 100644 --- a/src/mongo/db/s/sharding_ddl_coordinator.h +++ b/src/mongo/db/s/sharding_ddl_coordinator.h @@ -87,7 +87,7 @@ class ShardingDDLCoordinator public: explicit ShardingDDLCoordinator(ShardingDDLCoordinatorService* service, const BSONObj& coorDoc); - ~ShardingDDLCoordinator(); + ~ShardingDDLCoordinator() override; /** * Whether this coordinator is allowed to start when user write blocking is enabled, even if the @@ -205,7 +205,7 @@ protected: private: SemiFuture run(std::shared_ptr executor, - const CancellationToken& token) noexcept override final; + const CancellationToken& token) noexcept final; virtual ExecutorFuture _runImpl(std::shared_ptr executor, const CancellationToken& token) noexcept = 0; @@ -215,7 +215,7 @@ private: const CancellationToken& token, const Status& status) noexcept; - void interrupt(Status status) override final; + void interrupt(Status status) final; bool _removeDocument(OperationContext* opCtx); @@ -469,7 +469,7 @@ protected: return getCurrentSession(); } - virtual boost::optional getAbortReason() const override { + boost::optional getAbortReason() const override { const auto& status = _doc.getAbortReason(); invariant(!status || !status->isOK(), "when persisted, status must be an error"); return status; diff --git a/src/mongo/db/s/sharding_ddl_coordinator_external_state.h b/src/mongo/db/s/sharding_ddl_coordinator_external_state.h index 36dc365db28..95199d520ae 100644 --- a/src/mongo/db/s/sharding_ddl_coordinator_external_state.h +++ b/src/mongo/db/s/sharding_ddl_coordinator_external_state.h @@ -53,17 +53,17 @@ private: class ShardingDDLCoordinatorExternalStateImpl : public ShardingDDLCoordinatorExternalState { public: - virtual void checkShardedDDLAllowedToStart(OperationContext* opCtx, - const NamespaceString& nss) const override; - virtual void waitForVectorClockDurable(OperationContext* opCtx) const override; - virtual void assertIsPrimaryShardForDb(OperationContext* opCtx, - const DatabaseName& dbName) const override; - virtual bool isShardedTimeseries(OperationContext* opCtx, - const NamespaceString& bucketNss) const override; - virtual void allowMigrations(OperationContext* opCtx, - const NamespaceString& nss, - bool allowMigrations) override; - virtual bool checkAllowMigrations(OperationContext* opCtx, const NamespaceString& nss) override; + void checkShardedDDLAllowedToStart(OperationContext* opCtx, + const NamespaceString& nss) const override; + void waitForVectorClockDurable(OperationContext* opCtx) const override; + void assertIsPrimaryShardForDb(OperationContext* opCtx, + const DatabaseName& dbName) const override; + bool isShardedTimeseries(OperationContext* opCtx, + const NamespaceString& bucketNss) const override; + void allowMigrations(OperationContext* opCtx, + const NamespaceString& nss, + bool allowMigrations) override; + bool checkAllowMigrations(OperationContext* opCtx, const NamespaceString& nss) override; }; class ShardingDDLCoordinatorExternalStateFactory { @@ -75,7 +75,7 @@ public: class ShardingDDLCoordinatorExternalStateFactoryImpl : public ShardingDDLCoordinatorExternalStateFactory { public: - virtual std::shared_ptr create() const override; + std::shared_ptr create() const override; }; diff --git a/src/mongo/db/s/sharding_ddl_coordinator_external_state_for_test.h b/src/mongo/db/s/sharding_ddl_coordinator_external_state_for_test.h index 7b40c52fb23..a66aff3568b 100644 --- a/src/mongo/db/s/sharding_ddl_coordinator_external_state_for_test.h +++ b/src/mongo/db/s/sharding_ddl_coordinator_external_state_for_test.h @@ -40,17 +40,17 @@ using MockCommandResponse = sharding_test_helpers::FaultGenerator; class ShardingDDLCoordinatorExternalStateForTest : public ShardingDDLCoordinatorExternalState { public: ShardingDDLCoordinatorExternalStateForTest(); - virtual void checkShardedDDLAllowedToStart(OperationContext* opCtx, - const NamespaceString& nss) const override; - virtual void waitForVectorClockDurable(OperationContext* opCtx) const override; - virtual void assertIsPrimaryShardForDb(OperationContext* opCtx, - const DatabaseName& dbName) const override; - virtual bool isShardedTimeseries(OperationContext* opCtx, - const NamespaceString& bucketNss) const override; - virtual void allowMigrations(OperationContext* opCtx, - const NamespaceString& nss, - bool allowMigrations) override; - virtual bool checkAllowMigrations(OperationContext* opCtx, const NamespaceString& nss) override; + void checkShardedDDLAllowedToStart(OperationContext* opCtx, + const NamespaceString& nss) const override; + void waitForVectorClockDurable(OperationContext* opCtx) const override; + void assertIsPrimaryShardForDb(OperationContext* opCtx, + const DatabaseName& dbName) const override; + bool isShardedTimeseries(OperationContext* opCtx, + const NamespaceString& bucketNss) const override; + void allowMigrations(OperationContext* opCtx, + const NamespaceString& nss, + bool allowMigrations) override; + bool checkAllowMigrations(OperationContext* opCtx, const NamespaceString& nss) override; MockCommandResponse allowMigrationsResponse; MockCommandResponse migrationsAllowedResponse; @@ -64,7 +64,7 @@ public: ShardingDDLCoordinatorExternalStateFactoryForTest( std::shared_ptr externalState); - virtual std::shared_ptr create() const override; + std::shared_ptr create() const override; private: std::shared_ptr _externalState; diff --git a/src/mongo/db/s/sharding_ddl_coordinator_service.h b/src/mongo/db/s/sharding_ddl_coordinator_service.h index c4ca7b87328..07858666c23 100644 --- a/src/mongo/db/s/sharding_ddl_coordinator_service.h +++ b/src/mongo/db/s/sharding_ddl_coordinator_service.h @@ -67,7 +67,7 @@ public: : PrimaryOnlyService(serviceContext), _externalStateFactory(std::move(externalStateFactory)) {} - ~ShardingDDLCoordinatorService() = default; + ~ShardingDDLCoordinatorService() override = default; static ShardingDDLCoordinatorService* getService(OperationContext* opCtx); diff --git a/src/mongo/db/s/sharding_ddl_coordinator_test.cpp b/src/mongo/db/s/sharding_ddl_coordinator_test.cpp index 8adc57abfaf..b90527f8ef8 100644 --- a/src/mongo/db/s/sharding_ddl_coordinator_test.cpp +++ b/src/mongo/db/s/sharding_ddl_coordinator_test.cpp @@ -72,11 +72,11 @@ protected: _shardingDDLCoordinatorMetadata(coordinatorMetadata), _additionalNss(additionalNss) {} - ShardingDDLCoordinatorMetadata const& metadata() const { + ShardingDDLCoordinatorMetadata const& metadata() const override { return _shardingDDLCoordinatorMetadata; } - void setMetadata(ShardingDDLCoordinatorMetadata&& metadata) {} + void setMetadata(ShardingDDLCoordinatorMetadata&& metadata) override {} boost::optional reportForCurrentOp( MongoProcessInterface::CurrentOpConnectionsMode connMode, @@ -86,7 +86,7 @@ protected: void checkIfOptionsConflict(const BSONObj& doc) const final {} - std::set _getAdditionalLocksToAcquire(OperationContext* opCtx) { + std::set _getAdditionalLocksToAcquire(OperationContext* opCtx) override { return _additionalNss; }; diff --git a/src/mongo/db/s/sharding_initialization_mongod.h b/src/mongo/db/s/sharding_initialization_mongod.h index 28592db3a47..14ac23e92a3 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.h +++ b/src/mongo/db/s/sharding_initialization_mongod.h @@ -62,7 +62,7 @@ public: std::function; ShardingInitializationMongoD(); - ~ShardingInitializationMongoD(); + ~ShardingInitializationMongoD() override; static ShardingInitializationMongoD* get(OperationContext* opCtx); static ShardingInitializationMongoD* get(ServiceContext* service); @@ -110,17 +110,16 @@ private: const ShardIdentity& shardIdentity); // Virtual methods coming from the ReplicaSetAwareService - void onStartup(OperationContext* opCtx) override final {} - void onSetCurrentConfig(OperationContext* opCtx) override final; - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final; - void onShutdown() override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final; - void onStepUpComplete(OperationContext* opCtx, long long term) override final {} - void onStepDown() override final; - void onRollback() override final {} - void onBecomeArbiter() override final {} - inline std::string getServiceName() const override final { + void onStartup(OperationContext* opCtx) final {} + void onSetCurrentConfig(OperationContext* opCtx) final; + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final; + void onShutdown() final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final; + void onStepUpComplete(OperationContext* opCtx, long long term) final {} + void onStepDown() final; + void onRollback() final {} + void onBecomeArbiter() final {} + inline std::string getServiceName() const final { return "ShardingInitializationMongoD"; } diff --git a/src/mongo/db/s/sharding_mongod_test_fixture.h b/src/mongo/db/s/sharding_mongod_test_fixture.h index 4eafac1da81..1705f9fa980 100644 --- a/src/mongo/db/s/sharding_mongod_test_fixture.h +++ b/src/mongo/db/s/sharding_mongod_test_fixture.h @@ -67,7 +67,7 @@ class ShardingMongoDTestFixture : public ShardingTestFixtureCommon, public ServiceContextMongoDTest { protected: ShardingMongoDTestFixture(Options options = {}, bool allowMajorityReads = true); - ~ShardingMongoDTestFixture(); + ~ShardingMongoDTestFixture() override; void setUp() override; void tearDown() override; diff --git a/src/mongo/db/s/sharding_recovery_service.h b/src/mongo/db/s/sharding_recovery_service.h index f222d3a7674..bee4d5bbeaa 100644 --- a/src/mongo/db/s/sharding_recovery_service.h +++ b/src/mongo/db/s/sharding_recovery_service.h @@ -117,8 +117,7 @@ public: * Recovers critical sections and indexes from disk when either initial sync or startup recovery * have completed. */ - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final; + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final; private: /** @@ -132,15 +131,15 @@ private: */ void recoverIndexesCatalog(OperationContext* opCtx); - void onStartup(OperationContext* opCtx) override final {} + void onStartup(OperationContext* opCtx) final {} void onSetCurrentConfig(OperationContext* opCtx) final {} - void onShutdown() override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final {} - void onStepUpComplete(OperationContext* opCtx, long long term) override final {} - void onStepDown() override final {} - void onRollback() override final {} - void onBecomeArbiter() override final {} - inline std::string getServiceName() const override final { + void onShutdown() final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final {} + void onStepUpComplete(OperationContext* opCtx, long long term) final {} + void onStepDown() final {} + void onRollback() final {} + void onBecomeArbiter() final {} + inline std::string getServiceName() const final { return "ShardingRecoveryService"; } }; diff --git a/src/mongo/db/s/sharding_util_refresh_test.cpp b/src/mongo/db/s/sharding_util_refresh_test.cpp index 700c1380d30..d2cbf04c8fb 100644 --- a/src/mongo/db/s/sharding_util_refresh_test.cpp +++ b/src/mongo/db/s/sharding_util_refresh_test.cpp @@ -77,7 +77,7 @@ const Status kRetryableError{ErrorCodes::HostUnreachable, "RetryableError for te class ShardingRefresherTest : public ConfigServerTestFixture { protected: - void setUp() { + void setUp() override { ConfigServerTestFixture::setUp(); for (const auto& shard : kShards) { diff --git a/src/mongo/db/s/shardsvr_move_primary_enter_critical_section_command.cpp b/src/mongo/db/s/shardsvr_move_primary_enter_critical_section_command.cpp index 392e75086ba..53cef3e09bb 100644 --- a/src/mongo/db/s/shardsvr_move_primary_enter_critical_section_command.cpp +++ b/src/mongo/db/s/shardsvr_move_primary_enter_critical_section_command.cpp @@ -198,7 +198,7 @@ private: return "Internal command. Do not call directly."; } - bool supportsRetryableWrite() const { + bool supportsRetryableWrite() const override { return true; } }; diff --git a/src/mongo/db/s/shardsvr_move_primary_exit_critical_section_command.cpp b/src/mongo/db/s/shardsvr_move_primary_exit_critical_section_command.cpp index 447574a7e91..c069962b4d3 100644 --- a/src/mongo/db/s/shardsvr_move_primary_exit_critical_section_command.cpp +++ b/src/mongo/db/s/shardsvr_move_primary_exit_critical_section_command.cpp @@ -167,7 +167,7 @@ private: return "Internal command. Do not call directly."; } - bool supportsRetryableWrite() const { + bool supportsRetryableWrite() const override { return true; } }; diff --git a/src/mongo/db/s/split_vector_test.cpp b/src/mongo/db/s/split_vector_test.cpp index ad9f4b05fe3..956f07be28d 100644 --- a/src/mongo/db/s/split_vector_test.cpp +++ b/src/mongo/db/s/split_vector_test.cpp @@ -71,7 +71,7 @@ void setUnshardedFilteringMetadata(OperationContext* opCtx, const NamespaceStrin class SplitVectorTest : public ShardServerTestFixture { public: - void setUp() { + void setUp() override { ShardServerTestFixture::setUp(); auto opCtx = operationContext(); @@ -316,7 +316,7 @@ const std::string kJumboPattern = "a"; class SplitVectorJumboTest : public ShardServerTestFixture { public: - void setUp() { + void setUp() override { ShardServerTestFixture::setUp(); auto opCtx = operationContext(); @@ -380,7 +380,7 @@ int numDocs = (BSONObjMaxUserSize / maxShardingUnitTestOplogDocSize) + 2; */ class SplitVectorMaxResponseSizeTest : public ShardServerTestFixture { public: - void setUp() { + void setUp() override { ShardServerTestFixture::setUp(); auto opCtx = operationContext(); diff --git a/src/mongo/db/s/transaction_coordinator_test.cpp b/src/mongo/db/s/transaction_coordinator_test.cpp index 110d89769b2..444c438ab0d 100644 --- a/src/mongo/db/s/transaction_coordinator_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_test.cpp @@ -1203,11 +1203,11 @@ protected: class TransactionCoordinatorDecisionPersistenceTestWithEOTChangeEventTrue : public TransactionCoordinatorDecisionPersistenceTest { public: - void setUp() { + void setUp() override { _controller.emplace("featureFlagEndOfTransactionChangeEvent", true); TransactionCoordinatorDecisionPersistenceTest::setUp(); } - void tearDown() { + void tearDown() override { TransactionCoordinatorDecisionPersistenceTest::tearDown(); _controller.reset(); } @@ -1219,11 +1219,11 @@ private: class TransactionCoordinatorDecisionPersistenceTestWithEOTChangeEventFalse : public TransactionCoordinatorDecisionPersistenceTest { public: - void setUp() { + void setUp() override { _controller.emplace("featureFlagEndOfTransactionChangeEvent", false); TransactionCoordinatorDecisionPersistenceTest::setUp(); } - void tearDown() { + void tearDown() override { TransactionCoordinatorDecisionPersistenceTest::tearDown(); _controller.reset(); } diff --git a/src/mongo/db/s/user_writes_recoverable_critical_section_service.h b/src/mongo/db/s/user_writes_recoverable_critical_section_service.h index 15a14ad79c2..c9ffde26a1f 100644 --- a/src/mongo/db/s/user_writes_recoverable_critical_section_service.h +++ b/src/mongo/db/s/user_writes_recoverable_critical_section_service.h @@ -147,20 +147,19 @@ public: void recoverRecoverableCriticalSections(OperationContext* opCtx); private: - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final { + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final { recoverRecoverableCriticalSections(opCtx); } - void onStartup(OperationContext* opCtx) override final {} - void onSetCurrentConfig(OperationContext* opCtx) override final {} - void onShutdown() override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final {} - void onStepUpComplete(OperationContext* opCtx, long long term) override final {} - void onStepDown() override final {} - void onRollback() override final {} - void onBecomeArbiter() override final {} - inline std::string getServiceName() const override final { + void onStartup(OperationContext* opCtx) final {} + void onSetCurrentConfig(OperationContext* opCtx) final {} + void onShutdown() final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final {} + void onStepUpComplete(OperationContext* opCtx, long long term) final {} + void onStepDown() final {} + void onRollback() final {} + void onBecomeArbiter() final {} + inline std::string getServiceName() const final { return "UserWritesRecoverableCriticalSectionService"; } }; diff --git a/src/mongo/db/server_options_test.cpp b/src/mongo/db/server_options_test.cpp index b813d45edf3..dca724ecec5 100644 --- a/src/mongo/db/server_options_test.cpp +++ b/src/mongo/db/server_options_test.cpp @@ -106,7 +106,9 @@ MONGO_INITIALIZER(ServerLogRedirection)(mongo::InitializerContext*) { class OptionsParserTester : public moe::OptionsParser { public: - Status readConfigFile(const std::string& filename, std::string* config, moe::ConfigExpand) { + Status readConfigFile(const std::string& filename, + std::string* config, + moe::ConfigExpand) override { if (filename != _filename) { ::mongo::StringBuilder sb; sb << "Parser using filename: " << filename diff --git a/src/mongo/db/serverless/shard_split_commands.cpp b/src/mongo/db/serverless/shard_split_commands.cpp index 8725378bad6..464ad4ad37b 100644 --- a/src/mongo/db/serverless/shard_split_commands.cpp +++ b/src/mongo/db/serverless/shard_split_commands.cpp @@ -130,12 +130,12 @@ public: return true; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; - std::string help() const { + std::string help() const override { return "Start an operation to split a shard into its own slice."; } @@ -206,7 +206,7 @@ public: return true; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; @@ -281,7 +281,7 @@ public: return true; } - NamespaceString ns() const { + NamespaceString ns() const override { return NamespaceString(request().getDbName()); } }; diff --git a/src/mongo/db/serverless/shard_split_donor_op_observer.h b/src/mongo/db/serverless/shard_split_donor_op_observer.h index f09362a3e3e..4ece8f63ba9 100644 --- a/src/mongo/db/serverless/shard_split_donor_op_observer.h +++ b/src/mongo/db/serverless/shard_split_donor_op_observer.h @@ -55,7 +55,7 @@ class ShardSplitDonorOpObserver final : public OpObserverNoop { public: ShardSplitDonorOpObserver() = default; - ~ShardSplitDonorOpObserver() = default; + ~ShardSplitDonorOpObserver() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kConfig, NamespaceFilter::kConfig}; diff --git a/src/mongo/db/serverless/shard_split_donor_service.h b/src/mongo/db/serverless/shard_split_donor_service.h index 669c50a9ac0..7bb0313f256 100644 --- a/src/mongo/db/serverless/shard_split_donor_service.h +++ b/src/mongo/db/serverless/shard_split_donor_service.h @@ -73,7 +73,7 @@ public: explicit ShardSplitDonorService(ServiceContext* const serviceContext) : PrimaryOnlyService(serviceContext), _serviceContext(serviceContext) {} - ~ShardSplitDonorService() = default; + ~ShardSplitDonorService() override = default; class DonorStateMachine; @@ -118,7 +118,7 @@ public: ShardSplitDonorService* serviceInstance, const ShardSplitDonorDocument& initialState); - ~DonorStateMachine() = default; + ~DonorStateMachine() override = default; /** * Try to abort this split operation. If the split operation is uninitialized, this will diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h index 023928364d6..39e56605278 100644 --- a/src/mongo/db/service_context.h +++ b/src/mongo/db/service_context.h @@ -467,7 +467,7 @@ public: static UniqueServiceContext make(); ServiceContext(); - ~ServiceContext(); + ~ServiceContext() override; /** * Registers an observer of lifecycle events on Clients created by this ServiceContext. @@ -896,7 +896,7 @@ public: using UniqueService = std::unique_ptr; using ConstructorActionRegisterer = ConstructorActionRegistererType; - ~Service(); + ~Service() override; /** * Creates a new Client object representing a client session associated with this diff --git a/src/mongo/db/service_context_d_test_fixture.h b/src/mongo/db/service_context_d_test_fixture.h index 595c4dd86bd..9659f76e062 100644 --- a/src/mongo/db/service_context_d_test_fixture.h +++ b/src/mongo/db/service_context_d_test_fixture.h @@ -133,7 +133,7 @@ protected: explicit ServiceContextMongoDTest(Options options = {}); - virtual ~ServiceContextMongoDTest(); + ~ServiceContextMongoDTest() override; void tearDown() override; diff --git a/src/mongo/db/service_entry_point_mongod.h b/src/mongo/db/service_entry_point_mongod.h index 598010263a6..af1a7d9c4a1 100644 --- a/src/mongo/db/service_entry_point_mongod.h +++ b/src/mongo/db/service_entry_point_mongod.h @@ -42,7 +42,7 @@ namespace mongo { class ServiceEntryPointMongod final : public ServiceEntryPointImpl { public: ServiceEntryPointMongod(); - ~ServiceEntryPointMongod(); + ~ServiceEntryPointMongod() override; Future handleRequest(OperationContext* opCtx, const Message& request) noexcept final; diff --git a/src/mongo/db/session/internal_transactions_reap_service.h b/src/mongo/db/session/internal_transactions_reap_service.h index b7a78128be0..5d07029ddf1 100644 --- a/src/mongo/db/session/internal_transactions_reap_service.h +++ b/src/mongo/db/session/internal_transactions_reap_service.h @@ -91,27 +91,26 @@ private: */ void _reapInternalTransactions(ServiceContext* service); - void onStartup(OperationContext* opCtx) override final; + void onStartup(OperationContext* opCtx) final; void onSetCurrentConfig(OperationContext* opCtx) final {} - void onShutdown() override final; + void onShutdown() final; - void onStepUpComplete(OperationContext* opCtx, long long term) override final { + void onStepUpComplete(OperationContext* opCtx, long long term) final { stdx::lock_guard lg(_mutex); _enabled = true; } - void onStepDown() override final { + void onStepDown() final { stdx::lock_guard lg(_mutex); _enabled = false; _lsidsToEagerlyReap.clear(); } - void onRollback() override final {} - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final {} - void onBecomeArbiter() override final {} - inline std::string getServiceName() const override final { + void onRollback() final {} + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final {} + void onBecomeArbiter() final {} + inline std::string getServiceName() const final { return "InternalTransactionsReapService"; } diff --git a/src/mongo/db/session/logical_session_cache_impl.h b/src/mongo/db/session/logical_session_cache_impl.h index 85ccd94f945..fffa4a10c08 100644 --- a/src/mongo/db/session/logical_session_cache_impl.h +++ b/src/mongo/db/session/logical_session_cache_impl.h @@ -80,7 +80,7 @@ public: LogicalSessionCacheImpl(const LogicalSessionCacheImpl&) = delete; LogicalSessionCacheImpl& operator=(const LogicalSessionCacheImpl&) = delete; - ~LogicalSessionCacheImpl(); + ~LogicalSessionCacheImpl() override; void joinOnShutDown() override; diff --git a/src/mongo/db/session/session.h b/src/mongo/db/session/session.h index 471d253aac4..7a915c10d05 100644 --- a/src/mongo/db/session/session.h +++ b/src/mongo/db/session/session.h @@ -50,7 +50,7 @@ class Session : public Decorable { public: explicit Session(LogicalSessionId sessionId) : _sessionId(std::move(sessionId)) {} - ~Session() { + ~Session() override { invariant(!_numWaitingToCheckOut); } diff --git a/src/mongo/db/session/session_catalog_mongod.h b/src/mongo/db/session/session_catalog_mongod.h index 4ee652a276c..028adb19581 100644 --- a/src/mongo/db/session/session_catalog_mongod.h +++ b/src/mongo/db/session/session_catalog_mongod.h @@ -219,7 +219,7 @@ class MongoDOperationContextSession : public MongoDSessionCatalog::Session { public: MongoDOperationContextSession(OperationContext* opCtx, MongoDSessionCatalogTransactionInterface* ti); - ~MongoDOperationContextSession(); + ~MongoDOperationContextSession() override; /** * This method takes an operation context with a checked-out session and allows it to be @@ -255,7 +255,7 @@ class MongoDOperationContextSessionWithoutRefresh : public MongoDSessionCatalog: public: MongoDOperationContextSessionWithoutRefresh(OperationContext* opCtx, MongoDSessionCatalogTransactionInterface* ti); - ~MongoDOperationContextSessionWithoutRefresh(); + ~MongoDOperationContextSessionWithoutRefresh() override; void checkIn(OperationContext* opCtx, OperationContextSession::CheckInReason reason) override { MONGO_UNREACHABLE; @@ -287,7 +287,7 @@ class MongoDOperationContextSessionWithoutOplogRead : public MongoDSessionCatalo public: MongoDOperationContextSessionWithoutOplogRead(OperationContext* opCtx, MongoDSessionCatalogTransactionInterface* ti); - ~MongoDOperationContextSessionWithoutOplogRead(); + ~MongoDOperationContextSessionWithoutOplogRead() override; void checkIn(OperationContext* opCtx, OperationContextSession::CheckInReason reason) override { MONGO_UNREACHABLE; diff --git a/src/mongo/db/set_change_stream_state_coordinator.h b/src/mongo/db/set_change_stream_state_coordinator.h index 246fd3ac256..516709eb196 100644 --- a/src/mongo/db/set_change_stream_state_coordinator.h +++ b/src/mongo/db/set_change_stream_state_coordinator.h @@ -71,7 +71,7 @@ public: private: ExecutorFuture _runImpl(std::shared_ptr executor, - const CancellationToken& token) noexcept; + const CancellationToken& token) noexcept override; void _removeStateDocument(OperationContext* opCtx) final; @@ -91,7 +91,7 @@ public: explicit SetChangeStreamStateCoordinatorService(ServiceContext* serviceContext) : repl::PrimaryOnlyService(serviceContext) {} - ~SetChangeStreamStateCoordinatorService() = default; + ~SetChangeStreamStateCoordinatorService() override = default; StringData getServiceName() const final; diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp index 62b2eea9f13..637c99575d3 100644 --- a/src/mongo/db/sorter/sorter.cpp +++ b/src/mongo/db/sorter/sorter.cpp @@ -186,13 +186,13 @@ public: InMemIterator(std::vector data) : _data(std::move(data)) {} - void openSource() {} - void closeSource() {} + void openSource() override {} + void closeSource() override {} - bool more() { + bool more() override { return _index < _data.size(); } - Data next() { + Data next() override { Data out = std::move(_data[_index]); _index++; return out; @@ -291,9 +291,9 @@ public: _afterReadChecksumCalculator(checksumVersion), _originalChecksum(checksum) {} - void openSource() {} + void openSource() override {} - void closeSource() { + void closeSource() override { // If the file iterator reads through all data objects, we can ensure non-corrupt data // by comparing the newly calculated checksum with the original checksum from the data // written to disk. Some iterators do not read back all data from the file, which prohibits @@ -308,14 +308,14 @@ public: } } - bool more() { + bool more() override { invariant(!_startOfNewData); if (!_done) _fillBufferIfNeeded(); // may change _done return !_done; } - Data next() { + Data next() override { Key deserializedKey = nextWithDeferredValue(); Value deserializedValue = getDeferredValue(); return Data(std::move(deserializedKey), std::move(deserializedValue)); @@ -355,7 +355,7 @@ public: tasserted(ErrorCodes::NotImplemented, "current() not implemented for FileIterator"); } - SorterRange getRange() const { + SorterRange getRange() const override { SorterRange range{ _fileStartOffset, _fileEndOffset, static_cast(_originalChecksum)}; if (_afterReadChecksumCalculator.version() != SorterChecksumVersion::v1) { @@ -527,13 +527,13 @@ public: _positioned = true; } - ~MergeIterator() { + ~MergeIterator() override { _current.reset(); _heap.clear(); } - void openSource() {} - void closeSource() {} + void openSource() override {} + void closeSource() override {} void addSource(std::shared_ptr iter) { iter->openSource(); @@ -552,7 +552,7 @@ public: } } - bool more() { + bool more() override { if (_remaining > 0 && (_positioned || !_heap.empty() || _current->more())) return true; @@ -571,7 +571,7 @@ public: return _current->current(); } - Data next() { + Data next() override { invariant(_remaining); _remaining--; @@ -867,7 +867,7 @@ public: }); } - Iterator* done() { + Iterator* done() override { invariant(!std::exchange(_done, true)); if (this->_iters.empty()) { @@ -927,7 +927,7 @@ private: } } - void spill() { + void spill() override { if (_data.empty()) return; @@ -1016,7 +1016,7 @@ public: }); } - Iterator* done() { + Iterator* done() override { if (_haveData) { if (this->_opts.moveSortedDataIntoIterator) { return new InMemIterator(std::move(_best)); @@ -1039,7 +1039,7 @@ public: void resume() override {} private: - void spill() { + void spill() override { invariant(false, "LimitOneSorter does not spill to disk"); } @@ -1142,7 +1142,7 @@ public: }); } - Iterator* done() { + Iterator* done() override { if (this->_iters.empty()) { sort(); if (this->_opts.moveSortedDataIntoIterator) { @@ -1278,7 +1278,7 @@ private: } } - void spill() { + void spill() override { invariant(!_done); if (_data.empty()) diff --git a/src/mongo/db/sorter/sorter.h b/src/mongo/db/sorter/sorter.h index 16a57f145de..6824804d3ac 100644 --- a/src/mongo/db/sorter/sorter.h +++ b/src/mongo/db/sorter/sorter.h @@ -548,37 +548,37 @@ public: // Feed one item of input to the sorter. // Together, add() and done() represent the input stream. - void add(Key key, Value value); + void add(Key key, Value value) override; // Indicate that no more input will arrive. // Together, add() and done() represent the input stream. - void done() { + void done() override { invariant(!_done); _done = true; } - void restart(); + void restart() override; // Together, state() and next() represent the output stream. // See BoundedSorter::State for the meaning of each case. using State = typename BoundedSorterInterface::State; - State getState() const; + State getState() const override; // Remove and return one item of output. // Only valid to call when getState() == kReady. // Together, state() and next() represent the output stream. - std::pair next(); + std::pair next() override; // Serialize the bound for explain output - Document serializeBound(const SerializationOptions& opts) const { + Document serializeBound(const SerializationOptions& opts) const override { return {makeBound.serialize(opts)}; }; - size_t limit() const { + size_t limit() const override { return _opts.limit; } - bool checkInput() const { + bool checkInput() const override { return _checkInput; } diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp index 559aaf59a0c..193732b4cf7 100644 --- a/src/mongo/db/sorter/sorter_test.cpp +++ b/src/mongo/db/sorter/sorter_test.cpp @@ -140,27 +140,27 @@ class IntIterator : public IWIterator { public: IntIterator(int start = 0, int stop = INT_MAX, int increment = 1) : _current(start), _increment(increment), _stop(stop) {} - void openSource() {} - void closeSource() {} - bool more() { + void openSource() override {} + void closeSource() override {} + bool more() override { if (_increment == 0) return true; if (_increment > 0) return _current < _stop; return _current > _stop; } - IWPair next() { + IWPair next() override { IWPair out(_current, -_current); _current += _increment; return out; } - IntWrapper nextWithDeferredValue() { + IntWrapper nextWithDeferredValue() override { MONGO_UNREACHABLE; } - IntWrapper getDeferredValue() { + IntWrapper getDeferredValue() override { MONGO_UNREACHABLE; } - const IntWrapper& current() { + const IntWrapper& current() override { MONGO_UNREACHABLE; } @@ -172,21 +172,21 @@ private: class EmptyIterator : public IWIterator { public: - void openSource() {} - void closeSource() {} - bool more() { + void openSource() override {} + void closeSource() override {} + bool more() override { return false; } - Data next() { + Data next() override { MONGO_UNREACHABLE; } - IntWrapper nextWithDeferredValue() { + IntWrapper nextWithDeferredValue() override { MONGO_UNREACHABLE; } - IntWrapper getDeferredValue() { + IntWrapper getDeferredValue() override { MONGO_UNREACHABLE; } - const IntWrapper& current() { + const IntWrapper& current() override { MONGO_UNREACHABLE; } }; @@ -198,24 +198,24 @@ public: invariant(limit > 0); } - void openSource() {} - void closeSource() {} + void openSource() override {} + void closeSource() override {} - bool more() { + bool more() override { return _remaining && _source->more(); } - Data next() { + Data next() override { invariant(more()); _remaining--; return _source->next(); } - IntWrapper nextWithDeferredValue() { + IntWrapper nextWithDeferredValue() override { MONGO_UNREACHABLE; } - IntWrapper getDeferredValue() { + IntWrapper getDeferredValue() override { MONGO_UNREACHABLE; } - const IntWrapper& current() { + const IntWrapper& current() override { MONGO_UNREACHABLE; } @@ -359,23 +359,23 @@ public: class UnsortedIter : public IWIterator { public: UnsortedIter() : _pos(0) {} - void openSource() {} - void closeSource() {} - bool more() { + void openSource() override {} + void closeSource() override {} + bool more() override { return _pos < sizeof(unsorted) / sizeof(unsorted[0]); } - IWPair next() { + IWPair next() override { IWPair ret(unsorted[_pos], -unsorted[_pos]); _pos++; return ret; } - IntWrapper nextWithDeferredValue() { + IntWrapper nextWithDeferredValue() override { MONGO_UNREACHABLE; } - IntWrapper getDeferredValue() { + IntWrapper getDeferredValue() override { MONGO_UNREACHABLE; } - const IntWrapper& current() { + const IntWrapper& current() override { MONGO_UNREACHABLE; } size_t _pos; @@ -719,17 +719,17 @@ class PauseAndResume : public Basic { sorter->resume(); } - size_t numAdded() const { + size_t numAdded() const override { return 5; } // returns an iterator with the correct results - std::shared_ptr correct() { + std::shared_ptr correct() override { return std::make_shared(0, 5); // 0, 1, ... 4 } // like correct but with opposite sort direction - std::shared_ptr correctReverse() { + std::shared_ptr correctReverse() override { return std::make_shared(4, -1, -1); // 4, 3, ... 0 } }; @@ -798,17 +798,17 @@ class PauseAndResumeLimit : public Limit { sorter->resume(); } - size_t numAdded() const { + size_t numAdded() const override { return 6; } // returns an iterator with the correct results - std::shared_ptr correct() { + std::shared_ptr correct() override { return std::make_shared(-1, 4); } // like correct but with opposite sort direction - std::shared_ptr correctReverse() { + std::shared_ptr correctReverse() override { return std::make_shared(4, -1, -1); } }; @@ -838,17 +838,17 @@ class PauseAndResumeLimitOne : public Limit { sorter->resume(); } - size_t numAdded() const { + size_t numAdded() const override { return 6; } // returns an iterator with the correct results - std::shared_ptr correct() { + std::shared_ptr correct() override { return std::make_shared(-1, 0); } // like correct but with opposite sort direction - std::shared_ptr correctReverse() { + std::shared_ptr correctReverse() override { return std::make_shared(4, 3, -1); } }; @@ -950,7 +950,7 @@ public: template class LotsOfDataWithLimit : public LotsOfDataLittleMemory { typedef LotsOfDataLittleMemory Parent; - SortOptions adjustSortOptions(SortOptions opts) { + SortOptions adjustSortOptions(SortOptions opts) override { // Make sure our tests will spill or not as desired MONGO_STATIC_ASSERT(MEM_LIMIT / 2 > (100 * sizeof(IWPair))); MONGO_STATIC_ASSERT(MEM_LIMIT < (5000 * sizeof(IWPair))); diff --git a/src/mongo/db/stats/api_version_metrics_test.cpp b/src/mongo/db/stats/api_version_metrics_test.cpp index 041d1d6d95c..bf0750f41ff 100644 --- a/src/mongo/db/stats/api_version_metrics_test.cpp +++ b/src/mongo/db/stats/api_version_metrics_test.cpp @@ -50,7 +50,7 @@ namespace { class APIVersionMetricsTest : public ServiceContextTest { public: - virtual void setUp() { + void setUp() override { apiParams = APIParameters(); // The fast clock is used by OperationContext::hasDeadlineExpired. @@ -61,7 +61,7 @@ public: std::make_unique(_clkSource)); } - virtual void tearDown() {} + void tearDown() override {} protected: /** diff --git a/src/mongo/db/stats/resource_consumption_metrics_test.cpp b/src/mongo/db/stats/resource_consumption_metrics_test.cpp index 374f32754c9..de1bd8c6f69 100644 --- a/src/mongo/db/stats/resource_consumption_metrics_test.cpp +++ b/src/mongo/db/stats/resource_consumption_metrics_test.cpp @@ -60,7 +60,7 @@ ServerParameter* getServerParameter(const std::string& name) { class ResourceConsumptionMetricsTest : public ServiceContextTest { public: - void setUp() { + void setUp() override { _opCtx = makeOperationContext(); gAggregateOperationResourceConsumptionMetrics = true; gDocumentUnitSizeBytes = 128; diff --git a/src/mongo/db/storage/collection_truncate_markers.h b/src/mongo/db/storage/collection_truncate_markers.h index b5c1216260a..da3678c4a3e 100644 --- a/src/mongo/db/storage/collection_truncate_markers.h +++ b/src/mongo/db/storage/collection_truncate_markers.h @@ -359,11 +359,11 @@ public: // the partial marker and whether the implementation's '_hasPartialMarkerExpired' returns true. void createPartialMarkerIfNecessary(OperationContext* opCtx); - virtual void updateCurrentMarkerAfterInsertOnCommit(OperationContext* opCtx, - int64_t bytesInserted, - const RecordId& highestInsertedRecordId, - Date_t wallTime, - int64_t countInserted) final; + void updateCurrentMarkerAfterInsertOnCommit(OperationContext* opCtx, + int64_t bytesInserted, + const RecordId& highestInsertedRecordId, + Date_t wallTime, + int64_t countInserted) final; std::pair getPartialMarker_forTest() const { return {_lastHighestRecordId, _lastHighestWallTime}; @@ -415,7 +415,7 @@ public: reset(opCtx); } - virtual boost::optional> getNext() final { + boost::optional> getNext() final { auto record = _directionalCursor->next(); if (!record) { return boost::none; @@ -423,7 +423,7 @@ public: return std::make_pair(std::move(record->id), record->data.releaseToBson()); } - virtual boost::optional> getNextRandom() final { + boost::optional> getNextRandom() final { auto record = _randomCursor->next(); if (!record) { return boost::none; @@ -431,11 +431,11 @@ public: return std::make_pair(std::move(record->id), record->data.releaseToBson()); } - virtual RecordStore* getRecordStore() const final { + RecordStore* getRecordStore() const final { return _rs; } - virtual void reset(OperationContext* opCtx) final { + void reset(OperationContext* opCtx) final { _directionalCursor = _rs->getCursor(opCtx); _randomCursor = _rs->getRandomCursor(opCtx); } @@ -456,7 +456,7 @@ public: reset(opCtx); } - virtual boost::optional> getNext() final { + boost::optional> getNext() final { RecordId rId; BSONObj doc; if (_collScanExecutor->getNext(&doc, &rId) == PlanExecutor::IS_EOF) { @@ -465,7 +465,7 @@ public: return std::make_pair(std::move(rId), std::move(doc)); } - virtual boost::optional> getNextRandom() final { + boost::optional> getNextRandom() final { RecordId rId; BSONObj doc; if (_sampleExecutor->getNext(&doc, &rId) == PlanExecutor::IS_EOF) { @@ -474,11 +474,11 @@ public: return std::make_pair(std::move(rId), std::move(doc)); } - virtual RecordStore* getRecordStore() const final { + RecordStore* getRecordStore() const final { return _collection.getCollectionPtr()->getRecordStore(); } - virtual void reset(OperationContext* opCtx) final { + void reset(OperationContext* opCtx) final { _collScanExecutor = InternalPlanner::collectionScan(opCtx, _collection, diff --git a/src/mongo/db/storage/collection_truncate_markers_test.cpp b/src/mongo/db/storage/collection_truncate_markers_test.cpp index 4b3b4a2c958..77c30844b06 100644 --- a/src/mongo/db/storage/collection_truncate_markers_test.cpp +++ b/src/mongo/db/storage/collection_truncate_markers_test.cpp @@ -159,13 +159,13 @@ public: private: bool _expirePartialMarker = false; - virtual bool _hasExcessMarkers(OperationContext* opCtx) const override { + bool _hasExcessMarkers(OperationContext* opCtx) const override { return !getMarkers().empty(); } - virtual bool _hasPartialMarkerExpired(OperationContext* opCtx, - const RecordId& highestSeenRecordId, - const Date_t& highestSeenWallTime) const override { + bool _hasPartialMarkerExpired(OperationContext* opCtx, + const RecordId& highestSeenRecordId, + const Date_t& highestSeenWallTime) const override { return _expirePartialMarker; } }; @@ -186,7 +186,7 @@ public: std::move(markers), leftoverRecordsCount, leftoverRecordsBytes, minBytesPerMarker){}; private: - virtual bool _hasExcessMarkers(OperationContext* opCtx) const override { + bool _hasExcessMarkers(OperationContext* opCtx) const override { return !getMarkers().empty(); } }; diff --git a/src/mongo/db/storage/control/journal_flusher.h b/src/mongo/db/storage/control/journal_flusher.h index 81a7aa63916..12f199b9500 100644 --- a/src/mongo/db/storage/control/journal_flusher.h +++ b/src/mongo/db/storage/control/journal_flusher.h @@ -77,7 +77,7 @@ public: static JournalFlusher* get(OperationContext* opCtx); static void set(ServiceContext* serviceCtx, std::unique_ptr journalFlusher); - std::string name() const { + std::string name() const override { return "JournalFlusher"; } @@ -85,7 +85,7 @@ public: * Runs data flushes every 'storageGlobalParams.journalCommitIntervalMs' millis (unless * '_disablePeriodicFlushes' is set) or immediately if waitForJournalFlush() is called. */ - void run(); + void run() override; /** * Signals the thread to quit and then waits until it does. The given 'reason' is returned to diff --git a/src/mongo/db/storage/deferred_drop_record_store.h b/src/mongo/db/storage/deferred_drop_record_store.h index c8a9f7cf049..c45e9cde57e 100644 --- a/src/mongo/db/storage/deferred_drop_record_store.h +++ b/src/mongo/db/storage/deferred_drop_record_store.h @@ -45,7 +45,7 @@ class DeferredDropRecordStore : public TemporaryRecordStore { public: DeferredDropRecordStore(std::unique_ptr rs, StorageEngine* storageEngine) : TemporaryRecordStore(std::move(rs)), _storageEngine(storageEngine){}; - ~DeferredDropRecordStore(); + ~DeferredDropRecordStore() override; protected: StorageEngine* _storageEngine; diff --git a/src/mongo/db/storage/devnull/devnull_init.cpp b/src/mongo/db/storage/devnull/devnull_init.cpp index 237343d5e43..cbc44c9e515 100644 --- a/src/mongo/db/storage/devnull/devnull_init.cpp +++ b/src/mongo/db/storage/devnull/devnull_init.cpp @@ -48,9 +48,9 @@ namespace mongo { namespace { class DevNullStorageEngineFactory : public StorageEngine::Factory { public: - virtual std::unique_ptr create(OperationContext* opCtx, - const StorageGlobalParams& params, - const StorageEngineLockFile* lockFile) const { + std::unique_ptr create(OperationContext* opCtx, + const StorageGlobalParams& params, + const StorageEngineLockFile* lockFile) const override { StorageEngineOptions options; options.directoryPerDB = params.directoryperdb; options.forRepair = params.repair; @@ -60,16 +60,16 @@ public: opCtx, std::make_unique(), options); } - virtual StringData getCanonicalName() const { + StringData getCanonicalName() const override { return "devnull"; } - virtual Status validateMetadata(const StorageEngineMetadata& metadata, - const StorageGlobalParams& params) const { + Status validateMetadata(const StorageEngineMetadata& metadata, + const StorageGlobalParams& params) const override { return Status::OK(); } - virtual BSONObj createMetadataOptions(const StorageGlobalParams& params) const { + BSONObj createMetadataOptions(const StorageGlobalParams& params) const override { return BSONObj(); } }; diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp index a60866a802d..2b94792bcd9 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp @@ -61,7 +61,7 @@ public: boost::optional next() final { return {}; } - boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) { + boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) override { return {}; } boost::optional seekExact(const RecordId& id) final { @@ -91,19 +91,19 @@ public: _dummy = BSON("_id" << 1); } - virtual const char* name() const { + const char* name() const override { return "devnull"; } - virtual NamespaceString ns(OperationContext* opCtx) const override { + NamespaceString ns(OperationContext* opCtx) const override { return _ns; } - virtual long long dataSize(OperationContext* opCtx) const { + long long dataSize(OperationContext* opCtx) const override { return 0; } - virtual long long numRecords(OperationContext* opCtx) const { + long long numRecords(OperationContext* opCtx) const override { return 0; } @@ -111,17 +111,17 @@ public: return _options.capped; } - virtual KeyFormat keyFormat() const { + KeyFormat keyFormat() const override { return _keyFormat; } - virtual int64_t storageSize(OperationContext* opCtx, - BSONObjBuilder* extraInfo = nullptr, - int infoLevel = 0) const { + int64_t storageSize(OperationContext* opCtx, + BSONObjBuilder* extraInfo = nullptr, + int infoLevel = 0) const override { return 0; } - virtual bool findRecord(OperationContext* opCtx, const RecordId& loc, RecordData* rd) const { + bool findRecord(OperationContext* opCtx, const RecordId& loc, RecordData* rd) const override { return false; } @@ -144,7 +144,7 @@ public: return Status::OK(); } - virtual bool updateWithDamagesSupported() const { + bool updateWithDamagesSupported() const override { return false; } @@ -156,9 +156,9 @@ public: MONGO_UNREACHABLE; } - virtual void printRecordMetadata(OperationContext* opCtx, - const RecordId& recordId, - std::set* recordTimestamps) const { + void printRecordMetadata(OperationContext* opCtx, + const RecordId& recordId, + std::set* recordTimestamps) const override { MONGO_UNREACHABLE; } @@ -184,23 +184,23 @@ public: bool inclusive, const AboutToDeleteRecordCallback& aboutToDelete) override {} - virtual void appendNumericCustomStats(OperationContext* opCtx, - BSONObjBuilder* result, - double scale) const { + void appendNumericCustomStats(OperationContext* opCtx, + BSONObjBuilder* result, + double scale) const override { result->appendNumber("numInserts", _numInserts); } - virtual void updateStatsAfterRepair(OperationContext* opCtx, - long long numRecords, - long long dataSize) {} + void updateStatsAfterRepair(OperationContext* opCtx, + long long numRecords, + long long dataSize) override {} RecordId getLargestKey(OperationContext* opCtx) const final { return RecordId(); } - virtual void reserveRecordIds(OperationContext* opCtx, - std::vector* out, - size_t nRecords) final { + void reserveRecordIds(OperationContext* opCtx, + std::vector* out, + size_t nRecords) final { for (size_t i = 0; i < nRecords; i++) { out->push_back(RecordId(i)); } @@ -224,7 +224,7 @@ class DevNullSortedDataBuilderInterface : public SortedDataBuilderInterface { public: DevNullSortedDataBuilderInterface() {} - virtual Status addKey(const key_string::Value& keyString) { + Status addKey(const key_string::Value& keyString) override { return Status::OK(); } }; @@ -237,68 +237,68 @@ public: Ordering::make(BSONObj()), KeyFormat::Long) {} - virtual ~DevNullSortedDataInterface() {} + ~DevNullSortedDataInterface() override {} - virtual std::unique_ptr makeBulkBuilder(OperationContext* opCtx, - bool dupsAllowed) { + std::unique_ptr makeBulkBuilder(OperationContext* opCtx, + bool dupsAllowed) override { return {}; } - virtual Status insert(OperationContext* opCtx, - const key_string::Value& keyString, - bool dupsAllowed, - IncludeDuplicateRecordId includeDuplicateRecordId) { + Status insert(OperationContext* opCtx, + const key_string::Value& keyString, + bool dupsAllowed, + IncludeDuplicateRecordId includeDuplicateRecordId) override { return Status::OK(); } - virtual void unindex(OperationContext* opCtx, - const key_string::Value& keyString, - bool dupsAllowed) {} + void unindex(OperationContext* opCtx, + const key_string::Value& keyString, + bool dupsAllowed) override {} - virtual Status dupKeyCheck(OperationContext* opCtx, const key_string::Value& keyString) { + Status dupKeyCheck(OperationContext* opCtx, const key_string::Value& keyString) override { return Status::OK(); } - virtual boost::optional findLoc(OperationContext* opCtx, - const key_string::Value& keyString) const override { + boost::optional findLoc(OperationContext* opCtx, + const key_string::Value& keyString) const override { return boost::none; } - virtual IndexValidateResults validate(OperationContext* opCtx, bool full) const { + IndexValidateResults validate(OperationContext* opCtx, bool full) const override { return IndexValidateResults{}; } - virtual bool appendCustomStats(OperationContext* opCtx, - BSONObjBuilder* output, - double scale) const { + bool appendCustomStats(OperationContext* opCtx, + BSONObjBuilder* output, + double scale) const override { return false; } - virtual long long getSpaceUsedBytes(OperationContext* opCtx) const { + long long getSpaceUsedBytes(OperationContext* opCtx) const override { return 0; } - virtual long long getFreeStorageBytes(OperationContext* opCtx) const { + long long getFreeStorageBytes(OperationContext* opCtx) const override { return 0; } - virtual bool isEmpty(OperationContext* opCtx) { + bool isEmpty(OperationContext* opCtx) override { return true; } - virtual int64_t numEntries(OperationContext* opCtx) const { + int64_t numEntries(OperationContext* opCtx) const override { return 0; } - virtual void printIndexEntryMetadata(OperationContext* opCtx, - const key_string::Value& keyString) const {} + void printIndexEntryMetadata(OperationContext* opCtx, + const key_string::Value& keyString) const override {} - virtual std::unique_ptr newCursor(OperationContext* opCtx, - bool isForward) const { + std::unique_ptr newCursor(OperationContext* opCtx, + bool isForward) const override { return {}; } - virtual Status initAsEmpty(OperationContext* opCtx) { + Status initAsEmpty(OperationContext* opCtx) override { return Status::OK(); } }; @@ -362,17 +362,17 @@ public: _exhaustCursor = false; }; - ~StreamingCursorImpl() = default; + ~StreamingCursorImpl() override = default; BSONObj getMetadataObject(UUID backupId) { return BSONObj(); } - void setCatalogEntries( - stdx::unordered_map> identsToNsAndUUID) {} + void setCatalogEntries(stdx::unordered_map> + identsToNsAndUUID) override {} StatusWith> getNextBatch(OperationContext* opCtx, - const std::size_t batchSize) { + const std::size_t batchSize) override { if (_exhaustCursor) { std::deque emptyVector; return emptyVector; diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.h b/src/mongo/db/storage/devnull/devnull_kv_engine.h index bab1683a4d4..8a63fda5c6f 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.h +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.h @@ -155,7 +155,7 @@ public: return true; } - std::vector getAllIdents(OperationContext* opCtx) const { + std::vector getAllIdents(OperationContext* opCtx) const override { return std::vector(); } diff --git a/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp b/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp index cdc17a2d5ae..e4f1a4afb33 100644 --- a/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp +++ b/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp @@ -66,8 +66,8 @@ public: RemoveChange(Data* data, RecordId loc, const EphemeralForTestRecord& rec) : _data(data), _loc(loc), _rec(rec) {} - virtual void commit(OperationContext* opCtx, boost::optional) {} - virtual void rollback(OperationContext* opCtx) { + void commit(OperationContext* opCtx, boost::optional) override {} + void rollback(OperationContext* opCtx) override { stdx::lock_guard lock(_data->recordsMutex); Records::iterator it = _data->records.find(_loc); @@ -103,8 +103,8 @@ public: _data->dataSize -= _dataSize; } - virtual void commit(OperationContext* opCtx, boost::optional) {} - virtual void rollback(OperationContext* opCtx) { + void commit(OperationContext* opCtx, boost::optional) override {} + void rollback(OperationContext* opCtx) override { using std::swap; stdx::lock_guard lock(_data->recordsMutex); @@ -138,7 +138,7 @@ public: return {{_it->first, _it->second.toRecordData()}}; } - boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) { + boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) override { // not implemented return {}; } @@ -211,7 +211,7 @@ public: return {{_it->first, _it->second.toRecordData()}}; } - boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) { + boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) override { // not implemented return {}; } diff --git a/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.h b/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.h index df3f444105e..49336abfd69 100644 --- a/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.h +++ b/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.h @@ -71,15 +71,15 @@ public: std::shared_ptr* dataInOut, bool isCapped = false); - virtual const char* name() const; + const char* name() const override; - virtual KeyFormat keyFormat() const { + KeyFormat keyFormat() const override { return KeyFormat::Long; } virtual RecordData dataFor(OperationContext* opCtx, const RecordId& loc) const; - virtual bool findRecord(OperationContext* opCtx, const RecordId& loc, RecordData* rd) const; + bool findRecord(OperationContext* opCtx, const RecordId& loc, RecordData* rd) const override; void doDeleteRecord(OperationContext* opCtx, const RecordId& dl) override; @@ -92,7 +92,7 @@ public: const char* data, int len) override; - virtual bool updateWithDamagesSupported() const; + bool updateWithDamagesSupported() const override; StatusWith doUpdateWithDamages(OperationContext* opCtx, const RecordId& loc, @@ -100,9 +100,9 @@ public: const char* damageSource, const mutablebson::DamageVector& damages) override; - virtual void printRecordMetadata(OperationContext* opCtx, - const RecordId& recordId, - std::set* recordTimestamps) const {} + void printRecordMetadata(OperationContext* opCtx, + const RecordId& recordId, + std::set* recordTimestamps) const override {} std::unique_ptr getCursor(OperationContext* opCtx, bool forward) const final; @@ -119,25 +119,25 @@ public: bool inclusive, const AboutToDeleteRecordCallback& aboutToDelete) override; - virtual void appendNumericCustomStats(OperationContext* opCtx, - BSONObjBuilder* result, - double scale) const {} + void appendNumericCustomStats(OperationContext* opCtx, + BSONObjBuilder* result, + double scale) const override {} - virtual int64_t storageSize(OperationContext* opCtx, - BSONObjBuilder* extraInfo = nullptr, - int infoLevel = 0) const; + int64_t storageSize(OperationContext* opCtx, + BSONObjBuilder* extraInfo = nullptr, + int infoLevel = 0) const override; - virtual long long dataSize(OperationContext* opCtx) const { + long long dataSize(OperationContext* opCtx) const override { return _data->dataSize; } - virtual long long numRecords(OperationContext* opCtx) const { + long long numRecords(OperationContext* opCtx) const override { return _data->records.size(); } - virtual void updateStatsAfterRepair(OperationContext* opCtx, - long long numRecords, - long long dataSize) { + void updateStatsAfterRepair(OperationContext* opCtx, + long long numRecords, + long long dataSize) override { stdx::lock_guard lock(_data->recordsMutex); invariant(_data->records.size() == size_t(numRecords)); _data->dataSize = dataSize; @@ -148,9 +148,9 @@ public: return RecordId(_data->nextId - 1); } - virtual void reserveRecordIds(OperationContext* opCtx, - std::vector* out, - size_t nRecords) final{}; + void reserveRecordIds(OperationContext* opCtx, + std::vector* out, + size_t nRecords) final{}; NamespaceString ns(OperationContext* opCtx) const final { return _data->ns; diff --git a/src/mongo/db/storage/durable_catalog.cpp b/src/mongo/db/storage/durable_catalog.cpp index 51eb6015ca2..169353b9abd 100644 --- a/src/mongo/db/storage/durable_catalog.cpp +++ b/src/mongo/db/storage/durable_catalog.cpp @@ -134,8 +134,8 @@ public: AddIdentChange(DurableCatalog* catalog, RecordId catalogId) : _catalog(catalog), _catalogId(std::move(catalogId)) {} - void commit(OperationContext* opCtx, boost::optional) {} - void rollback(OperationContext* opCtx) { + void commit(OperationContext* opCtx, boost::optional) override {} + void rollback(OperationContext* opCtx) override { stdx::lock_guard lk(_catalog->_catalogIdToEntryMapLock); _catalog->_catalogIdToEntryMap.erase(_catalogId); } diff --git a/src/mongo/db/storage/external_record_store.h b/src/mongo/db/storage/external_record_store.h index b0af472b352..418e3d0fc64 100644 --- a/src/mongo/db/storage/external_record_store.h +++ b/src/mongo/db/storage/external_record_store.h @@ -64,7 +64,7 @@ public: return _vopts; } - const char* name() const { + const char* name() const override { return "external"; } diff --git a/src/mongo/db/storage/flow_control_test.cpp b/src/mongo/db/storage/flow_control_test.cpp index 4e2842e79a1..0640c81c240 100644 --- a/src/mongo/db/storage/flow_control_test.cpp +++ b/src/mongo/db/storage/flow_control_test.cpp @@ -53,7 +53,7 @@ namespace mongo { class FlowControlTest : public ServiceContextMongoDTest { public: - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); auto replCoord = std::make_unique(getServiceContext()); @@ -72,7 +72,7 @@ public: opCtx = client->makeOperationContext(); } - void tearDown() { + void tearDown() override { ServiceContextMongoDTest::tearDown(); } diff --git a/src/mongo/db/storage/key_string.h b/src/mongo/db/storage/key_string.h index 708a3db08ed..461a546ff49 100644 --- a/src/mongo/db/storage/key_string.h +++ b/src/mongo/db/storage/key_string.h @@ -280,7 +280,7 @@ public: * Passed in TypeBits must outlive this Reader instance. */ explicit Reader(const TypeBits& typeBits) : _curBit(0), _typeBits(typeBits) {} - ~Reader() = default; + ~Reader() override = default; uint8_t readStringLike() final; uint8_t readNumeric() final; @@ -308,7 +308,7 @@ public: class ExplainReader : public ReaderBase { public: explicit ExplainReader(ReaderBase& reader) : _reader(reader){}; - ~ExplainReader() = default; + ~ExplainReader() override = default; uint8_t readStringLike() final; uint8_t readNumeric() final; diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp index 4f5f9da72d7..26dde1a22d0 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp @@ -168,11 +168,11 @@ public: return Timestamp(); } - boost::optional getRecoveryTimestamp() const { + boost::optional getRecoveryTimestamp() const override { return boost::none; } - void setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp) {} + void setPinnedOplogTimestamp(const Timestamp& pinnedTimestamp) override {} void dump() const override {} diff --git a/src/mongo/db/storage/kv/storage_engine_test.cpp b/src/mongo/db/storage/kv/storage_engine_test.cpp index 5a959688469..a1db683297e 100644 --- a/src/mongo/db/storage/kv/storage_engine_test.cpp +++ b/src/mongo/db/storage/kv/storage_engine_test.cpp @@ -266,7 +266,7 @@ TEST_F(StorageEngineTest, TemporaryRecordStoreDoesNotTrackSizeAdjustments) { class StorageEngineTimestampMonitorTest : public StorageEngineTest { public: - void setUp() { + void setUp() override { StorageEngineTest::setUp(); _storageEngine->startTimestampMonitor(); } @@ -611,15 +611,15 @@ public: } // Increment the timestamps each time they are called for testing purposes. - virtual Timestamp getCheckpointTimestamp() const override { + Timestamp getCheckpointTimestamp() const override { checkpointTimestamp = std::make_unique(checkpointTimestamp->getInc() + 1); return *checkpointTimestamp; } - virtual Timestamp getOldestTimestamp() const override { + Timestamp getOldestTimestamp() const override { oldestTimestamp = std::make_unique(oldestTimestamp->getInc() + 1); return *oldestTimestamp; } - virtual Timestamp getStableTimestamp() const override { + Timestamp getStableTimestamp() const override { stableTimestamp = std::make_unique(stableTimestamp->getInc() + 1); return *stableTimestamp; } @@ -638,7 +638,7 @@ public: /** * Create an instance of the KV Storage Engine so that we have a timestamp monitor operating. */ - void setUp() { + void setUp() override { ServiceContextTest::setUp(); auto opCtx = makeOperationContext(); @@ -655,7 +655,7 @@ public: _storageEngine->startTimestampMonitor(); } - void tearDown() { + void tearDown() override { _storageEngine->cleanShutdown(getServiceContext()); _storageEngine.reset(); diff --git a/src/mongo/db/storage/multi_bson_stream_cursor.h b/src/mongo/db/storage/multi_bson_stream_cursor.h index 0b89de61f84..6f47e7fdad9 100644 --- a/src/mongo/db/storage/multi_bson_stream_cursor.h +++ b/src/mongo/db/storage/multi_bson_stream_cursor.h @@ -71,13 +71,13 @@ public: void setSaveStorageCursorOnDetachFromOperationContext(bool) override {} // Seeking is not currently supported. - boost::optional seekExact(const RecordId& id) { + boost::optional seekExact(const RecordId& id) override { tasserted(6968300, "MultiBsonStreamCursor::seekExact is not supported"); return boost::none; } // Seeking is not currently supported. - boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) { + boost::optional seek(const RecordId& start, BoundInclusion boundInclusion) override { tasserted(6968320, "MultiBsonStreamCursor::seek is not supported"); return {}; } diff --git a/src/mongo/db/storage/oplog_cap_maintainer_thread.h b/src/mongo/db/storage/oplog_cap_maintainer_thread.h index f742f5f4181..f1df30cfbd1 100644 --- a/src/mongo/db/storage/oplog_cap_maintainer_thread.h +++ b/src/mongo/db/storage/oplog_cap_maintainer_thread.h @@ -46,11 +46,11 @@ public: static OplogCapMaintainerThread* get(ServiceContext* serviceCtx); - virtual std::string name() const { + std::string name() const override { return _name; } - virtual void run(); + void run() override; /** * Waits until the maintainer thread finishes. diff --git a/src/mongo/db/storage/recovery_unit_test_harness.h b/src/mongo/db/storage/recovery_unit_test_harness.h index fdd22da772e..38ab5044d6b 100644 --- a/src/mongo/db/storage/recovery_unit_test_harness.h +++ b/src/mongo/db/storage/recovery_unit_test_harness.h @@ -44,7 +44,7 @@ class RecordStore; class RecoveryUnitHarnessHelper : public HarnessHelper { public: - virtual std::unique_ptr newRecoveryUnit() = 0; + std::unique_ptr newRecoveryUnit() override = 0; virtual std::unique_ptr createRecordStore(OperationContext* opCtx, const std::string& ns) = 0; }; diff --git a/src/mongo/db/storage/storage_engine_impl.h b/src/mongo/db/storage/storage_engine_impl.h index 519f0ce7a24..d453d12582a 100644 --- a/src/mongo/db/storage/storage_engine_impl.h +++ b/src/mongo/db/storage/storage_engine_impl.h @@ -88,86 +88,85 @@ public: std::unique_ptr engine, StorageEngineOptions options = StorageEngineOptions()); - virtual ~StorageEngineImpl(); + ~StorageEngineImpl() override; - virtual void notifyStorageStartupRecoveryComplete() override; + void notifyStorageStartupRecoveryComplete() override; - virtual void notifyReplStartupRecoveryComplete(OperationContext* opCtx) override; + void notifyReplStartupRecoveryComplete(OperationContext* opCtx) override; - virtual RecoveryUnit* newRecoveryUnit() override; + RecoveryUnit* newRecoveryUnit() override; - virtual std::vector listDatabases( + std::vector listDatabases( boost::optional tenantId = boost::none) const override; - virtual bool supportsCappedCollections() const override { + bool supportsCappedCollections() const override { return _supportsCappedCollections; } - virtual Status dropDatabase(OperationContext* opCtx, const DatabaseName& dbName) override; + Status dropDatabase(OperationContext* opCtx, const DatabaseName& dbName) override; - virtual void flushAllFiles(OperationContext* opCtx, bool callerHoldsReadLock) override; + void flushAllFiles(OperationContext* opCtx, bool callerHoldsReadLock) override; - virtual Status beginBackup(OperationContext* opCtx) override; + Status beginBackup(OperationContext* opCtx) override; - virtual void endBackup(OperationContext* opCtx) override; + void endBackup(OperationContext* opCtx) override; - virtual Status disableIncrementalBackup(OperationContext* opCtx) override; + Status disableIncrementalBackup(OperationContext* opCtx) override; - virtual StatusWith> beginNonBlockingBackup( + StatusWith> beginNonBlockingBackup( OperationContext* opCtx, const BackupOptions& options) override; - virtual void endNonBlockingBackup(OperationContext* opCtx) override; + void endNonBlockingBackup(OperationContext* opCtx) override; - virtual StatusWith> extendBackupCursor( - OperationContext* opCtx) override; + StatusWith> extendBackupCursor(OperationContext* opCtx) override; - virtual bool supportsCheckpoints() const override; + bool supportsCheckpoints() const override; - virtual bool isEphemeral() const override; + bool isEphemeral() const override; - virtual Status repairRecordStore(OperationContext* opCtx, - RecordId catalogId, - const NamespaceString& nss) override; + Status repairRecordStore(OperationContext* opCtx, + RecordId catalogId, + const NamespaceString& nss) override; - virtual std::unique_ptr makeTemporaryRecordStore( + std::unique_ptr makeTemporaryRecordStore(OperationContext* opCtx, + KeyFormat keyFormat) override; + + std::unique_ptr makeTemporaryRecordStoreForResumableIndexBuild( OperationContext* opCtx, KeyFormat keyFormat) override; - virtual std::unique_ptr makeTemporaryRecordStoreForResumableIndexBuild( - OperationContext* opCtx, KeyFormat keyFormat) override; - - virtual std::unique_ptr makeTemporaryRecordStoreFromExistingIdent( + std::unique_ptr makeTemporaryRecordStoreFromExistingIdent( OperationContext* opCtx, StringData ident, KeyFormat keyFormat) override; - virtual void cleanShutdown(ServiceContext* svcCtx) override; + void cleanShutdown(ServiceContext* svcCtx) override; - virtual void setStableTimestamp(Timestamp stableTimestamp, bool force = false) override; + void setStableTimestamp(Timestamp stableTimestamp, bool force = false) override; - virtual Timestamp getStableTimestamp() const override; + Timestamp getStableTimestamp() const override; - virtual void setInitialDataTimestamp(Timestamp initialDataTimestamp) override; + void setInitialDataTimestamp(Timestamp initialDataTimestamp) override; - virtual Timestamp getInitialDataTimestamp() const override; + Timestamp getInitialDataTimestamp() const override; - virtual void setOldestTimestampFromStable() override; + void setOldestTimestampFromStable() override; - virtual void setOldestTimestamp(Timestamp newOldestTimestamp, bool force) override; + void setOldestTimestamp(Timestamp newOldestTimestamp, bool force) override; - virtual Timestamp getOldestTimestamp() const override; + Timestamp getOldestTimestamp() const override; - virtual void setOldestActiveTransactionTimestampCallback( + void setOldestActiveTransactionTimestampCallback( StorageEngine::OldestActiveTransactionTimestampCallback) override; - virtual bool supportsRecoverToStableTimestamp() const override; + bool supportsRecoverToStableTimestamp() const override; - virtual bool supportsRecoveryTimestamp() const override; + bool supportsRecoveryTimestamp() const override; - virtual StatusWith recoverToStableTimestamp(OperationContext* opCtx) override; + StatusWith recoverToStableTimestamp(OperationContext* opCtx) override; - virtual boost::optional getRecoveryTimestamp() const override; + boost::optional getRecoveryTimestamp() const override; - virtual boost::optional getLastStableRecoveryTimestamp() const override; + boost::optional getLastStableRecoveryTimestamp() const override; - virtual Timestamp getAllDurableTimestamp() const override; + Timestamp getAllDurableTimestamp() const override; boost::optional getOplogNeededForCrashRecovery() const final; @@ -350,7 +349,7 @@ public: StorageEngine::CheckpointIteration getCheckpointIteration() const override; - virtual bool hasDataBeenCheckpointed( + bool hasDataBeenCheckpointed( StorageEngine::CheckpointIteration checkpointIteration) const override; StatusWith reconcileCatalogAndIdents( @@ -407,7 +406,7 @@ public: void dump() const override; - virtual Status autoCompact(OperationContext* opCtx, const AutoCompactOptions& options) override; + Status autoCompact(OperationContext* opCtx, const AutoCompactOptions& options) override; private: using CollIter = std::list::iterator; diff --git a/src/mongo/db/storage/storage_engine_mock.h b/src/mongo/db/storage/storage_engine_mock.h index ed48aaf098c..917a949b44b 100644 --- a/src/mongo/db/storage/storage_engine_mock.h +++ b/src/mongo/db/storage/storage_engine_mock.h @@ -66,7 +66,7 @@ public: "The current storage engine doesn't support backup mode"); } void endBackup(OperationContext* opCtx) final {} - Status disableIncrementalBackup(OperationContext* opCtx) { + Status disableIncrementalBackup(OperationContext* opCtx) override { return Status(ErrorCodes::CommandNotSupported, "The current storage engine doesn't support backup mode"); } @@ -184,7 +184,8 @@ public: return StorageEngine::CheckpointIteration{0}; } - bool hasDataBeenCheckpointed(StorageEngine::CheckpointIteration checkpointIteration) const { + bool hasDataBeenCheckpointed( + StorageEngine::CheckpointIteration checkpointIteration) const override { return false; } diff --git a/src/mongo/db/storage/storage_engine_test_fixture.h b/src/mongo/db/storage/storage_engine_test_fixture.h index 591f2bd86e4..d7628d75788 100644 --- a/src/mongo/db/storage/storage_engine_test_fixture.h +++ b/src/mongo/db/storage/storage_engine_test_fixture.h @@ -213,7 +213,7 @@ public: std::make_unique()); } - void tearDown() { + void tearDown() override { auto repairObserver = StorageRepairObserver::get(getGlobalServiceContext()); ASSERT(repairObserver->isDone()); diff --git a/src/mongo/db/storage/storage_repair_observer_test.cpp b/src/mongo/db/storage/storage_repair_observer_test.cpp index 059baa79fb9..42d33ec0599 100644 --- a/src/mongo/db/storage/storage_repair_observer_test.cpp +++ b/src/mongo/db/storage/storage_repair_observer_test.cpp @@ -137,12 +137,12 @@ public: return StorageRepairObserver::get(getServiceContext()); } - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); storageGlobalParams.repair = true; } - void tearDown() { + void tearDown() override { auto repairObserver = getRepairObserver(); if (_assertRepairIncompleteOnTearDown) { ASSERT(repairObserver->isIncomplete()); diff --git a/src/mongo/db/storage/test_harness_helper.h b/src/mongo/db/storage/test_harness_helper.h index bfdadea6281..0bb965fbc51 100644 --- a/src/mongo/db/storage/test_harness_helper.h +++ b/src/mongo/db/storage/test_harness_helper.h @@ -51,7 +51,7 @@ namespace mongo { */ class HarnessHelper : public ScopedGlobalServiceContextForTest { public: - virtual ~HarnessHelper() = default; + ~HarnessHelper() override = default; explicit HarnessHelper() : _threadClient(getGlobalServiceContext()->getService(ClusterRole::ShardServer)) {} diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_column_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_column_store.h index 699fb72c5f6..4539cd09d70 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_column_store.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_column_store.h @@ -90,7 +90,7 @@ public: StringData ident, const IndexDescriptor* desc, bool isLogged); - ~WiredTigerColumnStore() = default; + ~WiredTigerColumnStore() override = default; // // CRUD diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_import.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_import.cpp index 5ddbe09b7c1..288a9890df8 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_import.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_import.cpp @@ -129,11 +129,11 @@ class CountsChange : public RecoveryUnit::Change { public: CountsChange(WiredTigerRecordStore* rs, long long numRecords, long long dataSize) : _rs(rs), _numRecords(numRecords), _dataSize(dataSize) {} - void commit(OperationContext* opCtx, boost::optional) { + void commit(OperationContext* opCtx, boost::optional) override { _rs->setNumRecords(_numRecords); _rs->setDataSize(_dataSize); } - void rollback(OperationContext* opCtx) {} + void rollback(OperationContext* opCtx) override {} private: WiredTigerRecordStore* _rs; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp index f9aab4f5454..2f61223247c 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp @@ -1076,14 +1076,14 @@ public: _metrics = &ResourceConsumption::MetricsCollector::get(opCtx); WiredTigerIndexCursorGeneric::reattachToOperationContext(opCtx); } - void setSaveStorageCursorOnDetachFromOperationContext(bool detach) { + void setSaveStorageCursorOnDetachFromOperationContext(bool detach) override { WiredTigerIndexCursorGeneric::setSaveStorageCursorOnDetachFromOperationContext(detach); } /** * Returns the checkpoint ID for checkpoint cursors, otherwise 0. */ - uint64_t getCheckpointId() const { + uint64_t getCheckpointId() const override { return _cursor->getCheckpointId(); } @@ -1468,7 +1468,7 @@ private: } } - virtual bool matchesPositionedKey(const key_string::Value& search) const override { + bool matchesPositionedKey(const key_string::Value& search) const override { // We perform different comparisons depending on whether this is an old-format or new-format // key. New-format keys have record IDs at the end. if (isRecordIdAtEndOfKeyString()) { @@ -1526,7 +1526,7 @@ public: } } - virtual bool matchesPositionedKey(const key_string::Value& search) const override { + bool matchesPositionedKey(const key_string::Value& search) const override { return key_string::compare( search.getBuffer(), _key.getBuffer(), search.getSize(), _key.getSize()) == 0; } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h index 579540a7938..9df5446f50b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.h @@ -147,38 +147,38 @@ public: const IndexDescriptor* desc, bool isLogged); - virtual Status insert( - OperationContext* opCtx, - const key_string::Value& keyString, - bool dupsAllowed, - IncludeDuplicateRecordId includeDuplicateRecordId = IncludeDuplicateRecordId::kOff); + Status insert(OperationContext* opCtx, + const key_string::Value& keyString, + bool dupsAllowed, + IncludeDuplicateRecordId includeDuplicateRecordId = + IncludeDuplicateRecordId::kOff) override; - virtual void unindex(OperationContext* opCtx, - const key_string::Value& keyString, - bool dupsAllowed); + void unindex(OperationContext* opCtx, + const key_string::Value& keyString, + bool dupsAllowed) override; - virtual boost::optional findLoc(OperationContext* opCtx, - const key_string::Value& keyString) const override; + boost::optional findLoc(OperationContext* opCtx, + const key_string::Value& keyString) const override; - virtual IndexValidateResults validate(OperationContext* opCtx, bool full) const; + IndexValidateResults validate(OperationContext* opCtx, bool full) const override; - virtual bool appendCustomStats(OperationContext* opCtx, - BSONObjBuilder* output, - double scale) const; - virtual Status dupKeyCheck(OperationContext* opCtx, const key_string::Value& keyString); + bool appendCustomStats(OperationContext* opCtx, + BSONObjBuilder* output, + double scale) const override; + Status dupKeyCheck(OperationContext* opCtx, const key_string::Value& keyString) override; - virtual bool isEmpty(OperationContext* opCtx); + bool isEmpty(OperationContext* opCtx) override; - virtual int64_t numEntries(OperationContext* opCtx) const; + int64_t numEntries(OperationContext* opCtx) const override; - virtual long long getSpaceUsedBytes(OperationContext* opCtx) const; + long long getSpaceUsedBytes(OperationContext* opCtx) const override; - virtual long long getFreeStorageBytes(OperationContext* opCtx) const; + long long getFreeStorageBytes(OperationContext* opCtx) const override; - virtual Status initAsEmpty(OperationContext* opCtx); + Status initAsEmpty(OperationContext* opCtx) override; - virtual void printIndexEntryMetadata(OperationContext* opCtx, - const key_string::Value& keyString) const; + void printIndexEntryMetadata(OperationContext* opCtx, + const key_string::Value& keyString) const override; StatusWith compact(OperationContext* opCtx, const CompactOptions& options) override; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp index feba3edb247..92121ce9007 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp @@ -81,10 +81,10 @@ std::once_flag initializeServerStatusSectionFlag; class WiredTigerFactory : public StorageEngine::Factory { public: - virtual ~WiredTigerFactory() {} - virtual std::unique_ptr create(OperationContext* opCtx, - const StorageGlobalParams& params, - const StorageEngineLockFile* lockFile) const { + ~WiredTigerFactory() override {} + std::unique_ptr create(OperationContext* opCtx, + const StorageGlobalParams& params, + const StorageEngineLockFile* lockFile) const override { if (lockFile && lockFile->createdByUncleanShutdown()) { LOGV2_WARNING(22302, "Recovering data from the last clean checkpoint."); @@ -162,20 +162,20 @@ public: return std::make_unique(opCtx, std::move(kv), options); } - virtual StringData getCanonicalName() const { + StringData getCanonicalName() const override { return kWiredTigerEngineName; } - virtual Status validateCollectionStorageOptions(const BSONObj& options) const { + Status validateCollectionStorageOptions(const BSONObj& options) const override { return WiredTigerRecordStore::parseOptionsField(options).getStatus(); } - virtual Status validateIndexStorageOptions(const BSONObj& options) const { + Status validateIndexStorageOptions(const BSONObj& options) const override { return WiredTigerIndex::parseIndexOptions(options).getStatus(); } - virtual Status validateMetadata(const StorageEngineMetadata& metadata, - const StorageGlobalParams& params) const { + Status validateMetadata(const StorageEngineMetadata& metadata, + const StorageGlobalParams& params) const override { Status status = metadata.validateStorageEngineOption("directoryPerDB", params.directoryperdb); if (!status.isOK()) { @@ -204,7 +204,7 @@ public: return Status::OK(); } - virtual BSONObj createMetadataOptions(const StorageGlobalParams& params) const { + BSONObj createMetadataOptions(const StorageGlobalParams& params) const override { BSONObjBuilder builder; builder.appendBool("directoryPerDB", params.directoryperdb); builder.appendBool("directoryForIndexes", wiredTigerGlobalOptions.directoryForIndexes); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp index 50019fae62b..69dc279a09a 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp @@ -54,7 +54,7 @@ using namespace mongo; class WiredTigerFactoryTest : public ServiceContextTest { private: - virtual void setUp() { + void setUp() override { ServiceContext* globalEnv = getGlobalServiceContext(); ASSERT_TRUE(globalEnv); ASSERT_TRUE(isRegisteredStorageEngine(globalEnv, kWiredTigerEngineName)); @@ -63,7 +63,7 @@ private: _oldOptions = wiredTigerGlobalOptions; } - virtual void tearDown() { + void tearDown() override { wiredTigerGlobalOptions = _oldOptions; factory = nullptr; } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 25cf5837d13..5609da5c7ed 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -269,11 +269,11 @@ public: explicit WiredTigerSessionSweeper(WiredTigerSessionCache* sessionCache) : BackgroundJob(false /* deleteSelf */), _sessionCache(sessionCache) {} - virtual string name() const { + string name() const override { return "WTIdleSessionSweeper"; } - virtual void run() { + void run() override { ThreadClient tc(name(), getGlobalServiceContext()->getService(ClusterRole::ShardServer)); // TODO(SERVER-74657): Please revisit if this thread could be made killable. @@ -1115,15 +1115,15 @@ public: _path(path), _wtBackup(wtBackup){}; - ~StreamingCursorImpl() = default; + ~StreamingCursorImpl() override = default; - void setCatalogEntries( - stdx::unordered_map> identsToNsAndUUID) { + void setCatalogEntries(stdx::unordered_map> + identsToNsAndUUID) override { _identsToNsAndUUID = std::move(identsToNsAndUUID); } StatusWith> getNextBatch(OperationContext* opCtx, - const std::size_t batchSize) { + const std::size_t batchSize) override { int wtRet = 0; std::deque backupBlocks; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index f582375c019..b333231f34b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -197,7 +197,7 @@ public: bool ephemeral, bool repair); - ~WiredTigerKVEngine(); + ~WiredTigerKVEngine() override; void notifyStorageStartupRecoveryComplete() override; void notifyReplStartupRecoveryComplete(OperationContext* opCtx) override; @@ -326,8 +326,7 @@ public: void endNonBlockingBackup(OperationContext* opCtx) override; - virtual StatusWith> extendBackupCursor( - OperationContext* opCtx) override; + StatusWith> extendBackupCursor(OperationContext* opCtx) override; int64_t getIdentSize(OperationContext* opCtx, StringData ident) override; @@ -389,9 +388,9 @@ public: Timestamp getAllDurableTimestamp() const override; - bool supportsReadConcernSnapshot() const final override; + bool supportsReadConcernSnapshot() const final; - bool supportsOplogTruncateMarkers() const final override; + bool supportsOplogTruncateMarkers() const final; bool supportsReadConcernMajority() const final; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_no_fixture_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_no_fixture_test.cpp index 39262afe358..60580694ab2 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_no_fixture_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_no_fixture_test.cpp @@ -96,7 +96,7 @@ class KVTestClientObserver final : public ServiceContext::ClientObserver { public: void onCreateClient(Client* client) override {} void onDestroyClient(Client* client) override {} - void onCreateOperationContext(OperationContext* opCtx) { + void onCreateOperationContext(OperationContext* opCtx) override { stdx::unique_lock lock(_mutex); shard_role_details::setRecoveryUnit( opCtx, diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp index a91efd6db39..2a22dd19a5e 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp @@ -101,11 +101,11 @@ public: getWiredTigerKVEngine()->notifyStorageStartupRecoveryComplete(); } - ~WiredTigerKVHarnessHelper() { + ~WiredTigerKVHarnessHelper() override { getWiredTigerKVEngine()->cleanShutdown(); } - virtual KVEngine* restartEngine() override { + KVEngine* restartEngine() override { getEngine()->cleanShutdown(); _svcCtx->clearStorageEngine(); _svcCtx->setStorageEngine(makeEngine()); @@ -113,7 +113,7 @@ public: return getEngine(); } - virtual KVEngine* getEngine() override { + KVEngine* getEngine() override { return _svcCtx->getStorageEngine()->getEngine(); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 47e0d0cee8b..051b48942b0 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -449,7 +449,7 @@ public: restore(); } - ~RandomCursor() { + ~RandomCursor() override { if (_cursor) { // On destruction, we must always handle freeing the underlying raw WT_CURSOR pointer. _saveStorageCursorOnDetachFromOperationContext = false; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h index c03be36e44a..dfbd1f34189 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h @@ -141,7 +141,7 @@ public: WiredTigerRecordStore(WiredTigerKVEngine* kvEngine, OperationContext* opCtx, Params params); - virtual ~WiredTigerRecordStore(); + ~WiredTigerRecordStore() override; void getOplogTruncateStats(BSONObjBuilder& builder) const override; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_truncate_markers.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_truncate_markers.h index 5360e690c2a..5f183a0bcaf 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_truncate_markers.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_truncate_markers.h @@ -94,9 +94,9 @@ public: } private: - virtual bool _hasExcessMarkers(OperationContext* opCtx) const final; + bool _hasExcessMarkers(OperationContext* opCtx) const final; - virtual void _notifyNewMarkerCreation() final { + void _notifyNewMarkerCreation() final { _reclaimCv.notify_all(); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.h index 194a30bb5bc..06cbf40f6a5 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test_harness.h @@ -54,9 +54,9 @@ public: : WiredTigerHarnessHelper(Options::ReplicationEnabled, extraStrings) {} WiredTigerHarnessHelper(Options options, StringData extraStrings); - ~WiredTigerHarnessHelper() {} + ~WiredTigerHarnessHelper() override {} - virtual std::unique_ptr newRecordStore() override { + std::unique_ptr newRecordStore() override { return newRecordStore("a.b"); } @@ -64,18 +64,17 @@ public: return newRecordStore(ns, CollectionOptions()); } - virtual std::unique_ptr newRecordStore( - const std::string& ns, - const CollectionOptions& collOptions, - KeyFormat keyFormat = KeyFormat::Long) override; + std::unique_ptr newRecordStore(const std::string& ns, + const CollectionOptions& collOptions, + KeyFormat keyFormat = KeyFormat::Long) override; - virtual std::unique_ptr newOplogRecordStore() override; + std::unique_ptr newOplogRecordStore() override; - virtual KVEngine* getEngine() override final { + KVEngine* getEngine() final { return &_engine; } - std::unique_ptr newRecoveryUnit(); + std::unique_ptr newRecoveryUnit() override; /** * Create an oplog record store without calling postConstructorInit(). diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h index bd90735bd58..f31c72cb159 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h @@ -79,7 +79,7 @@ public: * expected to only be useful in those cases. */ WiredTigerRecoveryUnit(WiredTigerSessionCache* sc, WiredTigerOplogManager* oplogManager); - ~WiredTigerRecoveryUnit(); + ~WiredTigerRecoveryUnit() override; void prepareUnitOfWork() override; @@ -150,7 +150,7 @@ public: bool isReadSourcePinned() const override; - virtual void setOrderedCommit(bool orderedCommit) override { + void setOrderedCommit(bool orderedCommit) override { _orderedCommit = orderedCommit; } @@ -166,7 +166,7 @@ public: std::unique_ptr computeOperationStatisticsSinceLastCall() override; - void ignoreAllMultiTimestampConstraints() { + void ignoreAllMultiTimestampConstraints() override { _multiTimestampConstraintTracker.ignoreAllMultiTimestampConstraints = true; } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp index 05e661fc763..c1357c191e6 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp @@ -102,14 +102,14 @@ public: _engine.notifyStorageStartupRecoveryComplete(); } - ~WiredTigerRecoveryUnitHarnessHelper() {} + ~WiredTigerRecoveryUnitHarnessHelper() override {} - virtual std::unique_ptr newRecoveryUnit() final { + std::unique_ptr newRecoveryUnit() final { return std::unique_ptr(_engine.newRecoveryUnit()); } - virtual std::unique_ptr createRecordStore(OperationContext* opCtx, - const std::string& ns) final { + std::unique_ptr createRecordStore(OperationContext* opCtx, + const std::string& ns) final { std::string ident = ns; NamespaceString nss = NamespaceString::createNamespaceString_forTest(ns); std::string uri = WiredTigerKVEngine::kTableUriPrefix + ns; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp index 6557b0b2416..18c3690180b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp @@ -169,7 +169,7 @@ TEST(WiredTigerRecordStoreTest, SizeStorer1) { class SizeStorerUpdateTest : public mongo::unittest::Test { private: - virtual void setUp() { + void setUp() override { harnessHelper.reset(new WiredTigerHarnessHelper()); sizeStorer.reset(new WiredTigerSizeStorer( harnessHelper->conn(), WiredTigerKVEngine::kTableUriPrefix + "sizeStorer")); @@ -179,7 +179,7 @@ private: ident = wtrs->getIdent(); uri = wtrs->getURI(); } - virtual void tearDown() { + void tearDown() override { rs.reset(nullptr); sizeStorer->flush(false); sizeStorer.reset(nullptr); diff --git a/src/mongo/db/timeseries/bucket_compression_failure.h b/src/mongo/db/timeseries/bucket_compression_failure.h index 120ffdafa4b..92449cbd4c2 100644 --- a/src/mongo/db/timeseries/bucket_compression_failure.h +++ b/src/mongo/db/timeseries/bucket_compression_failure.h @@ -48,7 +48,7 @@ public: static std::shared_ptr parse(const BSONObj&); - virtual void serialize(BSONObjBuilder*) const override; + void serialize(BSONObjBuilder*) const override; const UUID& collectionUUID() const; OID bucketId() const; diff --git a/src/mongo/db/timeseries/timeseries_op_observer.h b/src/mongo/db/timeseries/timeseries_op_observer.h index fb05a6ca768..c73f6463158 100644 --- a/src/mongo/db/timeseries/timeseries_op_observer.h +++ b/src/mongo/db/timeseries/timeseries_op_observer.h @@ -55,7 +55,7 @@ class TimeSeriesOpObserver final : public OpObserverNoop { public: TimeSeriesOpObserver() = default; - ~TimeSeriesOpObserver() = default; + ~TimeSeriesOpObserver() override = default; NamespaceFilters getNamespaceFilters() const final { return {NamespaceFilter::kSystem, NamespaceFilter::kSystem}; diff --git a/src/mongo/db/timeseries/timeseries_update_delete_util_test.cpp b/src/mongo/db/timeseries/timeseries_update_delete_util_test.cpp index fcbd9f58b0a..bfc12fe027d 100644 --- a/src/mongo/db/timeseries/timeseries_update_delete_util_test.cpp +++ b/src/mongo/db/timeseries/timeseries_update_delete_util_test.cpp @@ -48,7 +48,7 @@ namespace { class TimeseriesUpdateDeleteUtilTest : public ServiceContextMongoDTest { protected: - void setUp() { + void setUp() override { ServiceContextMongoDTest::setUp(); _opCtx = cc().makeOperationContext(); } diff --git a/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h b/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h index 65f3f9e68dd..3b74d050838 100644 --- a/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h +++ b/src/mongo/db/transaction/session_catalog_mongod_transaction_interface_impl.h @@ -52,7 +52,7 @@ class MongoDSessionCatalogTransactionInterfaceImpl public: MongoDSessionCatalogTransactionInterfaceImpl() = default; - virtual ~MongoDSessionCatalogTransactionInterfaceImpl() = default; + ~MongoDSessionCatalogTransactionInterfaceImpl() override = default; bool isTransactionPrepared(const ObservableSession& session) override; diff --git a/src/mongo/db/transaction/transaction_api.h b/src/mongo/db/transaction/transaction_api.h index 9bd6fc101cc..12791b14cbd 100644 --- a/src/mongo/db/transaction/transaction_api.h +++ b/src/mongo/db/transaction/transaction_api.h @@ -309,7 +309,7 @@ public: Future handleRequest(OperationContext* opCtx, const Message& request) const override; - bool runsClusterOperations() const { + bool runsClusterOperations() const override { return false; } }; @@ -334,36 +334,33 @@ public: SEPTransactionClient(const SEPTransactionClient&) = delete; SEPTransactionClient operator=(const SEPTransactionClient&) = delete; - virtual void initialize(std::unique_ptr hooks) override { + void initialize(std::unique_ptr hooks) override { invariant(!_hooks); _hooks = std::move(hooks); } - virtual SemiFuture runCommand(const DatabaseName& dbName, BSONObj cmd) const override; - virtual BSONObj runCommandSync(const DatabaseName& dbName, BSONObj cmd) const override; + SemiFuture runCommand(const DatabaseName& dbName, BSONObj cmd) const override; + BSONObj runCommandSync(const DatabaseName& dbName, BSONObj cmd) const override; - virtual SemiFuture runCommandChecked(const DatabaseName& dbName, - BSONObj cmd) const override; - virtual BSONObj runCommandCheckedSync(const DatabaseName& dbName, BSONObj cmd) const override; + SemiFuture runCommandChecked(const DatabaseName& dbName, BSONObj cmd) const override; + BSONObj runCommandCheckedSync(const DatabaseName& dbName, BSONObj cmd) const override; - virtual SemiFuture runCRUDOp( - const BatchedCommandRequest& cmd, std::vector stmtIds) const override; - virtual BatchedCommandResponse runCRUDOpSync(const BatchedCommandRequest& cmd, + SemiFuture runCRUDOp(const BatchedCommandRequest& cmd, std::vector stmtIds) const override; + BatchedCommandResponse runCRUDOpSync(const BatchedCommandRequest& cmd, + std::vector stmtIds) const override; - virtual SemiFuture runCRUDOp( - const BulkWriteCommandRequest& cmd) const override; - virtual BulkWriteCommandReply runCRUDOpSync(const BulkWriteCommandRequest& cmd) const override; + SemiFuture runCRUDOp(const BulkWriteCommandRequest& cmd) const override; + BulkWriteCommandReply runCRUDOpSync(const BulkWriteCommandRequest& cmd) const override; - virtual SemiFuture> exhaustiveFind( - const FindCommandRequest& cmd) const override; - virtual std::vector exhaustiveFindSync(const FindCommandRequest& cmd) const override; + SemiFuture> exhaustiveFind(const FindCommandRequest& cmd) const override; + std::vector exhaustiveFindSync(const FindCommandRequest& cmd) const override; - virtual bool supportsClientTransactionContext() const override { + bool supportsClientTransactionContext() const override { return true; } - virtual bool runsClusterOperations() const override { + bool runsClusterOperations() const override { return _behaviors->runsClusterOperations(); } diff --git a/src/mongo/db/transaction/transaction_api_test.cpp b/src/mongo/db/transaction/transaction_api_test.cpp index b4e08c89910..38ba720c5bc 100644 --- a/src/mongo/db/transaction/transaction_api_test.cpp +++ b/src/mongo/db/transaction/transaction_api_test.cpp @@ -124,7 +124,7 @@ const BSONObj kResWithNonTransientCommitErrorAndNonRetryableWriteConcernError = class MockResourceYielder : public ResourceYielder { public: - void yield(OperationContext*) { + void yield(OperationContext*) override { _timesYielded++; if (_skipNTimes > 0) { @@ -138,7 +138,7 @@ public: } } - void unyield(OperationContext*) { + void unyield(OperationContext*) override { _timesUnyielded++; if (_skipNTimes > 0) { @@ -186,11 +186,11 @@ class MockTransactionClient : public SEPTransactionClient { public: using SEPTransactionClient::SEPTransactionClient; - virtual void initialize(std::unique_ptr hooks) override { + void initialize(std::unique_ptr hooks) override { _hooks = std::move(hooks); } - virtual SemiFuture runCommand(const DatabaseName& dbName, BSONObj cmd) const override { + SemiFuture runCommand(const DatabaseName& dbName, BSONObj cmd) const override { stdx::unique_lock ul(_mutex); [&]() { StringData cmdName = cmd.firstElementFieldNameStringData(); @@ -234,43 +234,41 @@ public: return SemiFuture::makeReady(nextResponseRes); } - virtual BSONObj runCommandSync(const DatabaseName& dbName, BSONObj cmd) const override { + BSONObj runCommandSync(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual BSONObj runCommandCheckedSync(const DatabaseName& dbName, BSONObj cmd) const override { + BSONObj runCommandCheckedSync(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCommandChecked(const DatabaseName& dbName, - BSONObj cmd) const override { + SemiFuture runCommandChecked(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCRUDOp( - const BatchedCommandRequest& cmd, std::vector stmtIds) const override { - MONGO_UNREACHABLE; - } - - virtual BatchedCommandResponse runCRUDOpSync(const BatchedCommandRequest& cmd, + SemiFuture runCRUDOp(const BatchedCommandRequest& cmd, std::vector stmtIds) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCRUDOp( - const BulkWriteCommandRequest& cmd) const override { + BatchedCommandResponse runCRUDOpSync(const BatchedCommandRequest& cmd, + std::vector stmtIds) const override { MONGO_UNREACHABLE; } - virtual BulkWriteCommandReply runCRUDOpSync(const BulkWriteCommandRequest& cmd) const override { + SemiFuture runCRUDOp(const BulkWriteCommandRequest& cmd) const override { MONGO_UNREACHABLE; } - virtual bool supportsClientTransactionContext() const override { + BulkWriteCommandReply runCRUDOpSync(const BulkWriteCommandRequest& cmd) const override { + MONGO_UNREACHABLE; + } + + bool supportsClientTransactionContext() const override { return true; } - virtual bool runsClusterOperations() const override { + bool runsClusterOperations() const override { return false; } @@ -550,58 +548,55 @@ private: class MockClusterOperationTransactionClient : public txn_api::TransactionClient { public: - virtual void initialize(std::unique_ptr hooks) {} + void initialize(std::unique_ptr hooks) override {} - virtual BSONObj runCommandSync(const DatabaseName& dbName, BSONObj cmd) const override { + BSONObj runCommandSync(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCommand(const DatabaseName& dbName, BSONObj cmd) const override { + SemiFuture runCommand(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual BSONObj runCommandCheckedSync(const DatabaseName& dbName, BSONObj cmd) const override { + BSONObj runCommandCheckedSync(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCommandChecked(const DatabaseName& dbName, - BSONObj cmd) const override { + SemiFuture runCommandChecked(const DatabaseName& dbName, BSONObj cmd) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCRUDOp( - const BatchedCommandRequest& cmd, std::vector stmtIds) const override { - MONGO_UNREACHABLE; - } - - virtual BatchedCommandResponse runCRUDOpSync(const BatchedCommandRequest& cmd, + SemiFuture runCRUDOp(const BatchedCommandRequest& cmd, std::vector stmtIds) const override { MONGO_UNREACHABLE; } - virtual SemiFuture runCRUDOp( - const BulkWriteCommandRequest& cmd) const override { + BatchedCommandResponse runCRUDOpSync(const BatchedCommandRequest& cmd, + std::vector stmtIds) const override { MONGO_UNREACHABLE; } - virtual BulkWriteCommandReply runCRUDOpSync(const BulkWriteCommandRequest& cmd) const override { + SemiFuture runCRUDOp(const BulkWriteCommandRequest& cmd) const override { MONGO_UNREACHABLE; } - virtual SemiFuture> exhaustiveFind( - const FindCommandRequest& cmd) const override { + BulkWriteCommandReply runCRUDOpSync(const BulkWriteCommandRequest& cmd) const override { MONGO_UNREACHABLE; } - virtual std::vector exhaustiveFindSync(const FindCommandRequest& cmd) const override { + SemiFuture> exhaustiveFind(const FindCommandRequest& cmd) const override { MONGO_UNREACHABLE; } - virtual bool supportsClientTransactionContext() const override { + std::vector exhaustiveFindSync(const FindCommandRequest& cmd) const override { + MONGO_UNREACHABLE; + } + + bool supportsClientTransactionContext() const override { return true; } - virtual bool runsClusterOperations() const override { + bool runsClusterOperations() const override { return true; } }; diff --git a/src/mongo/db/transaction/transaction_history_iterator.h b/src/mongo/db/transaction/transaction_history_iterator.h index a98bf387b53..e4a05ba5fb4 100644 --- a/src/mongo/db/transaction/transaction_history_iterator.h +++ b/src/mongo/db/transaction/transaction_history_iterator.h @@ -69,7 +69,7 @@ public: * Creates a new iterator starting with an oplog entry with the given start opTime. */ TransactionHistoryIterator(repl::OpTime startingOpTime, bool permitYield = false); - virtual ~TransactionHistoryIterator() = default; + ~TransactionHistoryIterator() override = default; bool hasNext() const override; repl::OplogEntry next(OperationContext* opCtx) override; diff --git a/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp b/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp index 6dd3b81b653..51dc6d0d70f 100644 --- a/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp +++ b/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp @@ -246,7 +246,7 @@ public: class TransactionParticipantRetryableWritesTest : public MockReplCoordServerFixture { protected: - void setUp() { + void setUp() override { MockReplCoordServerFixture::setUp(); const auto service = opCtx()->getServiceContext(); repl::StorageInterface::set(service, std::make_unique()); @@ -264,7 +264,7 @@ protected: opContextSession.emplace(opCtx()); } - void tearDown() { + void tearDown() override { opContextSession.reset(); MockReplCoordServerFixture::tearDown(); @@ -375,7 +375,7 @@ protected: class ShardTransactionParticipantRetryableWritesTest : public TransactionParticipantRetryableWritesTest { protected: - void setUp() { + void setUp() override { TransactionParticipantRetryableWritesTest::setUp(); serverGlobalParams.clusterRole = {ClusterRole::ShardServer, ClusterRole::RouterServer}; } diff --git a/src/mongo/db/transaction_resources_init_mongod.cpp b/src/mongo/db/transaction_resources_init_mongod.cpp index c69b4736c4c..6ebdfc87541 100644 --- a/src/mongo/db/transaction_resources_init_mongod.cpp +++ b/src/mongo/db/transaction_resources_init_mongod.cpp @@ -44,7 +44,7 @@ namespace { class TransactionResourcesMongoDClientObserver : public ServiceContext::ClientObserver { public: TransactionResourcesMongoDClientObserver() = default; - ~TransactionResourcesMongoDClientObserver() = default; + ~TransactionResourcesMongoDClientObserver() override = default; void onCreateClient(Client* client) final {} diff --git a/src/mongo/db/transaction_resources_init_non_mongod.cpp b/src/mongo/db/transaction_resources_init_non_mongod.cpp index 6a9c36e6886..51be5c47442 100644 --- a/src/mongo/db/transaction_resources_init_non_mongod.cpp +++ b/src/mongo/db/transaction_resources_init_non_mongod.cpp @@ -41,7 +41,7 @@ namespace { class TransactionResourcesNonMongoDClientObserver : public ServiceContext::ClientObserver { public: TransactionResourcesNonMongoDClientObserver() = default; - ~TransactionResourcesNonMongoDClientObserver() = default; + ~TransactionResourcesNonMongoDClientObserver() override = default; void onCreateClient(Client* client) final {} diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index b6d13b4b24d..118d806e90d 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -339,7 +339,7 @@ private: void onStepDown() override {} void onRollback() override {} void onBecomeArbiter() override {} - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "TTLMonitorService"; } }; diff --git a/src/mongo/db/ttl.h b/src/mongo/db/ttl.h index 6200e674e2f..8321884c6c3 100644 --- a/src/mongo/db/ttl.h +++ b/src/mongo/db/ttl.h @@ -69,11 +69,11 @@ public: static Status onUpdateTTLMonitorSleepSeconds(int newSleepSeconds); - std::string name() const { + std::string name() const override { return "TTLMonitor"; } - void run(); + void run() override; /** * Signals the thread to quit and then waits until it does. diff --git a/src/mongo/db/update/document_diff_serialization.h b/src/mongo/db/update/document_diff_serialization.h index 05b3e076e2f..2d432747a0c 100644 --- a/src/mongo/db/update/document_diff_serialization.h +++ b/src/mongo/db/update/document_diff_serialization.h @@ -410,7 +410,7 @@ public: addChild(idx, std::make_unique(value)); } - virtual Node* getChild(StringData fieldName) const override { + Node* getChild(StringData fieldName) const override { auto idx = str::parseUnsignedBase10Integer(fieldName); invariant(idx); auto it = children.find(*idx); diff --git a/src/mongo/db/update/path_support_test.cpp b/src/mongo/db/update/path_support_test.cpp index 24e2a3e3821..83d7046b117 100644 --- a/src/mongo/db/update/path_support_test.cpp +++ b/src/mongo/db/update/path_support_test.cpp @@ -144,7 +144,7 @@ class SimpleDoc : public mongo::unittest::Test { public: SimpleDoc() : _doc() {} - virtual void setUp() { + void setUp() override { // {a: 1} ASSERT_OK(root().appendInt("a", 1)); } @@ -250,7 +250,7 @@ class NestedDoc : public mongo::unittest::Test { public: NestedDoc() : _doc() {} - virtual void setUp() { + void setUp() override { // {a: {b: {c: 1}}} Element elemA = _doc.makeElementObject("a"); ASSERT_TRUE(elemA.ok()); @@ -373,7 +373,7 @@ class ArrayDoc : public mongo::unittest::Test { public: ArrayDoc() : _doc() {} - virtual void setUp() { + void setUp() override { // {a: []} Element elemA = _doc.makeElementArray("a"); ASSERT_TRUE(elemA.ok()); diff --git a/src/mongo/db/update/pattern_cmp_test.cpp b/src/mongo/db/update/pattern_cmp_test.cpp index ed0fc17593c..7642c6dbdd2 100644 --- a/src/mongo/db/update/pattern_cmp_test.cpp +++ b/src/mongo/db/update/pattern_cmp_test.cpp @@ -56,7 +56,7 @@ class PatternElemCmpTest : public mongo::unittest::Test { public: PatternElemCmpTest() : _doc(), _size(0) {} - virtual void setUp() { + void setUp() override { Element arr = _doc.makeElementArray("x"); ASSERT_TRUE(arr.ok()); ASSERT_OK(_doc.root().pushBack(arr)); diff --git a/src/mongo/db/update/pipeline_executor.h b/src/mongo/db/update/pipeline_executor.h index 99603e2e3df..b020892cd3a 100644 --- a/src/mongo/db/update/pipeline_executor.h +++ b/src/mongo/db/update/pipeline_executor.h @@ -71,7 +71,7 @@ public: Value serialize() const final; - bool getCheckExistenceForDiffInsertOperations() const override final { + bool getCheckExistenceForDiffInsertOperations() const final { return _checkExistenceForDiffInsertOperations; } diff --git a/src/mongo/db/update/rename_node.cpp b/src/mongo/db/update/rename_node.cpp index 3d999c36caa..1fbc6770724 100644 --- a/src/mongo/db/update/rename_node.cpp +++ b/src/mongo/db/update/rename_node.cpp @@ -77,7 +77,8 @@ public: void setCollator(const CollatorInterface* collator) final {} - Status init(BSONElement modExpr, const boost::intrusive_ptr& expCtx) { + Status init(BSONElement modExpr, + const boost::intrusive_ptr& expCtx) override { return Status::OK(); } diff --git a/src/mongo/db/vector_clock.cpp b/src/mongo/db/vector_clock.cpp index 2de41716fc4..ab1d89f52e4 100644 --- a/src/mongo/db/vector_clock.cpp +++ b/src/mongo/db/vector_clock.cpp @@ -149,7 +149,7 @@ void VectorClock::_advanceTime(LogicalTimeArray&& newTime) { class VectorClock::PlainComponentFormat : public VectorClock::ComponentFormat { public: using ComponentFormat::ComponentFormat; - virtual ~PlainComponentFormat() = default; + ~PlainComponentFormat() override = default; bool out(ServiceContext* service, OperationContext* opCtx, @@ -168,7 +168,7 @@ LogicalTime fromOptionalTimestamp(const boost::optional& time) { class VectorClock::ConfigTimeComponent : public VectorClock::PlainComponentFormat { public: ConfigTimeComponent() : PlainComponentFormat(VectorClock::kConfigTimeFieldName) {} - virtual ~ConfigTimeComponent() = default; + ~ConfigTimeComponent() override = default; LogicalTime in(ServiceContext* service, OperationContext* opCtx, @@ -182,7 +182,7 @@ public: class VectorClock::TopologyTimeComponent : public VectorClock::PlainComponentFormat { public: TopologyTimeComponent() : PlainComponentFormat(VectorClock::kTopologyTimeFieldName) {} - virtual ~TopologyTimeComponent() = default; + ~TopologyTimeComponent() override = default; LogicalTime in(ServiceContext* service, OperationContext* opCtx, @@ -196,7 +196,7 @@ public: class VectorClock::SignedComponentFormat : public VectorClock::ComponentFormat { public: using ComponentFormat::ComponentFormat; - virtual ~SignedComponentFormat() = default; + ~SignedComponentFormat() override = default; bool out(ServiceContext* service, OperationContext* opCtx, diff --git a/src/mongo/db/vector_clock_mongod.h b/src/mongo/db/vector_clock_mongod.h index 122ebfb5d44..c5addd1a0ec 100644 --- a/src/mongo/db/vector_clock_mongod.h +++ b/src/mongo/db/vector_clock_mongod.h @@ -54,7 +54,7 @@ public: static VectorClockMongoD* get(ServiceContext* serviceContext); VectorClockMongoD() = default; - virtual ~VectorClockMongoD() = default; + ~VectorClockMongoD() override = default; private: // VectorClockMutable methods implementation @@ -78,7 +78,7 @@ private: void onStepDown() override; void onRollback() override {} void onBecomeArbiter() override; - inline std::string getServiceName() const override final { + inline std::string getServiceName() const final { return "VectorClockMongoD"; } diff --git a/src/mongo/db/vector_clock_mutable.h b/src/mongo/db/vector_clock_mutable.h index 7021e2d63c0..d1d637d23b7 100644 --- a/src/mongo/db/vector_clock_mutable.h +++ b/src/mongo/db/vector_clock_mutable.h @@ -102,7 +102,7 @@ public: protected: VectorClockMutable(); - virtual ~VectorClockMutable(); + ~VectorClockMutable() override; /** * Called by sub-classes in order to actually tick a Component time, once they have determined diff --git a/src/mongo/db/vector_clock_test_fixture.h b/src/mongo/db/vector_clock_test_fixture.h index 87bef4f49dc..bc682dc2f91 100644 --- a/src/mongo/db/vector_clock_test_fixture.h +++ b/src/mongo/db/vector_clock_test_fixture.h @@ -52,7 +52,7 @@ class VectorClockMutable; class VectorClockTestFixture : public ShardingMongoDTestFixture { protected: VectorClockTestFixture(); - ~VectorClockTestFixture(); + ~VectorClockTestFixture() override; /** * Sets up this fixture as the primary node in a shard server replica set with a VectorClock diff --git a/src/mongo/db/vector_clock_trivial.cpp b/src/mongo/db/vector_clock_trivial.cpp index f1e614346f5..9b1701dd650 100644 --- a/src/mongo/db/vector_clock_trivial.cpp +++ b/src/mongo/db/vector_clock_trivial.cpp @@ -52,7 +52,7 @@ class VectorClockTrivial : public VectorClockMutable { public: VectorClockTrivial(); - virtual ~VectorClockTrivial(); + ~VectorClockTrivial() override; private: // VectorClock methods implementation diff --git a/src/mongo/dbtests/basictests.cpp b/src/mongo/dbtests/basictests.cpp index f33e62d939a..77e449119e3 100644 --- a/src/mongo/dbtests/basictests.cpp +++ b/src/mongo/dbtests/basictests.cpp @@ -168,7 +168,7 @@ public: }; class simple1 : public Base { - void pop() { + void pop() override { SBTGB(1); SBTGB("yo"); SBTGB(2); @@ -176,7 +176,7 @@ class simple1 : public Base { }; class simple2 : public Base { - void pop() { + void pop() override { SBTGB(1); SBTGB("yo"); SBTGB(2); @@ -344,7 +344,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("basic") {} - void setupTests() { + void setupTests() override { add(); add(); diff --git a/src/mongo/dbtests/catalogtests.cpp b/src/mongo/dbtests/catalogtests.cpp index 1fb2b750ba4..28f2cba07c6 100644 --- a/src/mongo/dbtests/catalogtests.cpp +++ b/src/mongo/dbtests/catalogtests.cpp @@ -118,7 +118,7 @@ public: addNameCallback(nameForTestClass(), [] { T().run(); }); } - void setupTests() { + void setupTests() override { add(); } }; diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp index 6b007c70630..f00e7517976 100644 --- a/src/mongo/dbtests/clienttests.cpp +++ b/src/mongo/dbtests/clienttests.cpp @@ -408,7 +408,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("client") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/commandtests.cpp b/src/mongo/dbtests/commandtests.cpp index 9b848e4f893..eeb4fb1fd6d 100644 --- a/src/mongo/dbtests/commandtests.cpp +++ b/src/mongo/dbtests/commandtests.cpp @@ -343,7 +343,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("commands") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp index 1e0efda3fdc..d9ad5e60a10 100644 --- a/src/mongo/dbtests/counttests.cpp +++ b/src/mongo/dbtests/counttests.cpp @@ -189,7 +189,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("count") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp index 3d5d94ca5fc..6018da9a366 100644 --- a/src/mongo/dbtests/dbhelper_tests.cpp +++ b/src/mongo/dbtests/dbhelper_tests.cpp @@ -310,7 +310,7 @@ private: class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("dbhelpers") {} - void setupTests() { + void setupTests() override { add(); add(); } diff --git a/src/mongo/dbtests/deferred_writer.cpp b/src/mongo/dbtests/deferred_writer.cpp index ba5d164ab4a..409be745943 100644 --- a/src/mongo/dbtests/deferred_writer.cpp +++ b/src/mongo/dbtests/deferred_writer.cpp @@ -195,9 +195,9 @@ private: */ class DeferredWriterTestEmpty : public DeferredWriterTestBase { public: - ~DeferredWriterTestEmpty(){}; + ~DeferredWriterTestEmpty() override{}; - void run() { + void run() override { { auto gw = getWriter(); auto writer = gw.get(); @@ -213,7 +213,7 @@ public: */ class DeferredWriterTestConcurrent : public DeferredWriterTestBase { public: - ~DeferredWriterTestConcurrent(){}; + ~DeferredWriterTestConcurrent() override{}; void worker(DeferredWriter* writer) { for (int i = 0; i < kDocsPerWorker; ++i) { @@ -221,7 +221,7 @@ public: } } - void run() { + void run() override { ensureEmpty(); { auto gw = getWriter(); @@ -248,9 +248,9 @@ bool compareBsonObjects(const BSONObj& lhs, const BSONObj& rhs) { */ class DeferredWriterTestConsistent : public DeferredWriterTestBase { public: - ~DeferredWriterTestConsistent() {} + ~DeferredWriterTestConsistent() override {} - void run() { + void run() override { ensureEmpty(); { auto gw = getWriter(); @@ -285,7 +285,7 @@ private: */ class DeferredWriterTestNoDeadlock : public DeferredWriterTestBase { public: - void run(void) { + void run(void) override { int nDocs = 1000; ensureEmpty(); { @@ -313,7 +313,7 @@ public: */ class DeferredWriterTestCap : public DeferredWriterTestBase { public: - void run(void) { + void run(void) override { // Add a few hundred documents. int maxDocs = 500; // (more than can fit in a 2KB buffer). @@ -369,7 +369,7 @@ public: } } - void run(void) { + void run(void) override { using namespace std::chrono_literals; ensureEmpty(); ThreadLauncher launcher; @@ -398,7 +398,7 @@ class DeferredWriterTests : public unittest::OldStyleSuiteSpecification { public: DeferredWriterTests() : OldStyleSuiteSpecification("deferred_writer_tests") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp index a95cfacc105..9164b252d11 100644 --- a/src/mongo/dbtests/directclienttests.cpp +++ b/src/mongo/dbtests/directclienttests.cpp @@ -179,7 +179,7 @@ public: class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("directclient") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp index b2af5f46a45..3e39546244c 100644 --- a/src/mongo/dbtests/documentsourcetests.cpp +++ b/src/mongo/dbtests/documentsourcetests.cpp @@ -120,7 +120,7 @@ public: _ctx->tempDir = storageGlobalParams.dbpath + "/_tmp"; } - virtual ~DocumentSourceCursorTest() { + ~DocumentSourceCursorTest() override { client.dropCollection(nss); } diff --git a/src/mongo/dbtests/indexcatalogtests.cpp b/src/mongo/dbtests/indexcatalogtests.cpp index ebcc541896e..4708c8edfe5 100644 --- a/src/mongo/dbtests/indexcatalogtests.cpp +++ b/src/mongo/dbtests/indexcatalogtests.cpp @@ -211,7 +211,7 @@ public: class IndexCatalogTests : public unittest::OldStyleSuiteSpecification { public: IndexCatalogTests() : OldStyleSuiteSpecification("indexcatalogtests") {} - void setupTests() { + void setupTests() override { add(); add(); } diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp index c99d5b24b63..40859b27d86 100644 --- a/src/mongo/dbtests/indexupdatetests.cpp +++ b/src/mongo/dbtests/indexupdatetests.cpp @@ -719,7 +719,7 @@ public: addNameCallback(nameForTestClass(), [] { T().run(); }); } - void setupTests() { + void setupTests() override { // These tests check that index creation ignores the unique constraint when told to. // The mobile storage engine does not support duplicate keys in unique indexes so these // tests are disabled. diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp index 58ef74ec543..fc5c05ed833 100644 --- a/src/mongo/dbtests/jsobjtests.cpp +++ b/src/mongo/dbtests/jsobjtests.cpp @@ -796,10 +796,10 @@ protected: }; class BadType : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":1}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); set(ret, 4, 50); return ret; @@ -807,10 +807,10 @@ class BadType : public Base { }; class EooBeforeEnd : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":1}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); // (first byte of size)++ set(ret, 0, get(ret, 0) + 1); @@ -831,10 +831,10 @@ public: }; class TotalSizeTooSmall : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":1}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); // (first byte of size)-- set(ret, 0, get(ret, 0) - 1); @@ -844,10 +844,10 @@ class TotalSizeTooSmall : public Base { }; class EooMissing : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":1}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); set(ret, ret.objsize() - 1, (char)0xff); // (first byte of size)-- @@ -873,10 +873,10 @@ class WrongStringSize : public Base { }; class ZeroStringSize : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":\"b\"}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); set(ret, 7, 0); return ret; @@ -884,10 +884,10 @@ class ZeroStringSize : public Base { }; class NegativeStringSize : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":\"b\"}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); set(ret, 10, -100); return ret; @@ -895,10 +895,10 @@ class NegativeStringSize : public Base { }; class WrongSubobjectSize : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":{\"b\":1}}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); set(ret, 0, get(ret, 0) + 1); set(ret, 7, get(ret, 7) + 1); @@ -907,10 +907,10 @@ class WrongSubobjectSize : public Base { }; class WrongDbrefNsSize : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{ \"a\": Dbref( \"b\", \"ffffffffffffffffffffffff\" ) }"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); set(ret, 0, get(ret, 0) + 1); set(ret, 7, get(ret, 7) + 1); @@ -919,10 +919,10 @@ class WrongDbrefNsSize : public Base { }; class NoFieldNameEnd : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":1}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); memset(const_cast(ret.objdata()) + 5, 0xff, ret.objsize() - 5); return ret; @@ -930,10 +930,10 @@ class NoFieldNameEnd : public Base { }; class BadRegex : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":/c/i}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); memset(const_cast(ret.objdata()) + 7, 0xff, ret.objsize() - 7); return ret; @@ -941,10 +941,10 @@ class BadRegex : public Base { }; class BadRegexOptions : public Base { - BSONObj valid() const { + BSONObj valid() const override { return fromjson("{\"a\":/c/i}"); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); memset(const_cast(ret.objdata()) + 9, 0xff, ret.objsize() - 9); return ret; @@ -952,14 +952,14 @@ class BadRegexOptions : public Base { }; class CodeWScopeBase : public Base { - BSONObj valid() const { + BSONObj valid() const override { BSONObjBuilder b; BSONObjBuilder scope; scope.append("a", "b"); b.appendCodeWScope("c", "d", scope.done()); return b.obj(); } - BSONObj invalid() const { + BSONObj invalid() const override { BSONObj ret = valid(); modify(ret); return ret; @@ -970,37 +970,37 @@ protected: }; class CodeWScopeSmallSize : public CodeWScopeBase { - void modify(BSONObj& o) const { + void modify(BSONObj& o) const override { set(o, 7, 7); } }; class CodeWScopeZeroStrSize : public CodeWScopeBase { - void modify(BSONObj& o) const { + void modify(BSONObj& o) const override { set(o, 11, 0); } }; class CodeWScopeSmallStrSize : public CodeWScopeBase { - void modify(BSONObj& o) const { + void modify(BSONObj& o) const override { set(o, 11, 1); } }; class CodeWScopeNoSizeForObj : public CodeWScopeBase { - void modify(BSONObj& o) const { + void modify(BSONObj& o) const override { set(o, 7, 13); } }; class CodeWScopeSmallObjSize : public CodeWScopeBase { - void modify(BSONObj& o) const { + void modify(BSONObj& o) const override { set(o, 17, 1); } }; class CodeWScopeBadObject : public CodeWScopeBase { - void modify(BSONObj& o) const { + void modify(BSONObj& o) const override { set(o, 21, JSTypeMax + 1); } }; @@ -1133,22 +1133,22 @@ protected: }; class LabelBasic : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("a" << (BSON("$gt" << 1))); } - BSONObj actual() { + BSONObj actual() override { return BSON("a" << GT << 1); } }; class LabelShares : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("z" << "q" << "a" << (BSON("$gt" << 1)) << "x" << "p"); } - BSONObj actual() { + BSONObj actual() override { return BSON("z" << "q" << "a" << GT << 1 << "x" @@ -1157,17 +1157,17 @@ class LabelShares : public LabelBase { }; class LabelDouble : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("a" << (BSON("$gt" << 1 << "$lte" << "x"))); } - BSONObj actual() { + BSONObj actual() override { return BSON("a" << GT << 1 << LTE << "x"); } }; class LabelDoubleShares : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("z" << "q" << "a" @@ -1176,7 +1176,7 @@ class LabelDoubleShares : public LabelBase { << "x" << "p"); } - BSONObj actual() { + BSONObj actual() override { return BSON("z" << "q" << "a" << GT << 1 << LTE << "x" @@ -1186,16 +1186,16 @@ class LabelDoubleShares : public LabelBase { }; class LabelSize : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("a" << BSON("$size" << 4)); } - BSONObj actual() { + BSONObj actual() override { return BSON("a" << mongo::BSIZE << 4); } }; class LabelMulti : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("z" << "q" << "a" @@ -1208,7 +1208,7 @@ class LabelMulti : public LabelBase { << "x" << "p"); } - BSONObj actual() { + BSONObj actual() override { return BSON("z" << "q" << "a" << GT << 1 << LTE << "x" @@ -1217,7 +1217,7 @@ class LabelMulti : public LabelBase { } }; class LabelishOr : public LabelBase { - BSONObj expected() { + BSONObj expected() override { return BSON("$or" << BSON_ARRAY(BSON("a" << BSON("$gt" << 1 << "$lte" << "x")) << BSON("b" << BSON("$ne" << 1 << "$ne" @@ -1226,7 +1226,7 @@ class LabelishOr : public LabelBase { << BSON("x" << "p"))); } - BSONObj actual() { + BSONObj actual() override { return BSON(OR(BSON("a" << GT << 1 << LTE << "x"), BSON("b" << NE << 1 << NE << "f" << NE << 22.3), BSON("x" @@ -1973,7 +1973,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("jsobj") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp index 579d56a7a07..869081a120e 100644 --- a/src/mongo/dbtests/jstests.cpp +++ b/src/mongo/dbtests/jstests.cpp @@ -1494,7 +1494,7 @@ public: add>(); } - void setupTests() { + void setupTests() override { setupTestsWithScopeFactory<&ScriptEngine::newScope>(); setupTestsWithScopeFactory<&ScriptEngine::newScopeForCurrentThread>(); } diff --git a/src/mongo/dbtests/logical_sessions_tests.cpp b/src/mongo/dbtests/logical_sessions_tests.cpp index a672f0fec5a..647e9f49498 100644 --- a/src/mongo/dbtests/logical_sessions_tests.cpp +++ b/src/mongo/dbtests/logical_sessions_tests.cpp @@ -281,7 +281,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("logical_sessions") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/matchertests.cpp b/src/mongo/dbtests/matchertests.cpp index 3d069b567c0..a42a38cc292 100644 --- a/src/mongo/dbtests/matchertests.cpp +++ b/src/mongo/dbtests/matchertests.cpp @@ -327,7 +327,7 @@ public: #define ADD_BOTH(TEST) add>(); - void setupTests() { + void setupTests() override { ADD_BOTH(Basic); ADD_BOTH(DoubleEqual); ADD_BOTH(MixedNumericEqual); diff --git a/src/mongo/dbtests/mock/mock_conn_registry.h b/src/mongo/dbtests/mock/mock_conn_registry.h index b775adf5021..93135c06655 100644 --- a/src/mongo/dbtests/mock/mock_conn_registry.h +++ b/src/mongo/dbtests/mock/mock_conn_registry.h @@ -111,7 +111,7 @@ private: * replSet and making sure that it lives longer than this object. */ MockConnHook(MockConnRegistry* registry); - ~MockConnHook(); + ~MockConnHook() override; std::unique_ptr connect( const mongo::ConnectionString& connString, diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index 5608063de15..a6e91a60def 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -124,7 +124,7 @@ public: * this connection to fall into a failed state. */ MockDBClientConnection(MockRemoteDBServer* remoteServer, bool autoReconnect = false); - virtual ~MockDBClientConnection(); + ~MockDBClientConnection() override; // // DBClientBase methods diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp index b3f00301b2d..6faef498086 100644 --- a/src/mongo/dbtests/pdfiletests.cpp +++ b/src/mongo/dbtests/pdfiletests.cpp @@ -183,7 +183,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("pdfile") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp index 34383814ffa..55322c9d914 100644 --- a/src/mongo/dbtests/plan_ranking.cpp +++ b/src/mongo/dbtests/plan_ranking.cpp @@ -232,7 +232,7 @@ public: internalQueryPlanEvaluationMaxResults.store(100); } - ~PlanRankingPreferNonFailed() { + ~PlanRankingPreferNonFailed() override { internalQueryMaxBlockingSortMemoryUsageBytes.store( _internalQueryMaxBlockingSortMemoryUsageBytes); internalQueryPlanEvaluationMaxResults.store(_internalQueryPlanEvaluationMaxResults); @@ -721,7 +721,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_plan_ranking") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index 5d58d5a1ceb..6c0fba729ac 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -95,7 +95,7 @@ class PlanExecutorTest : public unittest::Test { public: PlanExecutorTest() : _client(&_opCtx) {} - virtual ~PlanExecutorTest() { + ~PlanExecutorTest() override { _client.dropCollection(nss); } diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp index a04f2c11a59..76062e0fdd6 100644 --- a/src/mongo/dbtests/query_stage_and.cpp +++ b/src/mongo/dbtests/query_stage_and.cpp @@ -1353,7 +1353,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_and") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_batched_delete.cpp b/src/mongo/dbtests/query_stage_batched_delete.cpp index dc66af6acef..665fdb89da7 100644 --- a/src/mongo/dbtests/query_stage_batched_delete.cpp +++ b/src/mongo/dbtests/query_stage_batched_delete.cpp @@ -148,7 +148,7 @@ public: service->setOpObserver(std::move(opObserverUniquePtr)); } - virtual ~QueryStageBatchedDeleteTest() { + ~QueryStageBatchedDeleteTest() override { _client.dropCollection(nss); } diff --git a/src/mongo/dbtests/query_stage_cached_plan.cpp b/src/mongo/dbtests/query_stage_cached_plan.cpp index 442b017ed1a..49b87918dc4 100644 --- a/src/mongo/dbtests/query_stage_cached_plan.cpp +++ b/src/mongo/dbtests/query_stage_cached_plan.cpp @@ -113,7 +113,7 @@ class QueryStageCachedPlan : public unittest::Test { public: QueryStageCachedPlan() : _client(&_opCtx) {} - void setUp() { + void setUp() override { // If collection exists already, we need to drop it. dropCollection(); diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp index 71025c0f8e0..db3bbfe256a 100644 --- a/src/mongo/dbtests/query_stage_collscan.cpp +++ b/src/mongo/dbtests/query_stage_collscan.cpp @@ -126,7 +126,7 @@ public: } } - virtual ~QueryStageCollectionScanTest() { + ~QueryStageCollectionScanTest() override { dbtests::WriteContextForTests ctx(&_opCtx, kNss.ns_forTest()); _client.dropCollection(kNss); } diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp index 1f1e7db50a9..9fd911a55e8 100644 --- a/src/mongo/dbtests/query_stage_count.cpp +++ b/src/mongo/dbtests/query_stage_count.cpp @@ -338,7 +338,7 @@ public: } // This is called 100 times as we scan the collection - void interject(CountStage&, int) { + void interject(CountStage&, int) override { insert(BSON(GENOID << "x" << 1)); } }; @@ -356,7 +356,7 @@ public: } // At the point which this is called we are in between counting the first + second record - void interject(CountStage& count_stage, int interjection) { + void interject(CountStage& count_stage, int interjection) override { if (interjection == 0) { // At this point, our first interjection, we've counted _recordIds[0] // and are about to count _recordIds[1] @@ -385,7 +385,7 @@ public: } // At the point which this is called we are in between the first and second record - void interject(CountStage& count_stage, int interjection) { + void interject(CountStage& count_stage, int interjection) override { if (interjection == 0) { OID id1 = _coll->docFor(&_opCtx, _recordIds[0]).value().getField("_id").OID(); update(_recordIds[0], BSON("_id" << id1 << "x" << 100)); @@ -404,7 +404,7 @@ public: testCount(request, kDocuments + 1, true); // only applies to indexed case } - void interject(CountStage&, int) { + void interject(CountStage&, int) override { // Should cause index to be converted to multikey insert(BSON(GENOID << "x" << BSON_ARRAY(1 << 2))); } @@ -414,7 +414,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_count") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_count_scan.cpp b/src/mongo/dbtests/query_stage_count_scan.cpp index 3ba95299e6c..235715039e5 100644 --- a/src/mongo/dbtests/query_stage_count_scan.cpp +++ b/src/mongo/dbtests/query_stage_count_scan.cpp @@ -631,7 +631,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_count_scan") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_delete.cpp b/src/mongo/dbtests/query_stage_delete.cpp index 109b9f22d97..4ae19cc2bce 100644 --- a/src/mongo/dbtests/query_stage_delete.cpp +++ b/src/mongo/dbtests/query_stage_delete.cpp @@ -282,7 +282,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_delete") {} - void setupTests() { + void setupTests() override { // Stage-specific tests below. add(); add(); diff --git a/src/mongo/dbtests/query_stage_distinct.cpp b/src/mongo/dbtests/query_stage_distinct.cpp index 82d5ff68081..8291a0b8a92 100644 --- a/src/mongo/dbtests/query_stage_distinct.cpp +++ b/src/mongo/dbtests/query_stage_distinct.cpp @@ -130,7 +130,7 @@ private: // Tests distinct with single key indices. class QueryStageDistinctBasic : public DistinctBase { public: - virtual ~QueryStageDistinctBasic() {} + ~QueryStageDistinctBasic() override {} void run() { // Insert a ton of documents with a: 1 @@ -197,7 +197,7 @@ public: // Tests distinct with multikey indices. class QueryStageDistinctMultiKey : public DistinctBase { public: - virtual ~QueryStageDistinctMultiKey() {} + ~QueryStageDistinctMultiKey() override {} void run() { // Insert a ton of documents with a: [1, 2, 3] @@ -332,7 +332,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_distinct") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp index d53ca34bebe..f844ab092b9 100644 --- a/src/mongo/dbtests/query_stage_fetch.cpp +++ b/src/mongo/dbtests/query_stage_fetch.cpp @@ -254,7 +254,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_fetch") {} - void setupTests() { + void setupTests() override { add(); add(); } diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp index a076e76da5d..111e8d9b71d 100644 --- a/src/mongo/dbtests/query_stage_ixscan.cpp +++ b/src/mongo/dbtests/query_stage_ixscan.cpp @@ -354,7 +354,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_ixscan") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_limit_skip.cpp b/src/mongo/dbtests/query_stage_limit_skip.cpp index 8d11e67fe79..898177d22d7 100644 --- a/src/mongo/dbtests/query_stage_limit_skip.cpp +++ b/src/mongo/dbtests/query_stage_limit_skip.cpp @@ -139,7 +139,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_limit_skip") {} - void setupTests() { + void setupTests() override { add(); } }; diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp index a6a67bf841d..7ed7f17284e 100644 --- a/src/mongo/dbtests/query_stage_merge_sort.cpp +++ b/src/mongo/dbtests/query_stage_merge_sort.cpp @@ -953,7 +953,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_merge_sort_test") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp index 6df3651b76c..bd35041bcc3 100644 --- a/src/mongo/dbtests/query_stage_multiplan.cpp +++ b/src/mongo/dbtests/query_stage_multiplan.cpp @@ -143,7 +143,7 @@ public: _client.dropCollection(nss); } - virtual ~QueryStageMultiPlanTest() { + ~QueryStageMultiPlanTest() override { dbtests::WriteContextForTests ctx(_opCtx.get(), nss.ns_forTest()); _client.dropCollection(nss); } @@ -768,7 +768,7 @@ TEST_F(QueryStageMultiPlanTest, ShouldReportErrorIfKilledDuringPlanning) { */ class ThrowyPlanStage : public PlanStage { protected: - StageState doWork(WorkingSetID* out) { + StageState doWork(WorkingSetID* out) override { uasserted(ErrorCodes::InternalError, "Mwahahaha! You've fallen into my trap."); } @@ -780,10 +780,10 @@ public: StageType stageType() const final { return STAGE_UNKNOWN; } - virtual std::unique_ptr getStats() final { + std::unique_ptr getStats() final { return nullptr; } - virtual const SpecificStats* getSpecificStats() const final { + const SpecificStats* getSpecificStats() const final { return nullptr; } }; diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp index d8e37de3bef..1841fac174e 100644 --- a/src/mongo/dbtests/query_stage_near.cpp +++ b/src/mongo/dbtests/query_stage_near.cpp @@ -143,8 +143,8 @@ public: _intervals.push_back(std::make_unique(data, min, max)); } - virtual std::unique_ptr nextInterval(OperationContext* opCtx, - WorkingSet* workingSet) final { + std::unique_ptr nextInterval(OperationContext* opCtx, + WorkingSet* workingSet) final { if (_pos == static_cast(_intervals.size())) return nullptr; @@ -173,9 +173,9 @@ public: return member->doc.value()["distance"].getDouble(); } - virtual StageState initialize(OperationContext* opCtx, - WorkingSet* workingSet, - WorkingSetID* out) { + StageState initialize(OperationContext* opCtx, + WorkingSet* workingSet, + WorkingSetID* out) override { return IS_EOF; } diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index ddca38bcd1e..b3e0bf91196 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -296,7 +296,7 @@ protected: // Sort some small # of results in increasing order. class QueryStageSortInc : public QueryStageSortTestBase { public: - virtual int numObj() { + int numObj() override { return 100; } @@ -319,7 +319,7 @@ public: // Sort some small # of results in decreasing order. class QueryStageSortDec : public QueryStageSortTestBase { public: - virtual int numObj() { + int numObj() override { return 100; } @@ -343,7 +343,7 @@ public: template class QueryStageSortDecWithLimit : public QueryStageSortDec { public: - virtual int limit() const { + int limit() const override { return LIMIT; } }; @@ -351,7 +351,7 @@ public: // Sort a big bunch of objects. class QueryStageSortExt : public QueryStageSortTestBase { public: - virtual int numObj() { + int numObj() override { return 10000; } @@ -374,10 +374,10 @@ public: // Mutation invalidation of docs fed to sort. class QueryStageSortMutationInvalidation : public QueryStageSortTestBase { public: - virtual int numObj() { + int numObj() override { return 2000; } - virtual int limit() const { + int limit() const override { return 10; } @@ -509,7 +509,7 @@ public: // Deletion invalidation of everything fed to sort. class QueryStageSortDeletionInvalidation : public QueryStageSortTestBase { public: - virtual int numObj() { + int numObj() override { return 2000; } @@ -609,7 +609,7 @@ public: template class QueryStageSortDeletionInvalidationWithLimit : public QueryStageSortDeletionInvalidation { public: - virtual int limit() const { + int limit() const override { return LIMIT; } }; @@ -617,7 +617,7 @@ public: // Should error out if we sort with parallel arrays. class QueryStageSortParallelArrays : public QueryStageSortTestBase { public: - virtual int numObj() { + int numObj() override { return 100; } @@ -691,7 +691,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_sort") {} - void setupTests() { + void setupTests() override { add(); add(); // Sort with limit has a general limiting strategy for limit > 1 diff --git a/src/mongo/dbtests/query_stage_subplan.cpp b/src/mongo/dbtests/query_stage_subplan.cpp index a9f9eee92ef..a50ed9b91cb 100644 --- a/src/mongo/dbtests/query_stage_subplan.cpp +++ b/src/mongo/dbtests/query_stage_subplan.cpp @@ -86,7 +86,7 @@ class QueryStageSubplanTest : public unittest::Test { public: QueryStageSubplanTest() : _client(_opCtx.get()) {} - virtual ~QueryStageSubplanTest() { + ~QueryStageSubplanTest() override { dbtests::WriteContextForTests ctx(opCtx(), nss.ns_forTest()); _client.dropCollection(nss); } diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp index fed4b771a7e..9525e1fbc4f 100644 --- a/src/mongo/dbtests/query_stage_tests.cpp +++ b/src/mongo/dbtests/query_stage_tests.cpp @@ -181,7 +181,7 @@ private: class QueryStageIXScanBasic : public IndexScanBase { public: - virtual ~QueryStageIXScanBasic() {} + ~QueryStageIXScanBasic() override {} void run() { // foo <= 20 @@ -195,7 +195,7 @@ public: class QueryStageIXScanLowerUpper : public IndexScanBase { public: - virtual ~QueryStageIXScanLowerUpper() {} + ~QueryStageIXScanLowerUpper() override {} void run() { // 20 <= foo < 30 @@ -211,7 +211,7 @@ public: class QueryStageIXScanLowerUpperIncl : public IndexScanBase { public: - virtual ~QueryStageIXScanLowerUpperIncl() {} + ~QueryStageIXScanLowerUpperIncl() override {} void run() { // 20 <= foo <= 30 @@ -225,7 +225,7 @@ public: class QueryStageIXScanLowerUpperInclFilter : public IndexScanBase { public: - virtual ~QueryStageIXScanLowerUpperInclFilter() {} + ~QueryStageIXScanLowerUpperInclFilter() override {} void run() { // 20 <= foo < 30 @@ -240,7 +240,7 @@ public: class QueryStageIXScanCantMatch : public IndexScanBase { public: - virtual ~QueryStageIXScanCantMatch() {} + ~QueryStageIXScanCantMatch() override {} void run() { // 20 <= foo < 30 @@ -257,7 +257,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_tests") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp index 746e3de89cf..8ecb01cb647 100644 --- a/src/mongo/dbtests/query_stage_update.cpp +++ b/src/mongo/dbtests/query_stage_update.cpp @@ -591,7 +591,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query_stage_update") {} - void setupTests() { + void setupTests() override { // Stage-specific tests below. add(); add(); diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index 3d3652cfb60..dd30110a107 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -2035,7 +2035,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("query") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/replica_set_tests.cpp b/src/mongo/dbtests/replica_set_tests.cpp index 8f5d86fdb56..42dabbe729c 100644 --- a/src/mongo/dbtests/replica_set_tests.cpp +++ b/src/mongo/dbtests/replica_set_tests.cpp @@ -60,7 +60,7 @@ ServiceContext::UniqueOperationContext makeOpCtx() { class ReplicaSetTest : public mongo::unittest::Test { protected: - void setUp() { + void setUp() override { auto opCtx = makeOpCtx(); _storageInterface = std::make_unique(); _dropPendingCollectionReaper = @@ -79,7 +79,7 @@ protected: ASSERT_OK(_replCoordExternalState->createLocalLastVoteCollection(opCtx.get())); } - void tearDown() { + void tearDown() override { auto opCtx = makeOpCtx(); DBDirectClient client(opCtx.get()); client.dropCollection(NamespaceString::kLastVoteNamespace); diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index d74d634afb7..53e80daf4ed 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -456,26 +456,26 @@ protected: // SECONDARY. This includes duplicate inserts and deletes. class Recovering : public Base { protected: - virtual OplogApplication::Mode getOplogApplicationMode() { + OplogApplication::Mode getOplogApplicationMode() override { return OplogApplication::Mode::kUnstableRecovering; } }; class InsertTimestamp : public Recovering { public: - void doIt() const { + void doIt() const override { BSONObjBuilder b; b.append("a", 1); b.appendTimestamp("t"); _client.insert(nss(), b.done()); date_ = _client.findOne(nss(), BSON("a" << 1)).getField("t").date(); } - void check() const { + void check() const override { BSONObj o = _client.findOne(nss(), BSON("a" << 1)); ASSERT(Date_t{} != o.getField("t").date()); ASSERT_EQUALS(date_, o.getField("t").date()); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -486,13 +486,13 @@ private: class InsertAutoId : public Recovering { public: InsertAutoId() : o_(fromjson("{\"a\":\"b\"}")) {} - void doIt() const { + void doIt() const override { _client.insert(nss(), o_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -505,7 +505,7 @@ public: InsertWithId() { o_ = fromjson("{\"_id\":ObjectId(\"0f0f0f0f0f0f0f0f0f0f0f0f\"),\"a\":\"b\"}"); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(o_); } @@ -514,18 +514,18 @@ public: class InsertTwo : public Recovering { public: InsertTwo() : o_(fromjson("{'_id':1,a:'b'}")), t_(fromjson("{'_id':2,c:'d'}")) {} - void doIt() const { + void doIt() const override { std::vector v; v.push_back(o_); v.push_back(t_); _client.insert(nss(), v); } - void check() const { + void check() const override { ASSERT_EQUALS(2, count()); checkOne(o_); checkOne(t_); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -537,14 +537,14 @@ private: class InsertTwoIdentical : public Recovering { public: InsertTwoIdentical() : o_(fromjson("{\"a\":\"b\"}")) {} - void doIt() const { + void doIt() const override { _client.insert(nss(), o_); _client.insert(nss(), o_); } - void check() const { + void check() const override { ASSERT_EQUALS(2, count()); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -554,19 +554,19 @@ private: class UpdateTimestamp : public Base { public: - void doIt() const { + void doIt() const override { BSONObjBuilder b; b.append("_id", 1); b.appendTimestamp("t"); _client.update(nss(), BSON("_id" << 1), b.done()); date_ = _client.findOne(nss(), BSON("_id" << 1)).getField("t").date(); } - void check() const { + void check() const override { BSONObj o = _client.findOne(nss(), BSON("_id" << 1)); ASSERT(Date_t{} != o.getField("t").date()); ASSERT_EQUALS(date_, o.getField("t").date()); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(BSON("_id" << 1)); } @@ -582,15 +582,15 @@ public: o1_(wid("{a:'b'}")), o2_(wid("{a:'b'}")), u_(fromjson("{a:'c'}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(2, count()); ASSERT(!_client.findOne(nss(), q_).isEmpty()); ASSERT(!_client.findOne(nss(), u_).isEmpty()); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o1_); insert(o2_); @@ -606,15 +606,15 @@ public: : o_(fromjson("{'_id':1,a:'b'}")), q_(fromjson("{a:'b'}")), u_(fromjson("{'_id':1,a:'c'}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(2, count()); ASSERT(!_client.findOne(nss(), q_).isEmpty()); ASSERT(!_client.findOne(nss(), u_).isEmpty()); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); insert(fromjson("{'_id':2,a:'b'}")); @@ -628,14 +628,14 @@ class UpdateSameFieldExplicitId : public Base { public: UpdateSameFieldExplicitId() : o_(fromjson("{'_id':1,a:'b'}")), u_(fromjson("{'_id':1,a:'c'}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), o_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(u_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -650,14 +650,14 @@ public: : o_(fromjson("{'_id':1,a:'b'}")), q_(fromjson("{'_id':1}")), u_(fromjson("{'_id':1,a:'c'}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(u_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -667,13 +667,13 @@ protected: }; class UpsertUpdateNoMods : public UpdateDifferentFieldExplicitId { - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_, true); } }; class UpsertInsertNoMods : public InsertAutoId { - void doIt() const { + void doIt() const override { _client.update(nss(), fromjson("{a:'c'}"), o_, true); } }; @@ -685,14 +685,14 @@ public: q_(fromjson("{a:5}")), u_(fromjson("{$set:{a:7}}")), ou_(fromjson("{'_id':1,a:7}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(ou_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -708,14 +708,14 @@ public: q_(fromjson("{a:5}")), u_(fromjson("{$inc:{a:3}}")), ou_(fromjson("{'_id':1,a:8}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(ou_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -731,14 +731,14 @@ public: q_(fromjson("{a:5}")), u_(fromjson("{$inc:{a:3},$set:{x:5}}")), ou_(fromjson("{'_id':1,a:8,x:5}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(ou_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -754,14 +754,14 @@ public: q_(fromjson("{'_id':1}")), u_(fromjson("{$inc:{'a.b':1,'b.b':1}}")), ou_(fromjson("{'_id':1,a:{b:4},b:{b:2}}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(ou_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -777,14 +777,14 @@ public: q_(fromjson("{'_id':1}")), u_(fromjson("{$inc:{'a':1}}")), ou_(fromjson("{'_id':1,a:1}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(ou_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o_); } @@ -800,14 +800,14 @@ public: : q_(fromjson("{'_id':5,a:4}")), u_(fromjson("{$inc:{a:3}}")), ou_(fromjson("{'_id':5,a:7}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_, true); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(ou_); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -819,14 +819,14 @@ class UpsertInsertSet : public Recovering { public: UpsertInsertSet() : q_(fromjson("{a:5}")), u_(fromjson("{$set:{a:7}}")), ou_(fromjson("{a:7}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_, true); } - void check() const { + void check() const override { ASSERT_EQUALS(2, count()); ASSERT(!_client.findOne(nss(), ou_).isEmpty()); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':7,a:7}")); } @@ -839,14 +839,14 @@ class UpsertInsertInc : public Recovering { public: UpsertInsertInc() : q_(fromjson("{a:5}")), u_(fromjson("{$inc:{a:3}}")), ou_(fromjson("{a:8}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), q_, u_, true); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); ASSERT(!_client.findOne(nss(), ou_).isEmpty()); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -874,7 +874,7 @@ public: return ss.str(); } - void doIt() const { + void doIt() const override { _client.insert(nss(), BSON("_id" << 1 << "x" << 1)); _client.insert(nss(), BSON("_id" << 2 << "x" << 5)); @@ -890,11 +890,11 @@ public: check(); } - void check() const { + void check() const override { ASSERT_EQUALS("4,6", s()); } - void reset() const { + void reset() const override { deleteAll(ns()); } }; @@ -903,15 +903,15 @@ class UpdateWithoutPreexistingId : public Base { public: UpdateWithoutPreexistingId() : o_(fromjson("{a:5}")), u_(fromjson("{a:5}")), ot_(fromjson("{b:4}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), o_, u_); } - void check() const { + void check() const override { ASSERT_EQUALS(2, count()); checkOne(u_); checkOne(ot_); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(ot_); insert(o_); @@ -927,13 +927,13 @@ public: : o1_(f("{\"_id\":\"010101010101010101010101\",\"a\":\"b\"}")), o2_(f("{\"_id\":\"010101010101010101010102\",\"a\":\"b\"}")), q_(f("{\"a\":\"b\"}")) {} - void doIt() const { + void doIt() const override { _client.remove(nss(), q_); } - void check() const { + void check() const override { ASSERT_EQUALS(0, count()); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(o1_); insert(o2_); @@ -944,10 +944,10 @@ protected: }; class RemoveOne : public Remove { - void doIt() const { + void doIt() const override { _client.remove(nss(), q_, false /*removeMany*/); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); } }; @@ -955,15 +955,15 @@ class RemoveOne : public Remove { class FailingUpdate : public Recovering { public: FailingUpdate() : o_(fromjson("{'_id':1,a:'b'}")), u_(fromjson("{'_id':1,c:'d'}")) {} - void doIt() const { + void doIt() const override { _client.update(nss(), o_, u_); _client.insert(nss(), o_); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(o_); } - void reset() const { + void reset() const override { deleteAll(ns()); } @@ -973,18 +973,18 @@ protected: class SetNumToStr : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$set" << BSON("a" << "bcd"))); } - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); checkOne(BSON("_id" << 0 << "a" << "bcd")); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(BSON("_id" << 0 << "a" << 4.0)); } @@ -992,15 +992,15 @@ public: class Push : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << 5.0))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[4,5]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4]}")); } @@ -1008,15 +1008,15 @@ public: class PushUpsert : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << 5.0)), true); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[4,5]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4]}")); } @@ -1024,17 +1024,17 @@ public: class MultiPush : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << 5.0) << "$push" << BSON("b.c" << 6.0))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[4,5],b:{c:[6]}}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4]}")); } @@ -1042,69 +1042,69 @@ public: class EmptyPush : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << 5.0))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[5]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0}")); } }; class PushSlice : public Base { - void doIt() const { + void doIt() const override { _client.update( nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << BSON("$each" << BSON_ARRAY(3) << "$slice" << -2)))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0, a:[2,3]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(BSON("_id" << 0 << "a" << BSON_ARRAY(1 << 2))); } }; class PushSliceInitiallyInexistent : public Base { - void doIt() const { + void doIt() const override { _client.update( nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << BSON("$each" << BSON_ARRAY(1 << 2) << "$slice" << -2)))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0, a:[1,2] }"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(BSON("_id" << 0)); } }; class PushSliceToZero : public Base { - void doIt() const { + void doIt() const override { _client.update( nss(), BSON("_id" << 0), BSON("$push" << BSON("a" << BSON("$each" << BSON_ARRAY(3) << "$slice" << 0)))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0, a:[]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(BSON("_id" << 0)); } @@ -1112,15 +1112,15 @@ class PushSliceToZero : public Base { class Pull : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$pull" << BSON("a" << 4.0))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[5]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4,5]}")); } @@ -1128,15 +1128,15 @@ public: class PullNothing : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), BSON("$pull" << BSON("a" << 6.0))); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[4,5]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4,5]}")); } @@ -1144,15 +1144,15 @@ public: class PullAll : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$pullAll:{a:[4,5]}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[6]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4,5,6]}")); } @@ -1160,15 +1160,15 @@ public: class Pop : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$pop:{a:1}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[4,5]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4,5,6]}")); } @@ -1176,15 +1176,15 @@ public: class PopReverse : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$pop:{a:-1}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{'_id':0,a:[5,6]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[4,5,6]}")); } @@ -1192,15 +1192,15 @@ public: class BitOp : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$bit:{a:{and:2,or:8}}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(BSON("_id" << 0 << "a" << ((3 & 2) | 8)), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:3}")); } @@ -1208,17 +1208,17 @@ public: class Rename : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$rename:{a:'b'}}")); _client.update(nss(), BSON("_id" << 0), fromjson("{$set:{a:50}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); ASSERT_EQUALS(mutablebson::unordered(BSON("_id" << 0 << "a" << 50 << "b" << 3)), mutablebson::unordered(one(fromjson("{'_id':0}")))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:3}")); } @@ -1226,17 +1226,17 @@ public: class RenameReplace : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$rename:{a:'b'}}")); _client.update(nss(), BSON("_id" << 0), fromjson("{$set:{a:50}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); ASSERT_EQUALS(mutablebson::unordered(BSON("_id" << 0 << "a" << 50 << "b" << 3)), mutablebson::unordered(one(fromjson("{'_id':0}")))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:3,b:100}")); } @@ -1244,16 +1244,16 @@ public: class RenameOverwrite : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$rename:{a:'b'}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); ASSERT_EQUALS(mutablebson::unordered(BSON("_id" << 0 << "b" << 3 << "z" << 1)), mutablebson::unordered(one(fromjson("{'_id':0}")))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,z:1,a:3}")); } @@ -1261,15 +1261,15 @@ public: class NoRename : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$rename:{c:'b'},$set:{z:1}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(BSON("_id" << 0 << "a" << 3 << "z" << 1), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:3}")); } @@ -1277,15 +1277,15 @@ public: class NestedNoRename : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$rename:{'a.b':'c.d'},$set:{z:1}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(BSON("_id" << 0 << "z" << 1), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0}")); } @@ -1293,15 +1293,15 @@ public: class SingletonNoRename : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSONObj(), fromjson("{$rename:{a:'b'}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{_id:0,z:1}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,z:1}")); } @@ -1309,15 +1309,15 @@ public: class IndexedSingletonNoRename : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSONObj(), fromjson("{$rename:{a:'b'}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{_id:0,z:1}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); // Add an index on 'a'. This prevents the update from running 'in place'. ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), BSON("a" << 1))); @@ -1327,15 +1327,15 @@ public: class AddToSetEmptyMissing : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSON("_id" << 0), fromjson("{$addToSet:{a:{$each:[]}}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{_id:0,a:[]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0}")); } @@ -1347,7 +1347,7 @@ public: class ReplaySetPreexistingNoOpPull : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSONObj(), fromjson("{$unset:{z:1}}")); // This is logged as {$set:{'a.b':[]},$set:{z:1}}, which might not be @@ -1359,11 +1359,11 @@ public: _client.update(nss(), BSONObj(), fromjson("{$set:{a:1}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{_id:0,a:1,z:1}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:{b:[]},z:1}")); } @@ -1371,16 +1371,16 @@ public: class ReplayArrayFieldNotAppended : public Base { public: - void doIt() const { + void doIt() const override { _client.update(nss(), BSONObj(), fromjson("{$push:{'a.0.b':2}}")); _client.update(nss(), BSONObj(), fromjson("{$set:{'a.0':1}}")); } using ReplTests::Base::check; - void check() const { + void check() const override { ASSERT_EQUALS(1, count()); check(fromjson("{_id:0,a:[1,{b:[1]}]}"), one(fromjson("{'_id':0}"))); } - void reset() const { + void reset() const override { deleteAll(ns()); insert(fromjson("{'_id':0,a:[{b:[0]},{b:[1]}]}")); } @@ -1413,7 +1413,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("repl") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp index 47a43803792..0e724127e2d 100644 --- a/src/mongo/dbtests/rollbacktests.cpp +++ b/src/mongo/dbtests/rollbacktests.cpp @@ -747,7 +747,7 @@ public: add>(); } - void setupTests() { + void setupTests() override { addAll(); addAll(); addAll(); diff --git a/src/mongo/dbtests/socktests.cpp b/src/mongo/dbtests/socktests.cpp index 14ab247f9e4..02285c0f375 100644 --- a/src/mongo/dbtests/socktests.cpp +++ b/src/mongo/dbtests/socktests.cpp @@ -59,7 +59,7 @@ public: class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("sock") {} - void setupTests() { + void setupTests() override { add(); } }; diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp index 13cf9866677..eec7b2de5f3 100644 --- a/src/mongo/dbtests/threadedtests.cpp +++ b/src/mongo/dbtests/threadedtests.cpp @@ -100,12 +100,12 @@ class IsAtomicWordAtomic : public ThreadedTest<> { typedef typename _AtomicUInt::WordType WordType; _AtomicUInt target; - void subthread(int) { + void subthread(int) override { for (int i = 0; i < iterations; i++) { target.fetchAndAdd(WordType(1)); } } - void validate() { + void validate() override { ASSERT_EQUALS(target.load(), unsigned(nthreads * iterations)); _AtomicUInt u; @@ -191,7 +191,7 @@ private: char pad3[128]; AtomicWord k; - virtual void validate() { + void validate() override { if (once++ == 0) { // <= 1.35 we use a different rwmutex impl so worth noting std::cout << "Boost version : " << BOOST_VERSION << std::endl; @@ -212,7 +212,7 @@ private: } } AtomicWord done; - virtual void subthread(int x) { + void subthread(int x) override { if (x == 1) { watch(); return; @@ -296,7 +296,7 @@ private: Hotel _hotel; - virtual void subthread(int x) { + void subthread(int x) override { std::string threadName = (str::stream() << "ticketHolder" << x); Client::initThread(threadName.c_str(), getGlobalServiceContext()->getService()); auto opCtx = Client::getCurrent()->makeOperationContext(); @@ -326,7 +326,7 @@ private: } } - virtual void validate() { + void validate() override { // This should always be true, assuming that it takes < 1 sec for the hardware to process a // check-out/check-in Time for test is then ~ #threads / _nRooms * 2 seconds MONGO_verify(_hotel._maxRooms == _hotel._nRooms); @@ -340,7 +340,7 @@ class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("threading") {} - void setupTests() { + void setupTests() override { // Slack is a test to see how long it takes for another thread to pick up // and begin work after another relinquishes the lock. e.g. a spin lock // would have very little slack. diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp index 5209e5898bf..c6d921b6126 100644 --- a/src/mongo/dbtests/updatetests.cpp +++ b/src/mongo/dbtests/updatetests.cpp @@ -105,57 +105,57 @@ private: }; class ModId : public Fail { - BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$set:{'_id':4}}")); } }; class ModNonmodMix : public Fail { - BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$set:{a:4},z:3}")); } }; class InvalidMod : public Fail { - BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$awk:{a:4}}")); } }; class ModNotFirst : public Fail { - BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{z:3,$set:{a:4}}")); } }; class ModDuplicateFieldSpec : public Fail { - BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$set:{a:4},$inc:{a:1}}")); } }; class IncNonNumber : public Fail { - BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$inc:{a:'d'}}")); } }; class PushAllNonArray : public Fail { - BSONObj doIt() { + BSONObj doIt() override { _client.insert(nss(), fromjson("{a:[1]}")); return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$pushAll:{a:'d'}}")); } }; class PullAllNonArray : public Fail { - BSONObj doIt() { + BSONObj doIt() override { _client.insert(nss(), fromjson("{a:[1]}")); return _client.updateAcknowledged(nss(), BSONObj(), fromjson("{$pullAll:{a:'d'}}")); } }; class IncTargetNonNumber : public Fail { - BSONObj doIt() { + BSONObj doIt() override { _client.insert(nss(), fromjson("{a:'a'}")); return _client.updateAcknowledged(nss(), fromjson("{a:'a'}"), fromjson("{$inc:{a:1}}")); } @@ -550,7 +550,7 @@ public: class InvalidEmbeddedSet : public Fail { public: - virtual BSONObj doIt() { + BSONObj doIt() override { return _client.updateAcknowledged( nss(), BSONObj{} /*filter*/, BSON("$set" << BSON("a." << 1))); } @@ -1915,88 +1915,88 @@ class SingleTest : public Base { virtual BSONObj mod() = 0; virtual BSONObj after() = 0; - void dotest() { + void dotest() override { test(initial(), mod(), after()); } }; class inc1 : public SingleTest { - virtual BSONObj initial() { + BSONObj initial() override { return BSON("_id" << 1 << "x" << 1); } - virtual BSONObj mod() { + BSONObj mod() override { return BSON("$inc" << BSON("x" << 2)); } - virtual BSONObj after() { + BSONObj after() override { return BSON("_id" << 1 << "x" << 3); } - virtual const char* ns() { + const char* ns() override { return "unittests.inc1"; } }; class inc2 : public SingleTest { - virtual BSONObj initial() { + BSONObj initial() override { return BSON("_id" << 1 << "x" << 1); } - virtual BSONObj mod() { + BSONObj mod() override { return BSON("$inc" << BSON("x" << 2.5)); } - virtual BSONObj after() { + BSONObj after() override { return BSON("_id" << 1 << "x" << 3.5); } - virtual const char* ns() { + const char* ns() override { return "unittests.inc2"; } }; class inc3 : public SingleTest { - virtual BSONObj initial() { + BSONObj initial() override { return BSON("_id" << 1 << "x" << 537142123123LL); } - virtual BSONObj mod() { + BSONObj mod() override { return BSON("$inc" << BSON("x" << 2)); } - virtual BSONObj after() { + BSONObj after() override { return BSON("_id" << 1 << "x" << 537142123125LL); } - virtual const char* ns() { + const char* ns() override { return "unittests.inc3"; } }; class inc4 : public SingleTest { - virtual BSONObj initial() { + BSONObj initial() override { return BSON("_id" << 1 << "x" << 537142123123LL); } - virtual BSONObj mod() { + BSONObj mod() override { return BSON("$inc" << BSON("x" << 2LL)); } - virtual BSONObj after() { + BSONObj after() override { return BSON("_id" << 1 << "x" << 537142123125LL); } - virtual const char* ns() { + const char* ns() override { return "unittests.inc4"; } }; class inc5 : public SingleTest { - virtual BSONObj initial() { + BSONObj initial() override { return BSON("_id" << 1 << "x" << 537142123123LL); } - virtual BSONObj mod() { + BSONObj mod() override { return BSON("$inc" << BSON("x" << 2.0)); } - virtual BSONObj after() { + BSONObj after() override { return BSON("_id" << 1 << "x" << 537142123125LL); } - virtual const char* ns() { + const char* ns() override { return "unittests.inc5"; } }; class inc6 : public Base { - virtual const char* ns() { + const char* ns() override { return "unittests.inc6"; } @@ -2011,7 +2011,7 @@ class inc6 : public Base { return BSONObj(); } - void dotest() { + void dotest() override { long long start = std::numeric_limits::max() - 5; long long max = std::numeric_limits::max() + 5ll; @@ -2029,10 +2029,10 @@ class inc6 : public Base { }; class bit1 : public Base { - const char* ns() { + const char* ns() override { return "unittests.bit1"; } - void dotest() { + void dotest() override { test(BSON("_id" << 1 << "x" << 3), BSON("$bit" << BSON("x" << BSON("and" << 2))), BSON("_id" << 1 << "x" << (3 & 2))); @@ -2049,19 +2049,19 @@ class bit1 : public Base { }; class unset : public Base { - const char* ns() { + const char* ns() override { return "unittests.unset"; } - void dotest() { + void dotest() override { test("{_id:1,x:1}", "{$unset:{x:1}}", "{_id:1}"); } }; class setswitchint : public Base { - const char* ns() { + const char* ns() override { return "unittests.int1"; } - void dotest() { + void dotest() override { test(BSON("_id" << 1 << "x" << 1), BSON("$set" << BSON("x" << 5.6)), BSON("_id" << 1 << "x" << 5.6)); @@ -2075,7 +2075,7 @@ class setswitchint : public Base { class All : public unittest::OldStyleSuiteSpecification { public: All() : OldStyleSuiteSpecification("update") {} - void setupTests() { + void setupTests() override { add(); add(); add(); diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp index 421bf2913c3..88e117eae0c 100644 --- a/src/mongo/dbtests/validate_tests.cpp +++ b/src/mongo/dbtests/validate_tests.cpp @@ -4834,7 +4834,7 @@ class ValidateTests : public unittest::OldStyleSuiteSpecification { public: ValidateTests() : OldStyleSuiteSpecification("validate_tests") {} - void setupTests() { + void setupTests() override { // TODO SERVER-83593: re-enable background validation tests. // Add tests for both full validate and non-full validate. diff --git a/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp b/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp index 777f3fd5e1f..83fe992973c 100644 --- a/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp +++ b/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp @@ -119,7 +119,7 @@ public: _opCtx = cc().makeOperationContext(); } - virtual ~WildcardMultikeyPersistenceTestFixture() { + ~WildcardMultikeyPersistenceTestFixture() override { _opCtx.reset(); } diff --git a/src/mongo/embedded/api_common.h b/src/mongo/embedded/api_common.h index 0d080ff64f1..e43ab46b46a 100644 --- a/src/mongo/embedded/api_common.h +++ b/src/mongo/embedded/api_common.h @@ -79,13 +79,13 @@ class ExceptionForAPI : public std::exception { public: explicit ExceptionForAPI(const ErrorEnum code, std::string m) : _mesg(std::move(m)), _code(code) {} - virtual ~ExceptionForAPI() {} + ~ExceptionForAPI() override {} ErrorEnum statusCode() const noexcept { return this->_code; } - const char* what() const noexcept { + const char* what() const noexcept override { return this->_mesg.c_str(); } diff --git a/src/mongo/embedded/embedded_ismaster.cpp b/src/mongo/embedded/embedded_ismaster.cpp index afed30a889e..70337ad7db3 100644 --- a/src/mongo/embedded/embedded_ismaster.cpp +++ b/src/mongo/embedded/embedded_ismaster.cpp @@ -69,7 +69,7 @@ public: "{ isMaster : 1 }"; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -81,10 +81,10 @@ public: CmdIsMaster() : BasicCommand("isMaster", "ismaster") {} - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { auto wireSpec = WireSpec::getWireSpec(getGlobalServiceContext()).get(); diff --git a/src/mongo/embedded/index_builds_coordinator_embedded.h b/src/mongo/embedded/index_builds_coordinator_embedded.h index 45de4a47368..cb49abec3f4 100644 --- a/src/mongo/embedded/index_builds_coordinator_embedded.h +++ b/src/mongo/embedded/index_builds_coordinator_embedded.h @@ -118,7 +118,7 @@ private: std::shared_ptr replState) override; IndexBuildAction _drainSideWritesUntilNextActionIsAvailable( - OperationContext* opCtx, std::shared_ptr replState) { + OperationContext* opCtx, std::shared_ptr replState) override { return {}; }; diff --git a/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp b/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp index 3c1566f55ff..45675f17b56 100644 --- a/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp +++ b/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp @@ -115,7 +115,7 @@ using MongoDBCAPIClientPtr = std::unique_ptr previous, boost::optional deadline) override; - virtual SharedSemiFuture> getHelloResponseFuture( + SharedSemiFuture> getHelloResponseFuture( const repl::SplitHorizon::Parameters& horizonParams, - boost::optional clientTopologyVersion); + boost::optional clientTopologyVersion) override; StatusWith getLatestWriteOpTime(OperationContext* opCtx) const noexcept override; @@ -389,30 +389,30 @@ public: OnRemoteCmdScheduledFn onRemoteCmdScheduled, OnRemoteCmdCompleteFn onRemoteCmdComplete) final; - virtual void restartScheduledHeartbeats_forTest() override; + void restartScheduledHeartbeats_forTest() override; - virtual void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; + void recordIfCWWCIsSetOnConfigServerOnStartup(OperationContext* opCtx) final; class WriteConcernTagChangesEmbedded : public WriteConcernTagChanges { - virtual ~WriteConcernTagChangesEmbedded() = default; - virtual bool reserveDefaultWriteConcernChange() { + ~WriteConcernTagChangesEmbedded() override = default; + bool reserveDefaultWriteConcernChange() override { return false; }; - virtual void releaseDefaultWriteConcernChange() {} + void releaseDefaultWriteConcernChange() override {} - virtual bool reserveConfigWriteConcernTagChange() { + bool reserveConfigWriteConcernTagChange() override { return false; }; - virtual void releaseConfigWriteConcernTagChange() {} + void releaseConfigWriteConcernTagChange() override {} }; - virtual WriteConcernTagChanges* getWriteConcernTagChanges() override; + WriteConcernTagChanges* getWriteConcernTagChanges() override; - virtual repl::SplitPrepareSessionManager* getSplitPrepareSessionManager() override; + repl::SplitPrepareSessionManager* getSplitPrepareSessionManager() override; - virtual bool isRetryableWrite(OperationContext* opCtx) const override; + bool isRetryableWrite(OperationContext* opCtx) const override; - virtual boost::optional getInitialSyncId(OperationContext* opCtx) override; + boost::optional getInitialSyncId(OperationContext* opCtx) override; private: // Back pointer to the ServiceContext that has started the instance. diff --git a/src/mongo/embedded/service_entry_point_embedded.cpp b/src/mongo/embedded/service_entry_point_embedded.cpp index 652e9f27c73..85a25e40739 100644 --- a/src/mongo/embedded/service_entry_point_embedded.cpp +++ b/src/mongo/embedded/service_entry_point_embedded.cpp @@ -63,13 +63,13 @@ namespace mongo { namespace { class EmbeddedClientObserver final : public ServiceContext::ClientObserver { - void onCreateClient(Client* client) { + void onCreateClient(Client* client) override { auto seCtx = std::make_unique(); transport::ServiceExecutorContext::set(client, std::move(seCtx)); } - void onDestroyClient(Client*) {} - void onCreateOperationContext(OperationContext*) {} - void onDestroyOperationContext(OperationContext*) {} + void onDestroyClient(Client*) override {} + void onCreateOperationContext(OperationContext*) override {} + void onDestroyOperationContext(OperationContext*) override {} }; ServiceContext::ConstructorActionRegisterer registerClientObserverConstructor{ diff --git a/src/mongo/embedded/service_entry_point_embedded.h b/src/mongo/embedded/service_entry_point_embedded.h index 45b1bae9833..8b719c7004f 100644 --- a/src/mongo/embedded/service_entry_point_embedded.h +++ b/src/mongo/embedded/service_entry_point_embedded.h @@ -39,7 +39,7 @@ class ServiceEntryPointEmbedded final : public ServiceEntryPoint { public: ServiceEntryPointEmbedded(); - ~ServiceEntryPointEmbedded(); + ~ServiceEntryPointEmbedded() override; Future handleRequest(OperationContext* opCtx, const Message& request) noexcept override; diff --git a/src/mongo/embedded/transaction_resources_init_embedded.cpp b/src/mongo/embedded/transaction_resources_init_embedded.cpp index f25f5d6cc1e..b104150acc4 100644 --- a/src/mongo/embedded/transaction_resources_init_embedded.cpp +++ b/src/mongo/embedded/transaction_resources_init_embedded.cpp @@ -44,7 +44,7 @@ namespace { class TransactionResourcesEmbeddedClientObserver : public ServiceContext::ClientObserver { public: TransactionResourcesEmbeddedClientObserver() = default; - ~TransactionResourcesEmbeddedClientObserver() = default; + ~TransactionResourcesEmbeddedClientObserver() override = default; void onCreateClient(Client* client) final {} diff --git a/src/mongo/executor/async_rpc_retry_policy.h b/src/mongo/executor/async_rpc_retry_policy.h index d95ec473323..41c60ad4a08 100644 --- a/src/mongo/executor/async_rpc_retry_policy.h +++ b/src/mongo/executor/async_rpc_retry_policy.h @@ -68,15 +68,15 @@ public: class NeverRetryPolicy : public RetryPolicy { public: - bool recordAndEvaluateRetry(Status s) override final { + bool recordAndEvaluateRetry(Status s) final { return false; } - Milliseconds getNextRetryDelay() override final { + Milliseconds getNextRetryDelay() final { return Milliseconds::zero(); } - BSONObj toBSON() const override final { + BSONObj toBSON() const final { return BSON("retryPolicyType" << "NeverRetryPolicy"); } @@ -97,7 +97,7 @@ public: bool recordAndEvaluateRetry(Status status) override { return helpers::isAnyCategory(status); } - Milliseconds getNextRetryDelay() override final { + Milliseconds getNextRetryDelay() final { return _backoff.nextSleep(); } Backoff _backoff; diff --git a/src/mongo/executor/async_rpc_targeter.h b/src/mongo/executor/async_rpc_targeter.h index eadac59d168..4c66ad49583 100644 --- a/src/mongo/executor/async_rpc_targeter.h +++ b/src/mongo/executor/async_rpc_targeter.h @@ -69,14 +69,14 @@ class LocalHostTargeter : public Targeter { public: LocalHostTargeter() = default; - SemiFuture> resolve(CancellationToken t) override final { + SemiFuture> resolve(CancellationToken t) final { HostAndPort h = HostAndPort("localhost", serverGlobalParams.port); std::vector hostList{h}; return SemiFuture>::makeReady(hostList); } - SemiFuture onRemoteCommandError(HostAndPort h, Status s) override final { + SemiFuture onRemoteCommandError(HostAndPort h, Status s) final { return SemiFuture::makeReady(); } }; @@ -89,13 +89,13 @@ class FixedTargeter : public Targeter { public: FixedTargeter(HostAndPort host) : _host(host){}; - SemiFuture> resolve(CancellationToken t) override final { + SemiFuture> resolve(CancellationToken t) final { std::vector hostList{_host}; return SemiFuture>::makeReady(hostList); } - SemiFuture onRemoteCommandError(HostAndPort h, Status s) override final { + SemiFuture onRemoteCommandError(HostAndPort h, Status s) final { return SemiFuture::makeReady(); } diff --git a/src/mongo/executor/async_rpc_test_fixture.h b/src/mongo/executor/async_rpc_test_fixture.h index 88f2d56b261..fc440129cbb 100644 --- a/src/mongo/executor/async_rpc_test_fixture.h +++ b/src/mongo/executor/async_rpc_test_fixture.h @@ -56,7 +56,7 @@ using executor::ThreadPoolTaskExecutor; class TestRetryPolicy : public RetryPolicy { public: - bool recordAndEvaluateRetry(Status s) override final { + bool recordAndEvaluateRetry(Status s) final { if (_numRetriesPerformed == _maxRetries) { return false; } @@ -64,7 +64,7 @@ public: return true; } - Milliseconds getNextRetryDelay() override final { + Milliseconds getNextRetryDelay() final { auto&& out = _retryDelays.front(); _retryDelays.pop_front(); return out; @@ -74,7 +74,7 @@ public: _retryDelays.push_back(retryDelay); } - BSONObj toBSON() const override final { + BSONObj toBSON() const final { return BSON("retryPolicyType" << "TestRetryPolicy"); } @@ -183,11 +183,11 @@ private: class FailingTargeter : public Targeter { public: FailingTargeter(Status errorToFailWith) : _status{errorToFailWith} {} - SemiFuture> resolve(CancellationToken t) override final { + SemiFuture> resolve(CancellationToken t) final { return _status; } - SemiFuture onRemoteCommandError(HostAndPort h, Status s) override final { + SemiFuture onRemoteCommandError(HostAndPort h, Status s) final { return SemiFuture::makeReady(); } @@ -209,11 +209,11 @@ public: _resolvedHosts = resolvedHosts; }; - SemiFuture> resolve(CancellationToken t) override final { + SemiFuture> resolve(CancellationToken t) final { return SemiFuture>::makeReady(_resolvedHosts); } - SemiFuture onRemoteCommandError(HostAndPort h, Status s) override final { + SemiFuture onRemoteCommandError(HostAndPort h, Status s) final { return SemiFuture::makeReady(); } diff --git a/src/mongo/executor/connection_pool.h b/src/mongo/executor/connection_pool.h index 0dd9aece65d..f5bcadf9519 100644 --- a/src/mongo/executor/connection_pool.h +++ b/src/mongo/executor/connection_pool.h @@ -259,7 +259,7 @@ public: std::string name, Options options = Options{}); - ~ConnectionPool(); + ~ConnectionPool() override; void shutdown(); @@ -390,7 +390,7 @@ class ConnectionPool::ConnectionInterface : public TimerInterface { public: explicit ConnectionInterface(size_t generation) : _generation(generation) {} - virtual ~ConnectionInterface() = default; + ~ConnectionInterface() override = default; /** * Indicates that the user is now done with this connection. Users MUST call either diff --git a/src/mongo/executor/connection_pool_tl.cpp b/src/mongo/executor/connection_pool_tl.cpp index 2b05398de3a..08cf4a8ab4e 100644 --- a/src/mongo/executor/connection_pool_tl.cpp +++ b/src/mongo/executor/connection_pool_tl.cpp @@ -344,7 +344,7 @@ public: const std::shared_ptr transientSSLContext) : _transientSSLContext(transientSSLContext) {} - ~TransientInternalAuthParametersProvider() = default; + ~TransientInternalAuthParametersProvider() override = default; BSONObj get(size_t index, StringData mechanism) final { if (_transientSSLContext) { diff --git a/src/mongo/executor/connection_pool_tl.h b/src/mongo/executor/connection_pool_tl.h index 21ee8e3a074..fbda0eee1ba 100644 --- a/src/mongo/executor/connection_pool_tl.h +++ b/src/mongo/executor/connection_pool_tl.h @@ -134,7 +134,7 @@ public: explicit TLTimer(const std::shared_ptr& factory, const transport::ReactorHandle& reactor) : TLTypeFactory::Type(factory), _reactor(reactor), _timer(_reactor->makeTimer()) {} - ~TLTimer() { + ~TLTimer() override { // Release must be the first expression of this dtor release(); } @@ -176,7 +176,7 @@ public: _transientSSLContext(transientSSLContext), _connMetrics(serviceContext->getFastClockSource()) {} - ~TLConnection() { + ~TLConnection() override { // Release must be the first expression of this dtor release(); } diff --git a/src/mongo/executor/hedge_options_util_test.cpp b/src/mongo/executor/hedge_options_util_test.cpp index b80b4cc0452..2c8bfd9cd78 100644 --- a/src/mongo/executor/hedge_options_util_test.cpp +++ b/src/mongo/executor/hedge_options_util_test.cpp @@ -52,7 +52,7 @@ namespace { class HedgeOptionsUtilTestFixture : public unittest::Test { protected: - void setUp() { + void setUp() override { // Reset all the hedging server parameters. setParameters(kDefaultParameters); } diff --git a/src/mongo/executor/inline_executor.cpp b/src/mongo/executor/inline_executor.cpp index 30603c53379..822fad9e5e3 100644 --- a/src/mongo/executor/inline_executor.cpp +++ b/src/mongo/executor/inline_executor.cpp @@ -49,7 +49,7 @@ namespace { class Scheduler : public OutOfLineExecutor { public: explicit Scheduler(std::shared_ptr& state) : _state(state) {} - ~Scheduler() = default; + ~Scheduler() override = default; void schedule(OutOfLineExecutor::Task func) override { if (auto state = _state.lock()) { diff --git a/src/mongo/executor/network_interface_mock.h b/src/mongo/executor/network_interface_mock.h index 0101c9e814c..ec1721b0d7b 100644 --- a/src/mongo/executor/network_interface_mock.h +++ b/src/mongo/executor/network_interface_mock.h @@ -112,7 +112,7 @@ public: using NetworkResponseList = std::list; NetworkInterfaceMock(); - virtual ~NetworkInterfaceMock(); + ~NetworkInterfaceMock() override; //////////////////////////////////////////////////////////////////////////////// // diff --git a/src/mongo/executor/network_interface_mock_test_fixture.h b/src/mongo/executor/network_interface_mock_test_fixture.h index 662ca4c98fb..79a7ccfbaf5 100644 --- a/src/mongo/executor/network_interface_mock_test_fixture.h +++ b/src/mongo/executor/network_interface_mock_test_fixture.h @@ -63,8 +63,8 @@ public: } void startNetwork(); - virtual void setUp() override; - virtual void tearDown() override; + void setUp() override; + void tearDown() override; RemoteCommandRequestOnAny kUnimportantRequest{ {testHost()}, diff --git a/src/mongo/executor/network_interface_tl.h b/src/mongo/executor/network_interface_tl.h index 9d60e84aec4..1770b282807 100644 --- a/src/mongo/executor/network_interface_tl.h +++ b/src/mongo/executor/network_interface_tl.h @@ -91,7 +91,7 @@ public: ServiceContext* ctx, std::unique_ptr onConnectHook, std::unique_ptr metadataHook); - ~NetworkInterfaceTL(); + ~NetworkInterfaceTL() override; constexpr static Milliseconds kCancelCommandTimeout{1000}; @@ -258,7 +258,7 @@ private: CommandState(NetworkInterfaceTL* interface_, RemoteCommandRequestOnAny request_, const TaskExecutor::CallbackHandle& cbHandle_); - ~CommandState() = default; + ~CommandState() override = default; // Create a new CommandState in a shared_ptr // Prefer this over raw construction @@ -281,7 +281,7 @@ private: RemoteCommandRequestOnAny request_, const TaskExecutor::CallbackHandle& cbHandle_, RemoteCommandOnReplyFn&& onReply_); - virtual ~ExhaustCommandState() = default; + ~ExhaustCommandState() override = default; // Create a new ExhaustCommandState in a shared_ptr // Prefer this over raw construction diff --git a/src/mongo/executor/pinned_connection_task_executor.cpp b/src/mongo/executor/pinned_connection_task_executor.cpp index 32a63accd0d..09dd3f8f53a 100644 --- a/src/mongo/executor/pinned_connection_task_executor.cpp +++ b/src/mongo/executor/pinned_connection_task_executor.cpp @@ -70,7 +70,7 @@ public: CallbackState(const RemoteCommandOnAnyCallbackFn& cb, const BatonHandle& baton) : callback(cb), baton(baton) {} - virtual ~CallbackState() = default; + ~CallbackState() override = default; bool isCanceled() const override { MONGO_UNREACHABLE; diff --git a/src/mongo/executor/pinned_connection_task_executor.h b/src/mongo/executor/pinned_connection_task_executor.h index 46f56504eed..46db75decb1 100644 --- a/src/mongo/executor/pinned_connection_task_executor.h +++ b/src/mongo/executor/pinned_connection_task_executor.h @@ -102,7 +102,7 @@ public: PinnedConnectionTaskExecutor(const std::shared_ptr& executor, NetworkInterface* net); - ~PinnedConnectionTaskExecutor(); + ~PinnedConnectionTaskExecutor() override; // Startup is illegal to call, as the provided executor should already be started-up. void startup() override; void shutdown() override; diff --git a/src/mongo/executor/pinned_connection_task_executor_test_fixture.h b/src/mongo/executor/pinned_connection_task_executor_test_fixture.h index 423559340f5..dbc554dd99a 100644 --- a/src/mongo/executor/pinned_connection_task_executor_test_fixture.h +++ b/src/mongo/executor/pinned_connection_task_executor_test_fixture.h @@ -202,7 +202,7 @@ private: invariant(session); _client = std::make_shared(std::move(hp), std::move(session), nullptr); } - ~LeasedStream() { + ~LeasedStream() override { _fixture->_streamDestroyedCalls.fetchAndAdd(1); } AsyncDBClient* getClient() override { diff --git a/src/mongo/executor/scoped_task_executor.cpp b/src/mongo/executor/scoped_task_executor.cpp index ea194eefaa1..8604abfc604 100644 --- a/src/mongo/executor/scoped_task_executor.cpp +++ b/src/mongo/executor/scoped_task_executor.cpp @@ -79,7 +79,7 @@ public: Impl(std::shared_ptr executor, Status shutdownStatus) : _executor(std::move(executor)), _shutdownStatus(std::move(shutdownStatus)) {} - ~Impl() { + ~Impl() override { // The ScopedTaskExecutor dtor calls shutdown, so this is guaranteed. invariant(_inShutdown); } @@ -195,7 +195,7 @@ public: cb); } - bool hasTasks() { + bool hasTasks() override { return _executor->hasTasks(); } diff --git a/src/mongo/executor/task_executor.h b/src/mongo/executor/task_executor.h index 8772a6cb8e9..04139ac629a 100644 --- a/src/mongo/executor/task_executor.h +++ b/src/mongo/executor/task_executor.h @@ -132,7 +132,7 @@ public: * Destroys the task executor. Implicitly performs the equivalent of shutdown() and join() * before returning, if necessary. */ - virtual ~TaskExecutor(); + ~TaskExecutor() override; /** * Causes the executor to initialize its internal state (start threads if appropriate, create @@ -244,7 +244,7 @@ public: * Schedules the given Task to run in this executor. * Note that 'func' is implicitly noexcept and should not ever leak exceptions. */ - void schedule(OutOfLineExecutor::Task func) final override; + void schedule(OutOfLineExecutor::Task func) final; /** * Schedules "work" to be run by the executor ASAP. diff --git a/src/mongo/executor/task_executor_cursor_test.cpp b/src/mongo/executor/task_executor_cursor_test.cpp index cfc6acb7497..320cd4af704 100644 --- a/src/mongo/executor/task_executor_cursor_test.cpp +++ b/src/mongo/executor/task_executor_cursor_test.cpp @@ -781,7 +781,7 @@ public: BSONObj scheduleSuccessfulCursorResponse(StringData fieldName, size_t start, size_t end, - size_t cursorId) { + size_t cursorId) override { NetworkInterfaceMock::InNetworkGuard ing(getNet()); // Don't assert that the network has requests like we do in other classes. This is to enable // the test in 'NoPrefetchGetMore'. diff --git a/src/mongo/executor/task_executor_test_fixture.h b/src/mongo/executor/task_executor_test_fixture.h index fc9c9c514bf..3f83e0e2811 100644 --- a/src/mongo/executor/task_executor_test_fixture.h +++ b/src/mongo/executor/task_executor_test_fixture.h @@ -62,7 +62,7 @@ public: static RemoteCommandRequest assertRemoteCommandNameEquals(StringData cmdName, const RemoteCommandRequest& request); - virtual ~TaskExecutorTest(); + ~TaskExecutorTest() override; executor::NetworkInterfaceMock* getNet() { return _net; diff --git a/src/mongo/executor/test_network_connection_hook.h b/src/mongo/executor/test_network_connection_hook.h index c825903c7dc..ace63a1b7ac 100644 --- a/src/mongo/executor/test_network_connection_hook.h +++ b/src/mongo/executor/test_network_connection_hook.h @@ -57,11 +57,12 @@ public: return _validateFunc(remoteHost, request, helloReply); } - StatusWith> makeRequest(const HostAndPort& remoteHost) { + StatusWith> makeRequest( + const HostAndPort& remoteHost) override { return _requestFunc(remoteHost); } - Status handleReply(const HostAndPort& remoteHost, RemoteCommandResponse&& response) { + Status handleReply(const HostAndPort& remoteHost, RemoteCommandResponse&& response) override { return _replyFunc(remoteHost, std::move(response)); } diff --git a/src/mongo/executor/thread_pool_mock.h b/src/mongo/executor/thread_pool_mock.h index d5e171024cc..edebbc6775a 100644 --- a/src/mongo/executor/thread_pool_mock.h +++ b/src/mongo/executor/thread_pool_mock.h @@ -68,7 +68,7 @@ public: * generator that is used to determine which schedulable task runs next. */ ThreadPoolMock(NetworkInterfaceMock* net, int32_t prngSeed, Options options); - ~ThreadPoolMock(); + ~ThreadPoolMock() override; void startup() override; void shutdown() override; diff --git a/src/mongo/executor/thread_pool_task_executor.cpp b/src/mongo/executor/thread_pool_task_executor.cpp index 6f94a5dc0e8..131870a2e34 100644 --- a/src/mongo/executor/thread_pool_task_executor.cpp +++ b/src/mongo/executor/thread_pool_task_executor.cpp @@ -88,7 +88,7 @@ public: CallbackState(CallbackFn&& cb, Date_t theReadyDate, const BatonHandle& baton) : callback(std::move(cb)), readyDate(theReadyDate), baton(baton) {} - virtual ~CallbackState() = default; + ~CallbackState() override = default; bool isCanceled() const override { return canceled.load() > 0; diff --git a/src/mongo/executor/thread_pool_task_executor.h b/src/mongo/executor/thread_pool_task_executor.h index dd2b973ddbc..a4ee352a1e4 100644 --- a/src/mongo/executor/thread_pool_task_executor.h +++ b/src/mongo/executor/thread_pool_task_executor.h @@ -78,7 +78,7 @@ public: /** * Destroys a ThreadPoolTaskExecutor. */ - ~ThreadPoolTaskExecutor(); + ~ThreadPoolTaskExecutor() override; void startup() override; void shutdown() override; @@ -103,7 +103,7 @@ public: StatusWith scheduleExhaustRemoteCommandOnAny( const RemoteCommandRequestOnAny& request, const RemoteCommandOnAnyCallbackFn& cb, - const BatonHandle& baton = nullptr); + const BatonHandle& baton = nullptr) override; void cancel(const CallbackHandle& cbHandle) override; void wait(const CallbackHandle& cbHandle, Interruptible* interruptible = Interruptible::notInterruptible()) override; @@ -118,7 +118,7 @@ public: * Returns true if there are any tasks in any of _poolInProgressQueue, _networkInProgressQueue, * or _sleepersQueue. */ - bool hasTasks(); + bool hasTasks() override; private: class CallbackState; diff --git a/src/mongo/idl/cluster_server_parameter_initializer.h b/src/mongo/idl/cluster_server_parameter_initializer.h index fe169d6f744..9dddc906597 100644 --- a/src/mongo/idl/cluster_server_parameter_initializer.h +++ b/src/mongo/idl/cluster_server_parameter_initializer.h @@ -50,29 +50,28 @@ class ClusterServerParameterInitializer public: ClusterServerParameterInitializer() = default; - ~ClusterServerParameterInitializer() = default; + ~ClusterServerParameterInitializer() override = default; static ClusterServerParameterInitializer* get(OperationContext* opCtx); static ClusterServerParameterInitializer* get(ServiceContext* serviceContext); // Virtual methods coming from the ReplicaSetAwareService - void onStartup(OperationContext* opCtx) override final {} + void onStartup(OperationContext* opCtx) final {} - void onSetCurrentConfig(OperationContext* opCtx) override final {} + void onSetCurrentConfig(OperationContext* opCtx) final {} static void synchronizeAllParametersFromDisk(OperationContext* opCtx); /** * Called after startup recovery or initial sync is complete. */ - void onInitialDataAvailable(OperationContext* opCtx, - bool isMajorityDataAvailable) override final; - void onShutdown() override final {} - void onStepUpBegin(OperationContext* opCtx, long long term) override final {} - void onStepUpComplete(OperationContext* opCtx, long long term) override final {} - void onStepDown() override final {} - void onRollback() override final {} - void onBecomeArbiter() override final {} - inline std::string getServiceName() const override final { + void onInitialDataAvailable(OperationContext* opCtx, bool isMajorityDataAvailable) final; + void onShutdown() final {} + void onStepUpBegin(OperationContext* opCtx, long long term) final {} + void onStepUpComplete(OperationContext* opCtx, long long term) final {} + void onStepDown() final {} + void onRollback() final {} + void onBecomeArbiter() final {} + inline std::string getServiceName() const final { return "ClusterServerParameterInitializer"; } }; diff --git a/src/mongo/idl/cluster_server_parameter_test_util.h b/src/mongo/idl/cluster_server_parameter_test_util.h index 951295e98b9..c13bda4a6e4 100644 --- a/src/mongo/idl/cluster_server_parameter_test_util.h +++ b/src/mongo/idl/cluster_server_parameter_test_util.h @@ -65,7 +65,7 @@ const auto kNilCPT = LogicalTime::kUninitialized; class ClusterServerParameterTestBase : public ServiceContextMongoDTest { public: - virtual void setUp() override { + void setUp() override { gMultitenancySupport = true; // Set up mongod. ServiceContextMongoDTest::setUp(); diff --git a/src/mongo/logv2/log_domain_global.h b/src/mongo/logv2/log_domain_global.h index 5b964a815b6..926678ca59b 100644 --- a/src/mongo/logv2/log_domain_global.h +++ b/src/mongo/logv2/log_domain_global.h @@ -68,7 +68,7 @@ public: }; LogDomainGlobal(); - ~LogDomainGlobal(); + ~LogDomainGlobal() override; LogSource& source() override; diff --git a/src/mongo/logv2/logv2_test.cpp b/src/mongo/logv2/logv2_test.cpp index 0a1625a6fc1..d48b686eed4 100644 --- a/src/mongo/logv2/logv2_test.cpp +++ b/src/mongo/logv2/logv2_test.cpp @@ -531,7 +531,7 @@ public: LogV2TypesTest() : LogV2Test() { detail::setGetTenantIDCallback([this]() -> std::string { return this->tenant.toString(); }); } - ~LogV2TypesTest() { + ~LogV2TypesTest() override { detail::setGetTenantIDCallback(nullptr); } diff --git a/src/mongo/platform/mutex.h b/src/mongo/platform/mutex.h index ffa470c9f7c..5725d3580d0 100644 --- a/src/mongo/platform/mutex.h +++ b/src/mongo/platform/mutex.h @@ -352,7 +352,7 @@ public: Mutex() : Mutex(defaultData()) {} explicit Mutex(std::shared_ptr data); - ~Mutex(); + ~Mutex() override; private: void _onContendedLock() noexcept; diff --git a/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp b/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp index 1ba68c05f8f..0cf0425a9c3 100644 --- a/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp +++ b/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp @@ -67,7 +67,7 @@ public: Status readReplyMetadata(OperationContext* opCtx, StringData replySource, - const BSONObj& metadataObj) { + const BSONObj& metadataObj) override { invariant(_arg != nullptr); _arg->replySource = replySource; _arg->metadataObj = metadataObj; @@ -89,7 +89,7 @@ public: Status readReplyMetadata(OperationContext* opCtx, StringData replySource, - const BSONObj& metadataObj) { + const BSONObj& metadataObj) override { return _toRet; } diff --git a/src/mongo/s/append_raw_responses_test.cpp b/src/mongo/s/append_raw_responses_test.cpp index 58f8fda5cd9..9414e5114b0 100644 --- a/src/mongo/s/append_raw_responses_test.cpp +++ b/src/mongo/s/append_raw_responses_test.cpp @@ -119,7 +119,7 @@ HostAndPort makeHostAndPort(const ShardId& shardId) { class AppendRawResponsesTest : public ShardingTestFixture { protected: - void setUp() { + void setUp() override { ShardingTestFixture::setUp(); configTargeter()->setFindHostReturnValue(kTestConfigShardHost); diff --git a/src/mongo/s/async_requests_sender_test.cpp b/src/mongo/s/async_requests_sender_test.cpp index 6ebfd115e1f..ce23d90725e 100644 --- a/src/mongo/s/async_requests_sender_test.cpp +++ b/src/mongo/s/async_requests_sender_test.cpp @@ -100,13 +100,13 @@ protected: TEST_F(AsyncRequestsSenderTest, HandlesExceptionWhenYielding) { class ThrowyResourceYielder : public ResourceYielder { public: - void yield(OperationContext*) { + void yield(OperationContext*) override { if (_count++) { uasserted(ErrorCodes::BadValue, "Simulated error"); } } - void unyield(OperationContext*) {} + void unyield(OperationContext*) override {} private: int _count = 0; @@ -162,9 +162,9 @@ TEST_F(AsyncRequestsSenderTest, HandlesExceptionWhenYielding) { TEST_F(AsyncRequestsSenderTest, HandlesExceptionWhenUnyielding) { class ThrowyResourceYielder : public ResourceYielder { public: - void yield(OperationContext*) {} + void yield(OperationContext*) override {} - void unyield(OperationContext*) { + void unyield(OperationContext*) override { if (_count++) { uasserted(ErrorCodes::BadValue, "Simulated error"); } @@ -236,11 +236,11 @@ TEST_F(AsyncRequestsSenderTest, HandlesExceptionWhenUnyielding) { TEST_F(AsyncRequestsSenderTest, ExceptionWhileWaitingDoesNotSkipUnyield) { class CountingResourceYielder : public ResourceYielder { public: - void yield(OperationContext*) { + void yield(OperationContext*) override { ++timesYielded; } - void unyield(OperationContext*) { + void unyield(OperationContext*) override { ++timesUnyielded; } diff --git a/src/mongo/s/async_rpc_shard_retry_policy.h b/src/mongo/s/async_rpc_shard_retry_policy.h index 77df4fd8771..4fca95f9d19 100644 --- a/src/mongo/s/async_rpc_shard_retry_policy.h +++ b/src/mongo/s/async_rpc_shard_retry_policy.h @@ -73,11 +73,11 @@ public: return shouldRetryVal; } - Milliseconds getNextRetryDelay() override final { + Milliseconds getNextRetryDelay() final { return Milliseconds::zero(); } - BSONObj toBSON() const override final { + BSONObj toBSON() const final { return BSON("retryPolicyType" << "shardRetryPolicy"); } diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.h b/src/mongo/s/catalog/sharding_catalog_client_impl.h index 4ef9b1bd5a0..e6a7f495d52 100644 --- a/src/mongo/s/catalog/sharding_catalog_client_impl.h +++ b/src/mongo/s/catalog/sharding_catalog_client_impl.h @@ -87,7 +87,7 @@ class ShardingCatalogClientImpl final : public ShardingCatalogClient { public: ShardingCatalogClientImpl(std::shared_ptr overrideConfigShard); - virtual ~ShardingCatalogClientImpl(); + ~ShardingCatalogClientImpl() override; /* * Updates (or if "upsert" is true, creates) catalog data for the sharded collection "collNs" by diff --git a/src/mongo/s/catalog/sharding_catalog_client_mock.h b/src/mongo/s/catalog/sharding_catalog_client_mock.h index f4b1d2b7093..b39fddd7fc0 100644 --- a/src/mongo/s/catalog/sharding_catalog_client_mock.h +++ b/src/mongo/s/catalog/sharding_catalog_client_mock.h @@ -72,7 +72,7 @@ namespace mongo { class ShardingCatalogClientMock : public ShardingCatalogClient { public: ShardingCatalogClientMock(); - ~ShardingCatalogClientMock(); + ~ShardingCatalogClientMock() override; std::vector runCatalogAggregation(OperationContext* opCtx, AggregateCommandRequest& aggRequest, diff --git a/src/mongo/s/catalog_cache_loader_mock.h b/src/mongo/s/catalog_cache_loader_mock.h index 7e1f11f6d2a..686ad4e31a0 100644 --- a/src/mongo/s/catalog_cache_loader_mock.h +++ b/src/mongo/s/catalog_cache_loader_mock.h @@ -62,7 +62,7 @@ class CatalogCacheLoaderMock final : public CatalogCacheLoader { public: CatalogCacheLoaderMock() = default; - ~CatalogCacheLoaderMock() = default; + ~CatalogCacheLoaderMock() override = default; /** * These functions should never be called. They trigger invariants if called. diff --git a/src/mongo/s/catalog_cache_mock.h b/src/mongo/s/catalog_cache_mock.h index 2a114dee848..2bbb84679f9 100644 --- a/src/mongo/s/catalog_cache_mock.h +++ b/src/mongo/s/catalog_cache_mock.h @@ -54,7 +54,7 @@ class CatalogCacheMock final : public CatalogCache { public: CatalogCacheMock(ServiceContext* context, CatalogCacheLoaderMock& loader); - ~CatalogCacheMock() = default; + ~CatalogCacheMock() override = default; StatusWith getDatabase(OperationContext* opCtx, const DatabaseName& dbName) override; @@ -68,7 +68,7 @@ public: void setCollectionReturnValue(const NamespaceString& nss, CollectionRoutingInfo chunkManager); void advanceCollectionTimeInStore(const NamespaceString& nss, - const ChunkVersion& newVersionInStore); + const ChunkVersion& newVersionInStore) override; static std::unique_ptr make(); diff --git a/src/mongo/s/client/config_shard_wrapper.h b/src/mongo/s/client/config_shard_wrapper.h index 5eeb9fef6bd..e92da16b48c 100644 --- a/src/mongo/s/client/config_shard_wrapper.h +++ b/src/mongo/s/client/config_shard_wrapper.h @@ -70,7 +70,7 @@ class ConfigShardWrapper : public Shard { public: ConfigShardWrapper(std::shared_ptr configShard); - ~ConfigShardWrapper() = default; + ~ConfigShardWrapper() override = default; const ConnectionString& getConnString() const override; @@ -88,11 +88,11 @@ public: const DatabaseName& dbName, const BSONObj& cmdObj) final; - Status runAggregation( - OperationContext* opCtx, - const AggregateCommandRequest& aggRequest, - std::function& batch, - const boost::optional& postBatchResumeToken)> callback); + Status runAggregation(OperationContext* opCtx, + const AggregateCommandRequest& aggRequest, + std::function& batch, + const boost::optional& postBatchResumeToken)> + callback) override; private: StatusWith _runCommand(OperationContext* opCtx, diff --git a/src/mongo/s/client/config_shard_wrapper_test.cpp b/src/mongo/s/client/config_shard_wrapper_test.cpp index 0e07e7b464e..abe19c8dc0f 100644 --- a/src/mongo/s/client/config_shard_wrapper_test.cpp +++ b/src/mongo/s/client/config_shard_wrapper_test.cpp @@ -62,7 +62,7 @@ class MockShard : public Shard { public: explicit MockShard(const ShardId& id) : Shard(id) {} - ~MockShard() = default; + ~MockShard() override = default; const ConnectionString& getConnString() const override { return kConfigCS; @@ -89,11 +89,11 @@ public: const BSONObj& cmdObj) override { lastReadPref = readPref; } - Status runAggregation( - OperationContext* opCtx, - const AggregateCommandRequest& aggRequest, - std::function& batch, - const boost::optional& postBatchResumeToken)> callback) { + Status runAggregation(OperationContext* opCtx, + const AggregateCommandRequest& aggRequest, + std::function& batch, + const boost::optional& postBatchResumeToken)> + callback) override { return Status::OK(); } diff --git a/src/mongo/s/client/shard_remote.h b/src/mongo/s/client/shard_remote.h index 3e720b71a24..75b75385b1d 100644 --- a/src/mongo/s/client/shard_remote.h +++ b/src/mongo/s/client/shard_remote.h @@ -72,7 +72,7 @@ public: const ConnectionString& connString, std::unique_ptr targeter); - ~ShardRemote(); + ~ShardRemote() override; const ConnectionString& getConnString() const override { return _connString; @@ -94,11 +94,11 @@ public: const DatabaseName& dbName, const BSONObj& cmdObj) final; - Status runAggregation( - OperationContext* opCtx, - const AggregateCommandRequest& aggRequest, - std::function& batch, - const boost::optional& postBatchResumeToken)> callback); + Status runAggregation(OperationContext* opCtx, + const AggregateCommandRequest& aggRequest, + std::function& batch, + const boost::optional& postBatchResumeToken)> + callback) override; private: struct AsyncCmdHandle { diff --git a/src/mongo/s/client/shard_remote_test.cpp b/src/mongo/s/client/shard_remote_test.cpp index a089757ba66..0466fba4a8d 100644 --- a/src/mongo/s/client/shard_remote_test.cpp +++ b/src/mongo/s/client/shard_remote_test.cpp @@ -65,7 +65,7 @@ const std::vector kTestShardHosts = {HostAndPort("FakeShard1Host", class ShardRemoteTest : public ShardingTestFixture { protected: - void setUp() { + void setUp() override { ShardingTestFixture::setUp(); configTargeter()->setFindHostReturnValue(kTestConfigShardHost); diff --git a/src/mongo/s/client/sharding_network_connection_hook.h b/src/mongo/s/client/sharding_network_connection_hook.h index d39e342ffba..fc5deb30997 100644 --- a/src/mongo/s/client/sharding_network_connection_hook.h +++ b/src/mongo/s/client/sharding_network_connection_hook.h @@ -48,7 +48,7 @@ namespace mongo { class ShardingNetworkConnectionHook final : public executor::NetworkConnectionHook { public: ShardingNetworkConnectionHook() = default; - virtual ~ShardingNetworkConnectionHook() = default; + ~ShardingNetworkConnectionHook() override = default; /** * Checks that the given host is valid to be used in this sharded cluster, based on its diff --git a/src/mongo/s/client_metadata_propagation_egress_hook.h b/src/mongo/s/client_metadata_propagation_egress_hook.h index 27dc230eb3d..6bc20e2769c 100644 --- a/src/mongo/s/client_metadata_propagation_egress_hook.h +++ b/src/mongo/s/client_metadata_propagation_egress_hook.h @@ -44,7 +44,7 @@ namespace rpc { */ class ClientMetadataPropagationEgressHook : public rpc::EgressMetadataHook { public: - virtual ~ClientMetadataPropagationEgressHook() = default; + ~ClientMetadataPropagationEgressHook() override = default; Status readReplyMetadata(OperationContext* opCtx, StringData replySource, diff --git a/src/mongo/s/cluster_identity_loader_test.cpp b/src/mongo/s/cluster_identity_loader_test.cpp index 698ac7d5493..b20e589180c 100644 --- a/src/mongo/s/cluster_identity_loader_test.cpp +++ b/src/mongo/s/cluster_identity_loader_test.cpp @@ -80,7 +80,7 @@ BSONObj getReplSecondaryOkMetadata() { class ClusterIdentityTest : public ShardingTestFixture { public: - void setUp() { + void setUp() override { // TODO SERVER-78051: Remove once shards can access the loaded cluster id. serverGlobalParams.clusterRole = { ClusterRole::ShardServer, ClusterRole::ConfigServer, ClusterRole::RouterServer}; diff --git a/src/mongo/s/commands/cluster_abort_transaction_cmd.h b/src/mongo/s/commands/cluster_abort_transaction_cmd.h index e34477d7a7d..3c345b6a563 100644 --- a/src/mongo/s/commands/cluster_abort_transaction_cmd.h +++ b/src/mongo/s/commands/cluster_abort_transaction_cmd.h @@ -62,7 +62,7 @@ public: } } - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } diff --git a/src/mongo/s/commands/cluster_aggregate_test.cpp b/src/mongo/s/commands/cluster_aggregate_test.cpp index 6f235886fe9..65f2ce46646 100644 --- a/src/mongo/s/commands/cluster_aggregate_test.cpp +++ b/src/mongo/s/commands/cluster_aggregate_test.cpp @@ -75,7 +75,7 @@ protected: // The index of the shard expected to receive the response is used to prevent different shards // from returning documents with the same shard key. This is expected to be 0 for queries // targeting one shard. - void expectReturnsSuccess(int shardIndex) { + void expectReturnsSuccess(int shardIndex) override { onCommandForPoolExecutor([this, shardIndex](const executor::RemoteCommandRequest& request) { ASSERT_EQ(kNss.coll(), request.cmdObj.firstElement().valueStringData()); @@ -91,7 +91,7 @@ protected: }); } - void expectInspectRequest(int shardIndex, InspectionCallback cb) { + void expectInspectRequest(int shardIndex, InspectionCallback cb) override { onCommandForPoolExecutor([&](const executor::RemoteCommandRequest& request) { ASSERT_EQ(kNss.coll(), request.cmdObj.firstElement().valueStringData()); diff --git a/src/mongo/s/commands/cluster_build_info.cpp b/src/mongo/s/commands/cluster_build_info.cpp index bea4db89362..04aa0a6811b 100644 --- a/src/mongo/s/commands/cluster_build_info.cpp +++ b/src/mongo/s/commands/cluster_build_info.cpp @@ -59,7 +59,7 @@ class ClusterBuildInfoExecutor final : public AsyncRequestExecutor { public: ClusterBuildInfoExecutor() : AsyncRequestExecutor("ClusterBuildInfoExecutor") {} - Status handleRequest(std::shared_ptr rec) { + Status handleRequest(std::shared_ptr rec) override { auto result = rec->getReplyBuilder()->getBodyBuilder(); VersionInfoInterface::instance().appendBuildInfo(&result); return Status::OK(); @@ -97,7 +97,7 @@ public: return false; } - bool allowedWithSecurityToken() const { + bool allowedWithSecurityToken() const override { return true; } diff --git a/src/mongo/s/commands/cluster_bulk_write_cmd.h b/src/mongo/s/commands/cluster_bulk_write_cmd.h index 7a99743922a..c82c2b6d4a8 100644 --- a/src/mongo/s/commands/cluster_bulk_write_cmd.h +++ b/src/mongo/s/commands/cluster_bulk_write_cmd.h @@ -98,7 +98,7 @@ public: return true; } - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } @@ -356,7 +356,7 @@ public: return true; } - void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) { + void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) override { preRunImplHook(opCtx); BSONObjBuilder bob = result->getBodyBuilder(); @@ -505,7 +505,7 @@ public: void explain(OperationContext* opCtx, ExplainOptions::Verbosity verbosity, - rpc::ReplyBuilderInterface* result) { + rpc::ReplyBuilderInterface* result) override { preExplainImplHook(opCtx); uassert(ErrorCodes::InvalidLength, diff --git a/src/mongo/s/commands/cluster_collection_mod_cmd.cpp b/src/mongo/s/commands/cluster_collection_mod_cmd.cpp index c08b294f2ee..642ba4cb910 100644 --- a/src/mongo/s/commands/cluster_collection_mod_cmd.cpp +++ b/src/mongo/s/commands/cluster_collection_mod_cmd.cpp @@ -92,7 +92,7 @@ public: CollectionModCmd() : BasicCommandWithRequestParser() {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/s/commands/cluster_commit_transaction_cmd.h b/src/mongo/s/commands/cluster_commit_transaction_cmd.h index ceb5e3a9510..43cd6a1458b 100644 --- a/src/mongo/s/commands/cluster_commit_transaction_cmd.h +++ b/src/mongo/s/commands/cluster_commit_transaction_cmd.h @@ -61,7 +61,7 @@ public: } } - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } diff --git a/src/mongo/s/commands/cluster_count_cmd.h b/src/mongo/s/commands/cluster_count_cmd.h index 59216bd7c3f..b9893a9ad82 100644 --- a/src/mongo/s/commands/cluster_count_cmd.h +++ b/src/mongo/s/commands/cluster_count_cmd.h @@ -58,7 +58,7 @@ class ClusterCountCmdBase final : public ErrmsgCommandDeprecated { public: ClusterCountCmdBase() : ErrmsgCommandDeprecated(Impl::kName) {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } diff --git a/src/mongo/s/commands/cluster_current_op.cpp b/src/mongo/s/commands/cluster_current_op.cpp index c1b235ddd47..2d3a7650b95 100644 --- a/src/mongo/s/commands/cluster_current_op.cpp +++ b/src/mongo/s/commands/cluster_current_op.cpp @@ -69,7 +69,7 @@ public: } private: - virtual void modifyPipeline(std::vector* pipeline) const final { + void modifyPipeline(std::vector* pipeline) const final { BSONObjBuilder sortBuilder; BSONObjBuilder sortSpecBuilder(sortBuilder.subobjStart("$sort")); @@ -79,8 +79,8 @@ private: pipeline->push_back(sortBuilder.obj()); } - virtual StatusWith runAggregation( - OperationContext* opCtx, AggregateCommandRequest& request) const final { + StatusWith runAggregation(OperationContext* opCtx, + AggregateCommandRequest& request) const final { auto nss = request.getNamespace(); BSONObjBuilder responseBuilder; diff --git a/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp b/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp index 51bac2893d9..6622956393f 100644 --- a/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_indexes_cmd.cpp @@ -74,7 +74,7 @@ public: using Request = DropIndexes; using Reply = DropIndexesReply; - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp index 1ee1efe566a..a0311a9aa50 100644 --- a/src/mongo/s/commands/cluster_explain_cmd.cpp +++ b/src/mongo/s/commands/cluster_explain_cmd.cpp @@ -71,7 +71,7 @@ class ClusterExplainCmd final : public Command { public: ClusterExplainCmd() : Command("explain") {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } diff --git a/src/mongo/s/commands/cluster_find_cmd.h b/src/mongo/s/commands/cluster_find_cmd.h index bd0ff7e543f..a43b8dae86b 100644 --- a/src/mongo/s/commands/cluster_find_cmd.h +++ b/src/mongo/s/commands/cluster_find_cmd.h @@ -61,7 +61,7 @@ public: ClusterFindCmdBase() : Command(Impl::kName) {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } @@ -91,11 +91,11 @@ public: * A find command does not increment the command counter, but rather increments the * query counter. */ - bool shouldAffectCommandCounter() const override final { + bool shouldAffectCommandCounter() const final { return false; } - bool shouldAffectQueryCounter() const override final { + bool shouldAffectQueryCounter() const final { return true; } @@ -220,7 +220,7 @@ public: } } - void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) { + void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) override { Impl::checkCanRunHere(opCtx); CommandHelpers::handleMarkKillOnClientDisconnect(opCtx); diff --git a/src/mongo/s/commands/cluster_getmore_cmd.h b/src/mongo/s/commands/cluster_getmore_cmd.h index 17ecc38f658..e836188c289 100644 --- a/src/mongo/s/commands/cluster_getmore_cmd.h +++ b/src/mongo/s/commands/cluster_getmore_cmd.h @@ -61,7 +61,7 @@ class ClusterGetMoreCmdBase final : public Command { public: ClusterGetMoreCmdBase() : Command(Impl::kName) {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } diff --git a/src/mongo/s/commands/cluster_index_filter_cmd.cpp b/src/mongo/s/commands/cluster_index_filter_cmd.cpp index 4a08537d967..941b591300e 100644 --- a/src/mongo/s/commands/cluster_index_filter_cmd.cpp +++ b/src/mongo/s/commands/cluster_index_filter_cmd.cpp @@ -100,7 +100,7 @@ public: Status checkAuthForOperation(OperationContext* opCtx, const DatabaseName& dbName, - const BSONObj& cmdObj) const { + const BSONObj& cmdObj) const override { auto* authzSession = AuthorizationSession::get(opCtx->getClient()); ResourcePattern pattern = parseResourcePattern(dbName, cmdObj); diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp index 35a46d21d39..e800b7a60e3 100644 --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp @@ -125,7 +125,7 @@ public: return request().getCommandParameter(); } - void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) { + void run(OperationContext* opCtx, rpc::ReplyBuilderInterface* result) override { Timer t; const auto chunkManager = diff --git a/src/mongo/s/commands/cluster_oplog_note_cmd.cpp b/src/mongo/s/commands/cluster_oplog_note_cmd.cpp index 75a1d15c1bf..9d8a7c7409a 100644 --- a/src/mongo/s/commands/cluster_oplog_note_cmd.cpp +++ b/src/mongo/s/commands/cluster_oplog_note_cmd.cpp @@ -68,11 +68,11 @@ public: return AllowedOnSecondary::kNever; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return true; } @@ -92,10 +92,10 @@ public: return Status::OK(); } - virtual bool run(OperationContext* opCtx, - const DatabaseName& dbName, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName& dbName, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { auto shardResponses = scatterGatherUnversionedTargetAllShards( opCtx, diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.h b/src/mongo/s/commands/cluster_pipeline_cmd.h index ba099cf3ac4..d88255436d7 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.h +++ b/src/mongo/s/commands/cluster_pipeline_cmd.h @@ -46,7 +46,7 @@ class ClusterPipelineCommandBase final : public Command { public: ClusterPipelineCommandBase() : Command(Impl::kName) {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } @@ -197,11 +197,11 @@ public: * A pipeline/aggregation command does not increment the command counter, but rather increments * the query counter. */ - bool shouldAffectCommandCounter() const override final { + bool shouldAffectCommandCounter() const final { return false; } - bool shouldAffectQueryCounter() const override final { + bool shouldAffectQueryCounter() const final { return true; } diff --git a/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp index 458193348ec..f5593ab12c8 100644 --- a/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp +++ b/src/mongo/s/commands/cluster_plan_cache_clear_cmd.cpp @@ -97,7 +97,7 @@ public: Status checkAuthForOperation(OperationContext* opCtx, const DatabaseName& dbName, - const BSONObj& cmdObj) const { + const BSONObj& cmdObj) const override { AuthorizationSession* authzSession = AuthorizationSession::get(opCtx->getClient()); ResourcePattern pattern = parseResourcePattern(dbName, cmdObj); @@ -111,7 +111,7 @@ public: bool run(OperationContext* opCtx, const DatabaseName& dbName, const BSONObj& cmdObj, - BSONObjBuilder& result); + BSONObjBuilder& result) override; }; MONGO_REGISTER_COMMAND(ClusterPlanCacheClearCmd).forRouter(); diff --git a/src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp b/src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp index 8e1451e4c56..39ab420ca0f 100644 --- a/src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp +++ b/src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp @@ -651,7 +651,7 @@ public: // compliant, when they technically should not be. To satisfy this requirement, // this command is marked as part of the Stable API, but is not truly a part of // it, since it is an internal-only command. - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } }; diff --git a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp index 5324c3f2b26..16e98a97880 100644 --- a/src/mongo/s/commands/cluster_remove_shard_cmd.cpp +++ b/src/mongo/s/commands/cluster_remove_shard_cmd.cpp @@ -99,7 +99,7 @@ public: const DatabaseName&, const BSONObj& cmdObj, const RequestParser& requestParser, - BSONObjBuilder& result) override final { + BSONObjBuilder& result) final { const auto& request = requestParser.request(); const ShardId target = request.getCommandParameter(); @@ -128,7 +128,7 @@ public: return true; } - void validateResult(const BSONObj& resultObj) override final {} + void validateResult(const BSONObj& resultObj) final {} }; MONGO_REGISTER_COMMAND(RemoveShardCmd).forRouter(); diff --git a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp index 8e3ebe50328..b656aec7289 100644 --- a/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp +++ b/src/mongo/s/commands/cluster_remove_shard_from_zone_cmd.cpp @@ -82,11 +82,11 @@ public: return AllowedOnSecondary::kAlways; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -120,10 +120,10 @@ public: return Status::OK(); } - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { auto parsedRequest = uassertStatusOK(RemoveShardFromZoneRequest::parseFromMongosCommand(cmdObj)); diff --git a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp index d71596dbc7b..40f918e7acb 100644 --- a/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp +++ b/src/mongo/s/commands/cluster_repl_set_get_status_cmd.cpp @@ -53,12 +53,12 @@ public: return AllowedOnSecondary::kAlways; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -73,11 +73,11 @@ public: return Status::OK(); } - virtual bool errmsgRun(OperationContext* opCtx, - const DatabaseName& dbName, - const BSONObj& cmdObj, - std::string& errmsg, - BSONObjBuilder& result) { + bool errmsgRun(OperationContext* opCtx, + const DatabaseName& dbName, + const BSONObj& cmdObj, + std::string& errmsg, + BSONObjBuilder& result) override { if (cmdObj["forShell"].trueValue()) { NotPrimaryErrorTracker::get(cc()).disable(); } diff --git a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp index c0ec4fc3765..ad2e48c810d 100644 --- a/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp +++ b/src/mongo/s/commands/cluster_update_zone_key_range_cmd.cpp @@ -84,11 +84,11 @@ public: return AllowedOnSecondary::kAlways; } - virtual bool adminOnly() const { + bool adminOnly() const override { return true; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } @@ -132,10 +132,10 @@ public: return Status::OK(); } - virtual bool run(OperationContext* opCtx, - const DatabaseName&, - const BSONObj& cmdObj, - BSONObjBuilder& result) { + bool run(OperationContext* opCtx, + const DatabaseName&, + const BSONObj& cmdObj, + BSONObjBuilder& result) override { auto parsedRequest = uassertStatusOK(UpdateZoneKeyRangeRequest::parseFromMongosCommand(cmdObj)); diff --git a/src/mongo/s/commands/cluster_validate_db_metadata_cmd.cpp b/src/mongo/s/commands/cluster_validate_db_metadata_cmd.cpp index 98ebb0520ff..cca3fd7b835 100644 --- a/src/mongo/s/commands/cluster_validate_db_metadata_cmd.cpp +++ b/src/mongo/s/commands/cluster_validate_db_metadata_cmd.cpp @@ -76,7 +76,7 @@ public: return AllowedOnSecondary::kAlways; } - bool maintenanceOk() const { + bool maintenanceOk() const override { // The db metadata maybe stale or incorrect while the node is in recovery mode, so we // disallow the command. return false; diff --git a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp index 446f8638185..0088d2df60f 100644 --- a/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp +++ b/src/mongo/s/commands/cluster_whats_my_uri_cmd.cpp @@ -52,7 +52,7 @@ public: return AllowedOnSecondary::kAlways; } - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { + bool supportsWriteConcern(const BSONObj& cmd) const override { return false; } diff --git a/src/mongo/s/commands/cluster_write_cmd.h b/src/mongo/s/commands/cluster_write_cmd.h index c066dc6a301..c914ca445d0 100644 --- a/src/mongo/s/commands/cluster_write_cmd.h +++ b/src/mongo/s/commands/cluster_write_cmd.h @@ -204,7 +204,7 @@ class ClusterInsertCmdBase final : public ClusterWriteCmd { public: ClusterInsertCmdBase() : ClusterWriteCmd(Impl::kName) {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } @@ -254,7 +254,7 @@ class ClusterUpdateCmdBase final : public ClusterWriteCmd { public: ClusterUpdateCmdBase() : ClusterWriteCmd{Impl::kName} {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } @@ -320,7 +320,7 @@ class ClusterDeleteCmdBase final : public ClusterWriteCmd { public: ClusterDeleteCmdBase() : ClusterWriteCmd(Impl::kName) {} - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return Impl::getApiVersions(); } diff --git a/src/mongo/s/commands/cluster_write_without_shard_key_cmd.cpp b/src/mongo/s/commands/cluster_write_without_shard_key_cmd.cpp index dd6cecf4175..446107c363a 100644 --- a/src/mongo/s/commands/cluster_write_without_shard_key_cmd.cpp +++ b/src/mongo/s/commands/cluster_write_without_shard_key_cmd.cpp @@ -534,7 +534,7 @@ public: // compliant, when they technically should not be. To satisfy this requirement, this command is // marked as part of the Stable API, but is not truly a part of it, since it is an internal-only // command. - const std::set& apiVersions() const { + const std::set& apiVersions() const override { return kApiVersions1; } }; diff --git a/src/mongo/s/config_server_catalog_cache_loader.h b/src/mongo/s/config_server_catalog_cache_loader.h index ba291cb8930..6b0920d0e61 100644 --- a/src/mongo/s/config_server_catalog_cache_loader.h +++ b/src/mongo/s/config_server_catalog_cache_loader.h @@ -45,7 +45,7 @@ namespace mongo { class ConfigServerCatalogCacheLoader final : public CatalogCacheLoader { public: ConfigServerCatalogCacheLoader(); - ~ConfigServerCatalogCacheLoader() = default; + ~ConfigServerCatalogCacheLoader() override = default; ; /** diff --git a/src/mongo/s/mongos_topology_coordinator_test.cpp b/src/mongo/s/mongos_topology_coordinator_test.cpp index 489409d7422..2ff83d06860 100644 --- a/src/mongo/s/mongos_topology_coordinator_test.cpp +++ b/src/mongo/s/mongos_topology_coordinator_test.cpp @@ -63,7 +63,7 @@ class MongosTopoCoordTest : public ServiceContextTest { public: MongosTopoCoordTest() = default; - virtual void setUp() { + void setUp() override { _topo = std::make_unique(); // The fast clock is used by OperationContext::hasDeadlineExpired. @@ -74,7 +74,7 @@ public: std::make_unique(_clkSource)); } - virtual void tearDown() {} + void tearDown() override {} protected: /** diff --git a/src/mongo/s/query/blocking_results_merger_test.cpp b/src/mongo/s/query/blocking_results_merger_test.cpp index 047834e648b..d8b507807fd 100644 --- a/src/mongo/s/query/blocking_results_merger_test.cpp +++ b/src/mongo/s/query/blocking_results_merger_test.cpp @@ -277,11 +277,11 @@ TEST_F(ResultsMergerTestFixture, ShouldBeInterruptibleBeforeBlockingNext) { TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenYielding) { class ThrowyResourceYielder : public ResourceYielder { public: - void yield(OperationContext*) { + void yield(OperationContext*) override { uasserted(ErrorCodes::BadValue, "Simulated error"); } - void unyield(OperationContext*) {} + void unyield(OperationContext*) override {} }; std::vector cursors; @@ -313,9 +313,9 @@ TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenYielding) { TEST_F(ResultsMergerTestFixture, ShouldBeAbleToHandleExceptionWhenUnyielding) { class ThrowyResourceYielder : public ResourceYielder { public: - void yield(OperationContext*) {} + void yield(OperationContext*) override {} - void unyield(OperationContext*) { + void unyield(OperationContext*) override { uasserted(ErrorCodes::BadValue, "Simulated error"); } }; diff --git a/src/mongo/s/query/cluster_client_cursor_mock.h b/src/mongo/s/query/cluster_client_cursor_mock.h index 2e14aef5cc8..0550d7d4c92 100644 --- a/src/mongo/s/query/cluster_client_cursor_mock.h +++ b/src/mongo/s/query/cluster_client_cursor_mock.h @@ -65,7 +65,7 @@ public: boost::optional txnNumber, std::function killCallback = {}); - ~ClusterClientCursorMock(); + ~ClusterClientCursorMock() override; StatusWith next() final; diff --git a/src/mongo/s/query/cluster_cursor_manager_test.cpp b/src/mongo/s/query/cluster_cursor_manager_test.cpp index 39f7caf714b..ed7bf7e72a5 100644 --- a/src/mongo/s/query/cluster_cursor_manager_test.cpp +++ b/src/mongo/s/query/cluster_cursor_manager_test.cpp @@ -72,7 +72,7 @@ protected: LogicalSessionCache::set(getServiceContext(), std::make_unique()); } - ~ClusterCursorManagerTest() { + ~ClusterCursorManagerTest() override { _manager.shutdown(_opCtx.get()); } diff --git a/src/mongo/s/query/document_source_merge_cursors.h b/src/mongo/s/query/document_source_merge_cursors.h index a91d9cc4148..478e52c9a6f 100644 --- a/src/mongo/s/query/document_source_merge_cursors.h +++ b/src/mongo/s/query/document_source_merge_cursors.h @@ -104,7 +104,7 @@ public: /** * Serializes this stage to be sent to perform the merging on a different host. */ - Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final override; + Value serialize(const SerializationOptions& opts = SerializationOptions{}) const final; StageConstraints constraints(Pipeline::SplitState pipeState) const final { StageConstraints constraints(StreamType::kStreaming, diff --git a/src/mongo/s/query/router_stage_merge.h b/src/mongo/s/query/router_stage_merge.h index c095f1b146a..63d66d4a4a1 100644 --- a/src/mongo/s/query/router_stage_merge.h +++ b/src/mongo/s/query/router_stage_merge.h @@ -88,7 +88,7 @@ protected: _resultsMerger.reattachToOperationContext(getOpCtx()); } - virtual void doDetachFromOperationContext() { + void doDetachFromOperationContext() override { _resultsMerger.detachFromOperationContext(); } diff --git a/src/mongo/s/query/sharded_agg_test_fixture.h b/src/mongo/s/query/sharded_agg_test_fixture.h index 880b7f57563..04b4ee098b7 100644 --- a/src/mongo/s/query/sharded_agg_test_fixture.h +++ b/src/mongo/s/query/sharded_agg_test_fixture.h @@ -56,7 +56,7 @@ public: const NamespaceString kTestAggregateNss = NamespaceString::createNamespaceString_forTest("unittests", "sharded_agg_test"); - void setUp() { + void setUp() override { ShardCatalogCacheTestFixture::setUp(); _expCtx = make_intrusive(operationContext(), kTestAggregateNss); _expCtx->mongoProcessInterface = std::make_shared(executor()); diff --git a/src/mongo/s/resource_yielders.h b/src/mongo/s/resource_yielders.h index f144cfe58c1..db66a2ac76d 100644 --- a/src/mongo/s/resource_yielders.h +++ b/src/mongo/s/resource_yielders.h @@ -54,7 +54,8 @@ public: class ShardResourceYielderFactory : public ResourceYielderFactory { public: - std::unique_ptr make(OperationContext* opCtx, StringData cmdName) const { + std::unique_ptr make(OperationContext* opCtx, + StringData cmdName) const override { if (opCtx->isActiveTransactionParticipant() && opCtx->inMultiDocumentTransaction()) { return TransactionParticipantResourceYielder::make(cmdName); } else { @@ -65,7 +66,8 @@ public: class RouterResourceYielderFactory : public ResourceYielderFactory { public: - std::unique_ptr make(OperationContext* opCtx, StringData cmdName) const { + std::unique_ptr make(OperationContext* opCtx, + StringData cmdName) const override { return TransactionRouterResourceYielder::makeForRemoteCommand(); } }; diff --git a/src/mongo/s/routing_table_cache_gossip_metadata_hook.h b/src/mongo/s/routing_table_cache_gossip_metadata_hook.h index 57c9484b2fc..39276def7b5 100644 --- a/src/mongo/s/routing_table_cache_gossip_metadata_hook.h +++ b/src/mongo/s/routing_table_cache_gossip_metadata_hook.h @@ -48,7 +48,7 @@ namespace rpc { class RoutingTableCacheGossipMetadataHook : public EgressMetadataHook { public: RoutingTableCacheGossipMetadataHook(ServiceContext* serviceContext); - virtual ~RoutingTableCacheGossipMetadataHook() = default; + ~RoutingTableCacheGossipMetadataHook() override = default; Status writeRequestMetadata(OperationContext* opCtx, BSONObjBuilder* metadataBob) final; diff --git a/src/mongo/s/sessions_collection_sharded_test.cpp b/src/mongo/s/sessions_collection_sharded_test.cpp index 4c15eff0f2c..85aa8b85419 100644 --- a/src/mongo/s/sessions_collection_sharded_test.cpp +++ b/src/mongo/s/sessions_collection_sharded_test.cpp @@ -72,7 +72,7 @@ LogicalSessionRecord makeRecord(Date_t time = Date_t::now()) { class SessionsCollectionShardedTest : public RouterCatalogCacheTestFixture { public: SessionsCollectionShardedTest() = default; - ~SessionsCollectionShardedTest() = default; + ~SessionsCollectionShardedTest() override = default; void setUp() override { RouterCatalogCacheTestFixture::setUp(); diff --git a/src/mongo/s/shard_cannot_refresh_due_to_locks_held_exception.h b/src/mongo/s/shard_cannot_refresh_due_to_locks_held_exception.h index 3d694e9df69..184be3e7d12 100644 --- a/src/mongo/s/shard_cannot_refresh_due_to_locks_held_exception.h +++ b/src/mongo/s/shard_cannot_refresh_due_to_locks_held_exception.h @@ -52,7 +52,7 @@ public: return _nss; } - void serialize(BSONObjBuilder* bob) const; + void serialize(BSONObjBuilder* bob) const override; static std::shared_ptr parse(const BSONObj& obj); diff --git a/src/mongo/s/sharding_mongos_test_fixture.h b/src/mongo/s/sharding_mongos_test_fixture.h index 99a139e7403..9aef10e5ce8 100644 --- a/src/mongo/s/sharding_mongos_test_fixture.h +++ b/src/mongo/s/sharding_mongos_test_fixture.h @@ -63,7 +63,7 @@ protected: ShardingTestFixture(); ShardingTestFixture(bool withMockCatalogCache); - ~ShardingTestFixture(); + ~ShardingTestFixture() override; /** * Returns the mock targeter for the config server. Useful to use like so, diff --git a/src/mongo/s/sharding_task_executor_test.cpp b/src/mongo/s/sharding_task_executor_test.cpp index b08f7e90b02..518a6437628 100644 --- a/src/mongo/s/sharding_task_executor_test.cpp +++ b/src/mongo/s/sharding_task_executor_test.cpp @@ -76,7 +76,7 @@ LogicalSessionId constructFullLsid() { class ShardingTaskExecutorTest : public ShardingTestFixture { protected: - void setUp() { + void setUp() override { ShardingTestFixture::setUp(); configTargeter()->setFindHostReturnValue(kTestConfigShardHost); diff --git a/src/mongo/s/sharding_test_fixture_common.h b/src/mongo/s/sharding_test_fixture_common.h index 80512882bd6..9b771cd598f 100644 --- a/src/mongo/s/sharding_test_fixture_common.h +++ b/src/mongo/s/sharding_test_fixture_common.h @@ -67,7 +67,7 @@ public: protected: ShardingTestFixtureCommon(); - ~ShardingTestFixtureCommon(); + ~ShardingTestFixtureCommon() override; void setUp() override; void tearDown() override; diff --git a/src/mongo/s/stale_exception.h b/src/mongo/s/stale_exception.h index 5657b837c0c..047b7b293b1 100644 --- a/src/mongo/s/stale_exception.h +++ b/src/mongo/s/stale_exception.h @@ -91,7 +91,7 @@ public: return _duringOperationType; } - void serialize(BSONObjBuilder* bob) const; + void serialize(BSONObjBuilder* bob) const override; static std::shared_ptr parse(const BSONObj& obj); private: @@ -126,7 +126,7 @@ public: return _wanted; } - void serialize(BSONObjBuilder* bob) const; + void serialize(BSONObjBuilder* bob) const override; static std::shared_ptr parse(const BSONObj& obj); private: diff --git a/src/mongo/s/write_ops/batch_write_exec_test.cpp b/src/mongo/s/write_ops/batch_write_exec_test.cpp index c2db776e3ef..b3e71697d41 100644 --- a/src/mongo/s/write_ops/batch_write_exec_test.cpp +++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp @@ -293,7 +293,7 @@ class BatchWriteExecTest : public virtual service_context_test::RouterRoleOverri public ShardingTestFixture { public: BatchWriteExecTest() = default; - ~BatchWriteExecTest() = default; + ~BatchWriteExecTest() override = default; void setUp() override { ShardingTestFixture::setUp(); @@ -4128,7 +4128,7 @@ TEST_F(BatchWriteExecTest, class BatchWriteExecTargeterErrorTest : public ShardingTestFixture { public: BatchWriteExecTargeterErrorTest() = default; - ~BatchWriteExecTargeterErrorTest() = default; + ~BatchWriteExecTargeterErrorTest() override = default; void setUp() override { ShardingTestFixture::setUp(); diff --git a/src/mongo/s/write_ops/batched_command_response.h b/src/mongo/s/write_ops/batched_command_response.h index 910fa9d6787..53529b8124b 100644 --- a/src/mongo/s/write_ops/batched_command_response.h +++ b/src/mongo/s/write_ops/batched_command_response.h @@ -209,7 +209,7 @@ public: MultipleErrorsOccurredInfo(BSONArray arr) : _arr(std::move(arr)) {} static std::shared_ptr parse(const BSONObj& obj); - void serialize(BSONObjBuilder* bob) const; + void serialize(BSONObjBuilder* bob) const override; private: BSONArray _arr; diff --git a/src/mongo/s/write_ops/bulk_write_exec_test.cpp b/src/mongo/s/write_ops/bulk_write_exec_test.cpp index 1290b8fdd8e..9c3a91dc9b1 100644 --- a/src/mongo/s/write_ops/bulk_write_exec_test.cpp +++ b/src/mongo/s/write_ops/bulk_write_exec_test.cpp @@ -4378,7 +4378,7 @@ TEST_F(BulkWriteOpTest, ProcessFLEResponseCalculatesSummaryFields) { class BulkWriteExecTest : public ShardingTestFixture { public: BulkWriteExecTest() = default; - ~BulkWriteExecTest() = default; + ~BulkWriteExecTest() override = default; const ShardId kShardIdA = ShardId("shardA"); const ShardId kShardIdB = ShardId("shardB"); diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index 775089d4dbe..817655b0d9b 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -468,7 +468,7 @@ public: PooledScope(const ScopeCache::PoolName& pool, const std::shared_ptr& real) : _pool(pool), _real(real) {} - virtual ~PooledScope() { + ~PooledScope() override { // SERVER-53671: Sometimes, ScopeCache::release() will generate an 'InterruptedAtShutdown' // exception. We catch and ignore such exceptions here to prevent them from crashing the // server while it is shutting down. @@ -480,110 +480,111 @@ public: } // wrappers for the derived (_real) scope - void reset() { + void reset() override { _real->reset(); } - void registerOperation(OperationContext* opCtx) { + void registerOperation(OperationContext* opCtx) override { _real->registerOperation(opCtx); } - void unregisterOperation() { + void unregisterOperation() override { _real->unregisterOperation(); } - void init(const BSONObj* data) { + void init(const BSONObj* data) override { _real->init(data); } - void setLocalDB(const DatabaseName& dbName) { + void setLocalDB(const DatabaseName& dbName) override { _real->setLocalDB(dbName); } - void loadStored(OperationContext* opCtx, bool ignoreNotConnected = false) { + void loadStored(OperationContext* opCtx, bool ignoreNotConnected = false) override { _real->loadStored(opCtx, ignoreNotConnected); } - void externalSetup() { + void externalSetup() override { _real->externalSetup(); } - void gc() { + void gc() override { _real->gc(); } - void advanceGeneration() { + void advanceGeneration() override { _real->advanceGeneration(); } void requireOwnedObjects() override { _real->requireOwnedObjects(); } - void kill() { + void kill() override { _real->kill(); } - bool isKillPending() const { + bool isKillPending() const override { return _real->isKillPending(); } - int type(const char* field) { + int type(const char* field) override { return _real->type(field); } - string getError() { + string getError() override { return _real->getError(); } - bool hasOutOfMemoryException() { + bool hasOutOfMemoryException() override { return _real->hasOutOfMemoryException(); } - void rename(const char* from, const char* to) { + void rename(const char* from, const char* to) override { _real->rename(from, to); } - double getNumber(const char* field) { + double getNumber(const char* field) override { return _real->getNumber(field); } - int getNumberInt(const char* field) { + int getNumberInt(const char* field) override { return _real->getNumberInt(field); } - long long getNumberLongLong(const char* field) { + long long getNumberLongLong(const char* field) override { return _real->getNumberLongLong(field); } - Decimal128 getNumberDecimal(const char* field) { + Decimal128 getNumberDecimal(const char* field) override { return _real->getNumberDecimal(field); } - string getString(const char* field) { + string getString(const char* field) override { return _real->getString(field); } - bool getBoolean(const char* field) { + bool getBoolean(const char* field) override { return _real->getBoolean(field); } - BSONObj getObject(const char* field) { + BSONObj getObject(const char* field) override { return _real->getObject(field); } - OID getOID(const char* field) { + OID getOID(const char* field) override { return _real->getOID(field); }; - void getBinData(const char* field, std::function withBinData) { + void getBinData(const char* field, + std::function withBinData) override { _real->getBinData(field, std::move(withBinData)); } - Timestamp getTimestamp(const char* field) { + Timestamp getTimestamp(const char* field) override { return _real->getTimestamp(field); }; - JSRegEx getRegEx(const char* field) { + JSRegEx getRegEx(const char* field) override { return _real->getRegEx(field); }; - void setNumber(const char* field, double val) { + void setNumber(const char* field, double val) override { _real->setNumber(field, val); } - void setString(const char* field, StringData val) { + void setString(const char* field, StringData val) override { _real->setString(field, val); } - void setElement(const char* field, const BSONElement& val, const BSONObj& parent) { + void setElement(const char* field, const BSONElement& val, const BSONObj& parent) override { _real->setElement(field, val, parent); } - void setObject(const char* field, const BSONObj& obj, bool readOnly = true) { + void setObject(const char* field, const BSONObj& obj, bool readOnly = true) override { _real->setObject(field, obj, readOnly); } - bool isLastRetNativeCode() { + bool isLastRetNativeCode() override { return _real->isLastRetNativeCode(); } - void setBoolean(const char* field, bool val) { + void setBoolean(const char* field, bool val) override { _real->setBoolean(field, val); } - void setFunction(const char* field, const char* code) { + void setFunction(const char* field, const char* code) override { _real->setFunction(field, code); } - ScriptingFunction createFunction(const char* code) { + ScriptingFunction createFunction(const char* code) override { return _real->createFunction(code); } int invoke(ScriptingFunction func, @@ -592,7 +593,7 @@ public: int timeoutMs, bool ignoreReturn, bool readOnlyArgs, - bool readOnlyRecv) { + bool readOnlyRecv) override { return _real->invoke(func, args, recv, timeoutMs, ignoreReturn, readOnlyArgs, readOnlyRecv); } bool exec(StringData code, @@ -600,21 +601,24 @@ public: bool printResult, bool reportError, bool assertOnError, - int timeoutMs = 0) { + int timeoutMs = 0) override { return _real->exec(code, name, printResult, reportError, assertOnError, timeoutMs); } - bool execFile(const string& filename, bool printResult, bool reportError, int timeoutMs = 0) { + bool execFile(const string& filename, + bool printResult, + bool reportError, + int timeoutMs = 0) override { return _real->execFile(filename, printResult, reportError, timeoutMs); } - void injectNative(const char* field, NativeFunction func, void* data) { + void injectNative(const char* field, NativeFunction func, void* data) override { _real->injectNative(field, func, data); } - void append(BSONObjBuilder& builder, const char* fieldName, const char* scopeName) { + void append(BSONObjBuilder& builder, const char* fieldName, const char* scopeName) override { _real->append(builder, fieldName, scopeName); } protected: - ScriptingFunction _createFunction(const char* code) { + ScriptingFunction _createFunction(const char* code) override { return _real->_createFunction(code); } diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h index bb83ab1b4fc..a22aa8a646a 100644 --- a/src/mongo/scripting/engine.h +++ b/src/mongo/scripting/engine.h @@ -239,7 +239,7 @@ class ScriptEngine : public KillOpListenerInterface { public: ScriptEngine(); - virtual ~ScriptEngine() = default; + ~ScriptEngine() override = default; virtual Scope* newScope() { return createScope(); diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h index 7ec4898c5f4..78f7791c473 100644 --- a/src/mongo/scripting/mozjs/implscope.h +++ b/src/mongo/scripting/mozjs/implscope.h @@ -122,7 +122,7 @@ class MozJSImplScope final : public Scope { public: explicit MozJSImplScope(MozJSScriptEngine* engine, boost::optional jsHeapLimitMB); - ~MozJSImplScope(); + ~MozJSImplScope() override; void init(const BSONObj* data) override; @@ -161,7 +161,8 @@ public: BSONObj getObject(const char* field) override; OID getOID(const char* field) override; // Note: The resulting BSONBinData is only valid within the scope of the 'withBinData' callback. - void getBinData(const char* field, std::function withBinData); + void getBinData(const char* field, + std::function withBinData) override; Timestamp getTimestamp(const char* field) override; JSRegEx getRegEx(const char* field) override; diff --git a/src/mongo/scripting/mozjs/proxyscope.h b/src/mongo/scripting/mozjs/proxyscope.h index 6110c2288ac..39f2cf6e23f 100644 --- a/src/mongo/scripting/mozjs/proxyscope.h +++ b/src/mongo/scripting/mozjs/proxyscope.h @@ -119,7 +119,7 @@ class MozJSProxyScope final : public Scope { public: MozJSProxyScope(MozJSScriptEngine* engine); - ~MozJSProxyScope(); + ~MozJSProxyScope() override; void init(const BSONObj* data) override; @@ -157,7 +157,8 @@ public: BSONObj getObject(const char* field) override; OID getOID(const char* field) override; // Note: The resulting BSONBinData is only valid within the scope of the 'withBinData' callback. - void getBinData(const char* field, std::function withBinData); + void getBinData(const char* field, + std::function withBinData) override; Timestamp getTimestamp(const char* field) override; JSRegEx getRegEx(const char* field) override; diff --git a/src/mongo/shell/encrypted_dbclient_base.h b/src/mongo/shell/encrypted_dbclient_base.h index c6d87c2e339..96a1159ddb7 100644 --- a/src/mongo/shell/encrypted_dbclient_base.h +++ b/src/mongo/shell/encrypted_dbclient_base.h @@ -136,8 +136,7 @@ public: void say(Message& toSend, bool isRetry, std::string* actualServer) final; using DBClientBase::runCommandWithTarget; - virtual std::pair runCommandWithTarget( - OpMsgRequest request) final; + std::pair runCommandWithTarget(OpMsgRequest request) final; std::pair> runCommandWithTarget( OpMsgRequest request, std::shared_ptr) final; diff --git a/src/mongo/shell/kms_local.cpp b/src/mongo/shell/kms_local.cpp index 26bf1e47727..a4e645e7c38 100644 --- a/src/mongo/shell/kms_local.cpp +++ b/src/mongo/shell/kms_local.cpp @@ -61,7 +61,7 @@ class LocalKMSService final : public KMSService { public: LocalKMSService(SymmetricKey key) : _key(std::move(key)) {} - StringData name() const { + StringData name() const override { return kLocalKms; } @@ -132,7 +132,7 @@ std::unique_ptr LocalKMSService::create(const LocalKMS& config) { class LocalKMSServiceFactory final : public KMSServiceFactory { public: LocalKMSServiceFactory() = default; - ~LocalKMSServiceFactory() = default; + ~LocalKMSServiceFactory() override = default; std::unique_ptr create(const BSONObj& config) final { auto field = config[KmsProviders::kLocalFieldName]; diff --git a/src/mongo/transport/asio/asio_networking_baton.h b/src/mongo/transport/asio/asio_networking_baton.h index 1019e80d210..c863c9030d6 100644 --- a/src/mongo/transport/asio/asio_networking_baton.h +++ b/src/mongo/transport/asio/asio_networking_baton.h @@ -61,7 +61,7 @@ public: AsioNetworkingBaton(const TransportLayer* tl, OperationContext* opCtx) : _opCtx(opCtx), _tl(tl) {} - ~AsioNetworkingBaton() { + ~AsioNetworkingBaton() override { invariant(!_opCtx); invariant(_sessions.empty()); invariant(_scheduled.empty()); diff --git a/src/mongo/transport/asio/asio_transport_layer.cpp b/src/mongo/transport/asio/asio_transport_layer.cpp index 95f14e88a94..6bf38fc41a4 100644 --- a/src/mongo/transport/asio/asio_transport_layer.cpp +++ b/src/mongo/transport/asio/asio_transport_layer.cpp @@ -118,7 +118,7 @@ public: explicit AsioReactorTimer(asio::io_context& ctx) : _timer(std::make_shared(asio::system_timer(ctx))) {} - ~AsioReactorTimer() { + ~AsioReactorTimer() override { // The underlying timer won't get destroyed until the last promise from _asyncWait // has been filled, so cancel the timer so our promises get fulfilled cancel(); @@ -261,7 +261,7 @@ private: class ReactorClockSource final : public ClockSource { public: explicit ReactorClockSource(AsioReactor* reactor) : _reactor(reactor) {} - ~ReactorClockSource() = default; + ~ReactorClockSource() override = default; Milliseconds getPrecision() override { MONGO_UNREACHABLE; diff --git a/src/mongo/transport/service_executor_synchronous.h b/src/mongo/transport/service_executor_synchronous.h index 3544a9ad37f..ab47e724714 100644 --- a/src/mongo/transport/service_executor_synchronous.h +++ b/src/mongo/transport/service_executor_synchronous.h @@ -56,7 +56,7 @@ namespace service_executor_synchronous_detail { */ class ServiceExecutorSyncImpl : public ServiceExecutor { public: - ~ServiceExecutorSyncImpl(); + ~ServiceExecutorSyncImpl() override; void start() override; Status shutdown(Milliseconds timeout) override; diff --git a/src/mongo/transport/service_executor_test.cpp b/src/mongo/transport/service_executor_test.cpp index 9419cee43f4..b80537ea379 100644 --- a/src/mongo/transport/service_executor_test.cpp +++ b/src/mongo/transport/service_executor_test.cpp @@ -119,7 +119,7 @@ public: _ioContext.stop(); } - void drain() override final { + void drain() final { _ioContext.restart(); while (_ioContext.poll()) { LOGV2_DEBUG(22984, 1, "Draining remaining work in reactor."); diff --git a/src/mongo/transport/session.h b/src/mongo/transport/session.h index dda9d04562d..cf8fc0a7c1d 100644 --- a/src/mongo/transport/session.h +++ b/src/mongo/transport/session.h @@ -80,7 +80,7 @@ public: static const Status ClosedStatus; - virtual ~Session(); + ~Session() override; Id id() const { return _id; diff --git a/src/mongo/transport/session_workflow_bm.cpp b/src/mongo/transport/session_workflow_bm.cpp index 74be2d2d747..a51ee1a5b05 100644 --- a/src/mongo/transport/session_workflow_bm.cpp +++ b/src/mongo/transport/session_workflow_bm.cpp @@ -114,7 +114,7 @@ public: explicit Session(MockCoordinator* mc) : _mc{mc} { LOGV2_DEBUG(7015130, 3, "MockCoordinator::Session ctor"); } - ~Session() { + ~Session() override { LOGV2_DEBUG(7015131, 3, "MockCoordinator::Session dtor"); } diff --git a/src/mongo/transport/test_fixtures.h b/src/mongo/transport/test_fixtures.h index 4ad64fb0f96..8fccfb1e544 100644 --- a/src/mongo/transport/test_fixtures.h +++ b/src/mongo/transport/test_fixtures.h @@ -149,7 +149,7 @@ public: MONGO_UNREACHABLE; } - void appendStats(BSONObjBuilder&) const { + void appendStats(BSONObjBuilder&) const override { MONGO_UNREACHABLE; } }; diff --git a/src/mongo/transport/transport_layer.h b/src/mongo/transport/transport_layer.h index 20181fca509..5e6d2c62068 100644 --- a/src/mongo/transport/transport_layer.h +++ b/src/mongo/transport/transport_layer.h @@ -221,7 +221,7 @@ public: Reactor(const Reactor&) = delete; Reactor& operator=(const Reactor&) = delete; - virtual ~Reactor() = default; + ~Reactor() override = default; /* * Run the event loop of the reactor until stop() is called. @@ -231,7 +231,7 @@ public: virtual void stop() = 0; virtual void drain() = 0; - virtual void schedule(Task task) = 0; + void schedule(Task task) override = 0; virtual void dispatch(Task task) = 0; virtual bool onReactorThread() const = 0; diff --git a/src/mongo/transport/transport_layer_manager_impl.h b/src/mongo/transport/transport_layer_manager_impl.h index c10fb47ca0b..78b3f04af50 100644 --- a/src/mongo/transport/transport_layer_manager_impl.h +++ b/src/mongo/transport/transport_layer_manager_impl.h @@ -58,7 +58,7 @@ public: TransportLayer* egressLayer); explicit TransportLayerManagerImpl(std::unique_ptr tl); - ~TransportLayerManagerImpl() = default; + ~TransportLayerManagerImpl() override = default; Status start() override; void shutdown() override; @@ -85,7 +85,7 @@ public: static std::unique_ptr makeAndStartDefaultEgressTransportLayer(); - virtual TransportLayer* getEgressLayer() { + TransportLayer* getEgressLayer() override { return _egressLayer; } diff --git a/src/mongo/transport/transport_layer_mock.h b/src/mongo/transport/transport_layer_mock.h index 41934464bda..2952f26dfdc 100644 --- a/src/mongo/transport/transport_layer_mock.h +++ b/src/mongo/transport/transport_layer_mock.h @@ -65,7 +65,7 @@ public: TransportLayerMock(); explicit TransportLayerMock(std::unique_ptr sm) : _sessionManager(std::move(sm)) {} - ~TransportLayerMock(); + ~TransportLayerMock() override; std::shared_ptr createSession(bool isFromRouterPort = false); std::shared_ptr get(Session::Id id); @@ -96,7 +96,7 @@ public: return "mock"_sd; } - virtual ReactorHandle getReactor(WhichReactor which) override; + ReactorHandle getReactor(WhichReactor which) override; // Set to a factory function to use your own session type. std::function(TransportLayer*)> createSessionHook; diff --git a/src/mongo/unittest/fixture_test.cpp b/src/mongo/unittest/fixture_test.cpp index a9ab5e8f15e..2b76f71f154 100644 --- a/src/mongo/unittest/fixture_test.cpp +++ b/src/mongo/unittest/fixture_test.cpp @@ -43,12 +43,12 @@ protected: static int _num_set_ups; static int _num_tear_downs; - void setUp() { + void setUp() override { _num_set_ups++; _myVar = 10; } - void tearDown() { + void tearDown() override { _num_tear_downs++; _myVar = 0; } diff --git a/src/mongo/unittest/task_executor_proxy.h b/src/mongo/unittest/task_executor_proxy.h index d35bd004f76..327954490e2 100644 --- a/src/mongo/unittest/task_executor_proxy.h +++ b/src/mongo/unittest/task_executor_proxy.h @@ -64,7 +64,7 @@ public: * Does not own target executor. */ TaskExecutorProxy(executor::TaskExecutor* executor); - ~TaskExecutorProxy(); + ~TaskExecutorProxy() override; executor::TaskExecutor* getExecutor() const; void setExecutor(executor::TaskExecutor* executor); diff --git a/src/mongo/util/admin_access.h b/src/mongo/util/admin_access.h index bf5ad3ff8f2..d6da8867cee 100644 --- a/src/mongo/util/admin_access.h +++ b/src/mongo/util/admin_access.h @@ -53,9 +53,9 @@ public: class NoAdminAccess : public AdminAccess { public: - virtual ~NoAdminAccess() {} + ~NoAdminAccess() override {} - virtual bool haveAdminUsers(OperationContext* opCtx) const { + bool haveAdminUsers(OperationContext* opCtx) const override { return false; } }; diff --git a/src/mongo/util/alarm.h b/src/mongo/util/alarm.h index b8adc9409b6..00c91c0f900 100644 --- a/src/mongo/util/alarm.h +++ b/src/mongo/util/alarm.h @@ -170,7 +170,7 @@ class AlarmSchedulerPrecise : public AlarmScheduler, public: explicit AlarmSchedulerPrecise(ClockSource* clockSource) : AlarmScheduler(clockSource) {} - ~AlarmSchedulerPrecise(); + ~AlarmSchedulerPrecise() override; void clearAllAlarms() override; diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp index 8f9b20f0fdf..1f173a6fcc5 100644 --- a/src/mongo/util/background.cpp +++ b/src/mongo/util/background.cpp @@ -76,11 +76,11 @@ public: Status stop(int gracePeriodMillis); private: - virtual std::string name() const { + std::string name() const override { return "PeriodicTaskRunner"; } - virtual void run(); + void run() override; // Returns true if shutdown has been requested. You must hold _mutex to call this // function. diff --git a/src/mongo/util/background_job_test.cpp b/src/mongo/util/background_job_test.cpp index 7de549e14ce..c16f80ea3c2 100644 --- a/src/mongo/util/background_job_test.cpp +++ b/src/mongo/util/background_job_test.cpp @@ -110,11 +110,11 @@ TEST(BackgroundJobLifeCycle, Go) { public: Job() : _hasRun(false) {} - virtual std::string name() const { + std::string name() const override { return "BackgroundLifeCycle::CannotCallGoAgain"; } - virtual void run() { + void run() override { { stdx::lock_guard lock(_mutex); ASSERT_FALSE(_hasRun); diff --git a/src/mongo/util/cancellation.h b/src/mongo/util/cancellation.h index b3a4ec07593..0c2837e1df6 100644 --- a/src/mongo/util/cancellation.h +++ b/src/mongo/util/cancellation.h @@ -74,7 +74,7 @@ class CancellationState : public RefCountable { public: CancellationState() = default; - ~CancellationState() { + ~CancellationState() override { auto state = _state.load(); invariant(state == State::kCanceled || state == State::kDismissed); invariant(_cancellationPromise.getFuture().isReady()); @@ -138,7 +138,7 @@ class CancellationStateHolder : public RefCountable { public: CancellationStateHolder() = default; - ~CancellationStateHolder() { + ~CancellationStateHolder() override { _state->dismiss(); } diff --git a/src/mongo/util/concurrency/priority_ticketholder.h b/src/mongo/util/concurrency/priority_ticketholder.h index 48dc69bc084..3b0dc99827c 100644 --- a/src/mongo/util/concurrency/priority_ticketholder.h +++ b/src/mongo/util/concurrency/priority_ticketholder.h @@ -66,11 +66,11 @@ public: bool trackPeakUsed); ~PriorityTicketHolder() override{}; - int32_t available() const override final; + int32_t available() const final; - int64_t queued() const override final; + int64_t queued() const final; - int64_t numFinishedProcessing() const override final; + int64_t numFinishedProcessing() const final; std::int64_t expedited() const; @@ -79,17 +79,17 @@ public: void updateLowPriorityAdmissionBypassThreshold(int32_t newBypassThreshold); private: - boost::optional _tryAcquireImpl(AdmissionContext* admCtx) override final; + boost::optional _tryAcquireImpl(AdmissionContext* admCtx) final; boost::optional _waitForTicketUntilImpl(Interruptible& interruptible, AdmissionContext* admCtx, - Date_t until) override final; + Date_t until) final; - void _releaseToTicketPoolImpl(AdmissionContext* admCtx) noexcept override final; + void _releaseToTicketPoolImpl(AdmissionContext* admCtx) noexcept final; - QueueStats& _getQueueStatsToUse(AdmissionContext::Priority priority) noexcept override final; + QueueStats& _getQueueStatsToUse(AdmissionContext::Priority priority) noexcept final; - void _appendImplStats(BSONObjBuilder& b) const override final; + void _appendImplStats(BSONObjBuilder& b) const final; static QueueType _getQueueType(AdmissionContext::Priority priority) { switch (priority) { diff --git a/src/mongo/util/concurrency/semaphore_ticketholder.h b/src/mongo/util/concurrency/semaphore_ticketholder.h index a505b07d81b..dff1be72a3c 100644 --- a/src/mongo/util/concurrency/semaphore_ticketholder.h +++ b/src/mongo/util/concurrency/semaphore_ticketholder.h @@ -52,29 +52,29 @@ public: explicit SemaphoreTicketHolder(ServiceContext* serviceContext, int numTickets, bool trackPeakUsed); - ~SemaphoreTicketHolder() override final; + ~SemaphoreTicketHolder() final; - int32_t available() const override final; + int32_t available() const final; - int64_t queued() const override final { + int64_t queued() const final { auto removed = _semaphoreStats.totalRemovedQueue.loadRelaxed(); auto added = _semaphoreStats.totalAddedQueue.loadRelaxed(); return std::max(added - removed, (int64_t)0); }; - int64_t numFinishedProcessing() const override final; + int64_t numFinishedProcessing() const final; private: boost::optional _waitForTicketUntilImpl(Interruptible& interruptible, AdmissionContext* admCtx, - Date_t until) override final; + Date_t until) final; - boost::optional _tryAcquireImpl(AdmissionContext* admCtx) override final; - void _releaseToTicketPoolImpl(AdmissionContext* admCtx) noexcept override final; + boost::optional _tryAcquireImpl(AdmissionContext* admCtx) final; + void _releaseToTicketPoolImpl(AdmissionContext* admCtx) noexcept final; - void _appendImplStats(BSONObjBuilder& b) const override final; + void _appendImplStats(BSONObjBuilder& b) const final; - QueueStats& _getQueueStatsToUse(AdmissionContext::Priority priority) noexcept override final { + QueueStats& _getQueueStatsToUse(AdmissionContext::Priority priority) noexcept final { return _semaphoreStats; } #if defined(__linux__) diff --git a/src/mongo/util/concurrency/thread_pool_interface.h b/src/mongo/util/concurrency/thread_pool_interface.h index 6d8e3980809..63fb5ae5bc3 100644 --- a/src/mongo/util/concurrency/thread_pool_interface.h +++ b/src/mongo/util/concurrency/thread_pool_interface.h @@ -50,7 +50,7 @@ public: * The destructor may block if join() has not previously been called and returned. * It is fatal to destroy the pool while another thread is blocked on join(). */ - virtual ~ThreadPoolInterface() = default; + ~ThreadPoolInterface() override = default; /** * Starts the thread pool. May be called at most once. diff --git a/src/mongo/util/concurrency/ticket_pool.h b/src/mongo/util/concurrency/ticket_pool.h index eaaa084f637..b42ceba4c16 100644 --- a/src/mongo/util/concurrency/ticket_pool.h +++ b/src/mongo/util/concurrency/ticket_pool.h @@ -80,11 +80,11 @@ public: */ class FifoTicketQueue : public TicketQueue { public: - void push(std::shared_ptr val) { + void push(std::shared_ptr val) override { _queue.push(std::move(val)); } - std::shared_ptr pop() { + std::shared_ptr pop() override { if (_queue.empty()) { return nullptr; } diff --git a/src/mongo/util/future_impl.h b/src/mongo/util/future_impl.h index 1d825db5628..207d815ce1b 100644 --- a/src/mongo/util/future_impl.h +++ b/src/mongo/util/future_impl.h @@ -409,7 +409,7 @@ public: SharedStateBase& operator=(const SharedStateBase&) = delete; SharedStateBase& operator=(SharedStateBase&&) = delete; - virtual ~SharedStateBase() = default; + ~SharedStateBase() override = default; // Only called by future side, but may be called multiple times if waiting times out and is // retried. diff --git a/src/mongo/util/net/http_client_curl.cpp b/src/mongo/util/net/http_client_curl.cpp index da3bcc442de..61e4043ac18 100644 --- a/src/mongo/util/net/http_client_curl.cpp +++ b/src/mongo/util/net/http_client_curl.cpp @@ -316,7 +316,7 @@ public: explicit CurlHandleTimer(ClockSource* clockSource, std::shared_ptr scheduler) : _clockSource(clockSource), _scheduler(std::move(scheduler)), _handle(nullptr) {} - virtual ~CurlHandleTimer() { + ~CurlHandleTimer() override { if (_handle) { _handle->cancel().ignore(); } @@ -445,7 +445,7 @@ public: _protocol(protocol) {} - virtual ~PooledCurlHandle() = default; + ~PooledCurlHandle() override = default; const HostAndPort& getHostAndPort() const final { return _target; diff --git a/src/mongo/util/net/sock_test.cpp b/src/mongo/util/net/sock_test.cpp index d092e4cbe39..1248aca68e8 100644 --- a/src/mongo/util/net/sock_test.cpp +++ b/src/mongo/util/net/sock_test.cpp @@ -214,7 +214,7 @@ public: ASSERT_TRUE(_sockets.second); } - ~SocketFailPointTest() {} + ~SocketFailPointTest() override {} bool trySend() { char byte = 'x'; diff --git a/src/mongo/util/net/ssl/impl/error.ipp b/src/mongo/util/net/ssl/impl/error.ipp index 0952a01a6f3..aa0a38f2677 100644 --- a/src/mongo/util/net/ssl/impl/error.ipp +++ b/src/mongo/util/net/ssl/impl/error.ipp @@ -31,7 +31,7 @@ namespace detail { class ssl_category : public asio::error_category { public: - const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT { + const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT override { return "asio.ssl"; } @@ -43,7 +43,7 @@ public: return std::system_category().message(value); } #elif MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_OPENSSL - std::string message(int value) const { + std::string message(int value) const override { const char* s = ::ERR_reason_error_string(value); return s ? s : "asio.ssl error"; } diff --git a/src/mongo/util/net/ssl_manager.h b/src/mongo/util/net/ssl_manager.h index 528cb44d21c..a7702aaebb1 100644 --- a/src/mongo/util/net/ssl_manager.h +++ b/src/mongo/util/net/ssl_manager.h @@ -217,7 +217,7 @@ public: */ static std::shared_ptr create(const SSLParams& params, bool isServer); - virtual ~SSLManagerInterface(); + ~SSLManagerInterface() override; /** * Initiates a TLS connection. diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp index 5b66a67afff..b3a575fd3da 100644 --- a/src/mongo/util/net/ssl_manager_openssl.cpp +++ b/src/mongo/util/net/ssl_manager_openssl.cpp @@ -467,7 +467,7 @@ public: SSLConnectionOpenSSL(SSL_CTX* ctx, Socket* sock, const char* initialBytes, int len); - ~SSLConnectionOpenSSL(); + ~SSLConnectionOpenSSL() override; }; //////////////////////////////////////////////////////////////// @@ -1268,7 +1268,7 @@ public: explicit SSLManagerOpenSSL(const SSLParams& params, const boost::optional& transientSSLParams, bool isServer); - ~SSLManagerOpenSSL() { + ~SSLManagerOpenSSL() override { stopJobs(); } diff --git a/src/mongo/util/net/ssl_options_test.cpp b/src/mongo/util/net/ssl_options_test.cpp index 095f7fbd455..46646b4b4f2 100644 --- a/src/mongo/util/net/ssl_options_test.cpp +++ b/src/mongo/util/net/ssl_options_test.cpp @@ -128,7 +128,9 @@ TEST(SSLOptions, invalidCases) { class OptionsParserTester : public moe::OptionsParser { public: - Status readConfigFile(const std::string& filename, std::string* config, moe::ConfigExpand) { + Status readConfigFile(const std::string& filename, + std::string* config, + moe::ConfigExpand) override { if (filename != _filename) { ::mongo::StringBuilder sb; sb << "Parser using filename: " << filename diff --git a/src/mongo/util/options_parser/options_parser_test.cpp b/src/mongo/util/options_parser/options_parser_test.cpp index 258ff0b5513..ebda4e3d650 100644 --- a/src/mongo/util/options_parser/options_parser_test.cpp +++ b/src/mongo/util/options_parser/options_parser_test.cpp @@ -66,7 +66,9 @@ constexpr auto OptionParserTest = moe::OptionSection::OptionParserUsageType::Opt class OptionsParserTester : public moe::OptionsParser { public: - Status readConfigFile(const std::string& filename, std::string* config, moe::ConfigExpand) { + Status readConfigFile(const std::string& filename, + std::string* config, + moe::ConfigExpand) override { if (filename != _filename) { ::mongo::StringBuilder sb; sb << "Parser using filename: " << filename diff --git a/src/mongo/util/out_of_line_executor.h b/src/mongo/util/out_of_line_executor.h index 7719d75bc50..fcadcadd427 100644 --- a/src/mongo/util/out_of_line_executor.h +++ b/src/mongo/util/out_of_line_executor.h @@ -139,7 +139,7 @@ public: invariant(_exec, kNoExecutorStr); } - virtual ~GuaranteedExecutor() = default; + ~GuaranteedExecutor() override = default; /** * Return a wrapped task that is enforced to run once and only once. @@ -180,7 +180,7 @@ public: // Fallback invariants via GuaranteedExecutor's constructor. } - virtual ~GuaranteedExecutorWithFallback() = default; + ~GuaranteedExecutorWithFallback() override = default; void schedule(Task func) override { _preferred->schedule([func = std::move(func), fallback = _fallback](Status status) mutable { diff --git a/src/mongo/util/read_through_cache.h b/src/mongo/util/read_through_cache.h index 3ad794e3d66..37867955fd4 100644 --- a/src/mongo/util/read_through_cache.h +++ b/src/mongo/util/read_through_cache.h @@ -552,7 +552,7 @@ public: _lookupFn(std::move(lookupFn)), _cache(cacheSize) {} - ~ReadThroughCache() { + ~ReadThroughCache() override { invariant(_inProgressLookups.empty()); } diff --git a/src/mongo/util/read_through_cache_test.cpp b/src/mongo/util/read_through_cache_test.cpp index 784561a9aad..2d026ad874a 100644 --- a/src/mongo/util/read_through_cache_test.cpp +++ b/src/mongo/util/read_through_cache_test.cpp @@ -703,7 +703,7 @@ TEST_F(ReadThroughCacheAsyncTest, ShutdownWithConcurrentInvalidate) { class MockThreadPool : public ThreadPoolInterface { public: - ~MockThreadPool() { + ~MockThreadPool() override { ASSERT(!_mostRecentTask); } void startup() override {} diff --git a/src/mongo/util/registry_list.h b/src/mongo/util/registry_list.h index 4f367663b4f..989888441ca 100644 --- a/src/mongo/util/registry_list.h +++ b/src/mongo/util/registry_list.h @@ -178,7 +178,7 @@ public: } }; - virtual ~WeakPtrRegistryList() = default; + ~WeakPtrRegistryList() override = default; auto add(const std::shared_ptr& ptr) { return BaseList::add(std::weak_ptr(ptr)); diff --git a/src/mongo/util/tracing_support.cpp b/src/mongo/util/tracing_support.cpp index 7c602369718..d3b2235812a 100644 --- a/src/mongo/util/tracing_support.cpp +++ b/src/mongo/util/tracing_support.cpp @@ -68,7 +68,7 @@ public: _bob.append("startedMicros"_sd, durationCount(_now())); } - ~BasicSpan() { + ~BasicSpan() override { _spans = boost::none; _bob.append("stoppedMicros"_sd, durationCount(_now())); } @@ -165,7 +165,7 @@ public: << 1 << "tid" << 1)); } - ~BasicSpan() { + ~BasicSpan() override { _spans = boost::none; _factory->_arrayBuilder->append(BSON("ph" << "E" diff --git a/src/mongo/watchdog/watchdog.h b/src/mongo/watchdog/watchdog.h index 44d74fe9777..c932c85b38d 100644 --- a/src/mongo/watchdog/watchdog.h +++ b/src/mongo/watchdog/watchdog.h @@ -378,23 +378,23 @@ public: Milliseconds monitorPeriod, WatchdogDeathCallback callback); - ~WatchdogMonitor() = default; + ~WatchdogMonitor() override = default; - void start(); + void start() override; - void setPeriod(Milliseconds duration); + void setPeriod(Milliseconds duration) override; - void shutdown(); + void shutdown() override; - std::int64_t getCheckGeneration(); + std::int64_t getCheckGeneration() override; - std::int64_t getMonitorGeneration(); + std::int64_t getMonitorGeneration() override; - void pauseChecks(); + void pauseChecks() override; - void unpauseChecks(); + void unpauseChecks() override; - bool getShouldRunChecks_forTest(); + bool getShouldRunChecks_forTest() override; private: /** diff --git a/src/mongo/watchdog/watchdog_mock.h b/src/mongo/watchdog/watchdog_mock.h index 773cd2abeec..550410c92a9 100644 --- a/src/mongo/watchdog/watchdog_mock.h +++ b/src/mongo/watchdog/watchdog_mock.h @@ -40,23 +40,23 @@ namespace mongo { class WatchdogMonitorMock final : public WatchdogMonitorInterface { public: WatchdogMonitorMock() = default; - ~WatchdogMonitorMock() = default; + ~WatchdogMonitorMock() override = default; - void pauseChecks(); + void pauseChecks() override; - void unpauseChecks(); + void unpauseChecks() override; - void start(); + void start() override; - void setPeriod(Milliseconds duration); + void setPeriod(Milliseconds duration) override; - void shutdown(); + void shutdown() override; - std::int64_t getCheckGeneration(); + std::int64_t getCheckGeneration() override; - std::int64_t getMonitorGeneration(); + std::int64_t getMonitorGeneration() override; - bool getShouldRunChecks_forTest(); + bool getShouldRunChecks_forTest() override; private: AtomicWord _shouldRunChecks{true}; diff --git a/src/mongo/watchdog/watchdog_mongod.cpp b/src/mongo/watchdog/watchdog_mongod.cpp index f5ade53c7e7..565310c55d0 100644 --- a/src/mongo/watchdog/watchdog_mongod.cpp +++ b/src/mongo/watchdog/watchdog_mongod.cpp @@ -113,12 +113,13 @@ Status onUpdateWatchdogPeriodSeconds(const int& value) { class WatchdogServerStatusSection : public ServerStatusSection { public: using ServerStatusSection::ServerStatusSection; - bool includeByDefault() const { + bool includeByDefault() const override { // Only include this by default if the watchdog is on return watchdogEnabled; } - BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const { + BSONObj generateSection(OperationContext* opCtx, + const BSONElement& configElement) const override { if (!watchdogEnabled) { return BSONObj(); }