diff options
181 files changed, 688 insertions, 698 deletions
diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py index 91321a4f045..a20f64bbcd8 100644 --- a/buildscripts/idl/idl/generator.py +++ b/buildscripts/idl/idl/generator.py @@ -465,10 +465,10 @@ class _CppHeaderFileWriter(_CppFileWriterBase): """Generate the declarations for the class constructors.""" struct_type_info = struct_types.get_struct_info(struct) - constructor = struct_type_info.get_constructor_method() + constructor = struct_type_info.get_constructor_method(gen_header=True) self._writer.write_line(constructor.get_declaration()) - required_constructor = struct_type_info.get_required_constructor_method() + required_constructor = struct_type_info.get_required_constructor_method(gen_header=True) if len(required_constructor.args) != len(constructor.args): self._writer.write_line(required_constructor.get_declaration()) @@ -574,7 +574,7 @@ class _CppHeaderFileWriter(_CppFileWriterBase): param_type = cpp_type_info.get_storage_type() if not cpp_types.is_primitive_type(param_type): - param_type += '&' + param_type = 'const ' + param_type + '&' template_params = { 'method_name': _get_field_member_validator_name(field), @@ -583,9 +583,9 @@ class _CppHeaderFileWriter(_CppFileWriterBase): with self._with_template(template_params): # Declare method implemented in C++ file. - self._writer.write_template('void ${method_name}(const ${param_type} value);') + self._writer.write_template('void ${method_name}(${param_type} value);') self._writer.write_template( - 'void ${method_name}(IDLParserErrorContext& ctxt, const ${param_type} value);') + 'void ${method_name}(IDLParserErrorContext& ctxt, ${param_type} value);') self._writer.write_empty_line() diff --git a/buildscripts/idl/idl/struct_types.py b/buildscripts/idl/idl/struct_types.py index 1e0081b4f4c..b3b0df60532 100644 --- a/buildscripts/idl/idl/struct_types.py +++ b/buildscripts/idl/idl/struct_types.py @@ -154,14 +154,14 @@ class StructTypeInfoBase(object, metaclass=ABCMeta): """Base class for struct and command code generation.""" @abstractmethod - def get_constructor_method(self): - # type: () -> MethodInfo + def get_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo """Get the constructor method for a struct.""" pass @abstractmethod - def get_required_constructor_method(self): - # type: () -> MethodInfo + def get_required_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo """Get the constructor method for a struct with parameters for required fields.""" pass @@ -243,13 +243,13 @@ class _StructTypeInfo(StructTypeInfoBase): """Create a _StructTypeInfo instance.""" self._struct = struct - def get_constructor_method(self): - # type: () -> MethodInfo + def get_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) return MethodInfo(class_name, class_name, []) - def get_required_constructor_method(self): - # type: () -> MethodInfo + def get_required_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) return MethodInfo(class_name, class_name, _get_required_parameters(self._struct)) @@ -369,14 +369,16 @@ class _IgnoredCommandTypeInfo(_CommandBaseTypeInfo): pass -def _get_command_type_parameter(command): - # type: (ast.Command) -> str +def _get_command_type_parameter(command, gen_header=False): + # type: (ast.Command, bool) -> str """Get the parameter for the command type.""" cpp_type_info = cpp_types.get_cpp_type(command.command_field) # Use the storage type for the constructor argument since the generated code will use std::move. member_type = cpp_type_info.get_storage_type() - - return "const %s %s" % (member_type, common.camel_case(command.command_field.cpp_name)) + result = f"{member_type} {common.camel_case(command.command_field.cpp_name)}" + if not gen_header or '&' in result: + result = 'const ' + result + return result class _CommandFromType(_CommandBaseTypeInfo): @@ -389,18 +391,18 @@ class _CommandFromType(_CommandBaseTypeInfo): self._command = command super(_CommandFromType, self).__init__(command) - def get_constructor_method(self): - # type: () -> MethodInfo + def get_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) - arg = _get_command_type_parameter(self._command) + arg = _get_command_type_parameter(self._command, gen_header) return MethodInfo(class_name, class_name, [arg], explicit=True) - def get_required_constructor_method(self): - # type: () -> MethodInfo + def get_required_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) - arg = _get_command_type_parameter(self._command) + arg = _get_command_type_parameter(self._command, gen_header) return MethodInfo(class_name, class_name, [arg] + _get_required_parameters(self._struct), explicit=True) @@ -451,16 +453,24 @@ class _CommandWithNamespaceTypeInfo(_CommandBaseTypeInfo): super(_CommandWithNamespaceTypeInfo, self).__init__(command) - def get_constructor_method(self): - # type: () -> MethodInfo + @staticmethod + def _get_nss_param(gen_header): + nss_param = 'NamespaceString nss' + if not gen_header: + nss_param = 'const ' + nss_param + return nss_param + + def get_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) - return MethodInfo(class_name, class_name, ['const NamespaceString nss'], explicit=True) + return MethodInfo(class_name, class_name, [self._get_nss_param(gen_header)], explicit=True) - def get_required_constructor_method(self): - # type: () -> MethodInfo + def get_required_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) - return MethodInfo(class_name, class_name, - ['const NamespaceString nss'] + _get_required_parameters(self._struct)) + return MethodInfo( + class_name, class_name, + [self._get_nss_param(gen_header)] + _get_required_parameters(self._struct)) def get_serializer_method(self): # type: () -> MethodInfo @@ -524,18 +534,24 @@ class _CommandWithUUIDNamespaceTypeInfo(_CommandBaseTypeInfo): super(_CommandWithUUIDNamespaceTypeInfo, self).__init__(command) - def get_constructor_method(self): - # type: () -> MethodInfo + @staticmethod + def _get_nss_param(gen_header): + nss_param = 'NamespaceStringOrUUID nssOrUUID' + if not gen_header: + nss_param = 'const ' + nss_param + return nss_param + + def get_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) - return MethodInfo(class_name, class_name, ['const NamespaceStringOrUUID nssOrUUID'], - explicit=True) + return MethodInfo(class_name, class_name, [self._get_nss_param(gen_header)], explicit=True) - def get_required_constructor_method(self): - # type: () -> MethodInfo + def get_required_constructor_method(self, gen_header=False): + # type: (bool) -> MethodInfo class_name = common.title_case(self._struct.cpp_name) return MethodInfo( class_name, class_name, - ['const NamespaceStringOrUUID nssOrUUID'] + _get_required_parameters(self._struct)) + [self._get_nss_param(gen_header)] + _get_required_parameters(self._struct)) def get_serializer_method(self): # type: () -> MethodInfo diff --git a/evergreen/run_clang_tidy.sh b/evergreen/run_clang_tidy.sh index abc0edc6190..07f3ec4067c 100755 --- a/evergreen/run_clang_tidy.sh +++ b/evergreen/run_clang_tidy.sh @@ -3,6 +3,9 @@ set -o verbose cd src # TODO SERVER-49884 Remove this when we no longer check in generated Bison. +# Here we use the -header-filter option to instruct clang-tidy to scan our header files. The +# regex instructs clang-tidy to scan headers in our source directory with the mongo/* regex, and +# the build directory to analyze generated headers with the build/* regex BISON_GENERATED_PATTERN=parser_gen\.cpp jq -r '.[] | .file' compile_commands.json \ | grep src/mongo \ @@ -10,5 +13,6 @@ jq -r '.[] | .file' compile_commands.json \ | xargs -n 32 -P $(grep -c ^processor /proc/cpuinfo) -t \ /opt/mongodbtoolchain/v3/bin/clang-tidy \ -p ./compile_commands.json \ + -header-filter='(mongo/.*|build/.*)' \ --checks="-*,bugprone-unused-raii,bugprone-use-after-move,readability-const-return-type,readability-avoid-const-params-in-decls" \ -warnings-as-errors="*" diff --git a/src/mongo/base/status.h b/src/mongo/base/status.h index 4d6e332f28a..6252df5e586 100644 --- a/src/mongo/base/status.h +++ b/src/mongo/base/status.h @@ -268,9 +268,9 @@ private: static inline void unref(ErrorInfo* error); }; -inline bool operator==(const ErrorCodes::Error lhs, const Status& rhs); +inline bool operator==(ErrorCodes::Error lhs, const Status& rhs); -inline bool operator!=(const ErrorCodes::Error lhs, const Status& rhs); +inline bool operator!=(ErrorCodes::Error lhs, const Status& rhs); std::ostream& operator<<(std::ostream& os, const Status& status); diff --git a/src/mongo/bson/mutable/element.h b/src/mongo/bson/mutable/element.h index 9ae13dda2af..c60bd4ea589 100644 --- a/src/mongo/bson/mutable/element.h +++ b/src/mongo/bson/mutable/element.h @@ -491,7 +491,7 @@ public: /** Set the value of this Element to a numeric type appropriate to hold the given * SafeNum value. */ - Status setValueSafeNum(const SafeNum value); + Status setValueSafeNum(SafeNum value); /** Set the value of this Element to the value from another Element. * diff --git a/src/mongo/client/async_client.h b/src/mongo/client/async_client.h index f586335949b..d7a2402f11a 100644 --- a/src/mongo/client/async_client.h +++ b/src/mongo/client/async_client.h @@ -58,7 +58,7 @@ public: static Future<Handle> connect( const HostAndPort& peer, transport::ConnectSSLMode sslMode, - ServiceContext* const context, + ServiceContext* context, transport::ReactorHandle reactor, Milliseconds timeout, std::shared_ptr<const transport::SSLConnectionContext> transientSSLContext = nullptr); @@ -86,8 +86,7 @@ public: BSONObj specAuth, auth::SpeculativeAuthType speculativeAuthtype); - Future<void> initWireVersion(const std::string& appName, - executor::NetworkConnectionHook* const hook); + Future<void> initWireVersion(const std::string& appName, executor::NetworkConnectionHook* hook); void cancel(const BatonHandle& baton = nullptr); diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h index 0a5ef5e347c..f29037b04c0 100644 --- a/src/mongo/client/dbclient_base.h +++ b/src/mongo/client/dbclient_base.h @@ -364,7 +364,7 @@ public: /** count number of objects in collection ns that match the query criteria specified throws UserAssertion if database returns an error */ - virtual long long count(const NamespaceStringOrUUID nsOrUuid, + virtual long long count(NamespaceStringOrUUID nsOrUuid, const BSONObj& query = BSONObj(), int options = 0, int limit = 0, @@ -450,8 +450,8 @@ public: * @param authorizedDatabases Only return the databases the user is authorized on */ std::vector<BSONObj> getDatabaseInfos(const BSONObj& filter = BSONObj(), - const bool nameOnly = false, - const bool authorizedDatabases = false); + bool nameOnly = false, + bool authorizedDatabases = false); bool exists(const std::string& ns); @@ -792,7 +792,7 @@ protected: /** if the element contains a not primary error */ bool isNotPrimaryErrorString(const BSONElement& e); - BSONObj _countCmd(const NamespaceStringOrUUID nsOrUuid, + BSONObj _countCmd(NamespaceStringOrUUID nsOrUuid, const BSONObj& query, int options, int limit, diff --git a/src/mongo/client/dbclient_mockcursor.h b/src/mongo/client/dbclient_mockcursor.h index 11c9181e07c..1138ee41286 100644 --- a/src/mongo/client/dbclient_mockcursor.h +++ b/src/mongo/client/dbclient_mockcursor.h @@ -42,7 +42,7 @@ class DBClientMockCursor : public DBClientCursor { public: DBClientMockCursor(mongo::DBClientBase* client, const BSONArray& mockCollection, - const bool provideResumeToken = false, + bool provideResumeToken = false, unsigned long batchSize = 0); virtual ~DBClientMockCursor() {} diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h index 6e2c4a825e8..de2fb7553e0 100644 --- a/src/mongo/client/fetcher.h +++ b/src/mongo/client/fetcher.h @@ -223,7 +223,7 @@ private: * * Note: Errors are ignored and no retry is done */ - void _sendKillCursors(const CursorId id, const NamespaceString& nss); + void _sendKillCursors(CursorId id, const NamespaceString& nss); /** * Returns whether the fetcher is in shutdown. diff --git a/src/mongo/client/remote_command_targeter_mock.h b/src/mongo/client/remote_command_targeter_mock.h index 49ae1302c63..108764b08a2 100644 --- a/src/mongo/client/remote_command_targeter_mock.h +++ b/src/mongo/client/remote_command_targeter_mock.h @@ -82,7 +82,7 @@ public: /** * Sets the return value for the next call to connectionString. */ - void setConnectionStringReturnValue(const ConnectionString returnValue); + void setConnectionStringReturnValue(ConnectionString returnValue); /** * Sets the return value for the next call to findHost. diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index 532ee1d520a..8c9cf1a8e68 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -99,7 +99,7 @@ public: static void shutdown(); protected: - explicit ReplicaSetMonitor(const std::function<void()> cleanupCallback); + explicit ReplicaSetMonitor(std::function<void()> cleanupCallback); private: /** diff --git a/src/mongo/client/scanning_replica_set_monitor_internal.h b/src/mongo/client/scanning_replica_set_monitor_internal.h index 4e3ec94df3b..9641143a3a3 100644 --- a/src/mongo/client/scanning_replica_set_monitor_internal.h +++ b/src/mongo/client/scanning_replica_set_monitor_internal.h @@ -107,7 +107,7 @@ public: void markFailed(const Status& status); - bool matches(const ReadPreference pref) const; + bool matches(ReadPreference pref) const; /** * Checks if the given tag matches the tag attached to this node. diff --git a/src/mongo/client/sdam/sdam_datatypes.h b/src/mongo/client/sdam/sdam_datatypes.h index 111f149d4f1..cf9a471079a 100644 --- a/src/mongo/client/sdam/sdam_datatypes.h +++ b/src/mongo/client/sdam/sdam_datatypes.h @@ -54,9 +54,9 @@ enum class TopologyType { kUnknown }; const std::vector<TopologyType> allTopologyTypes(); -std::string toString(const TopologyType topologyType); +std::string toString(TopologyType topologyType); StatusWith<TopologyType> parseTopologyType(StringData strTopologyType); -std::ostream& operator<<(std::ostream& os, const TopologyType topologyType); +std::ostream& operator<<(std::ostream& os, TopologyType topologyType); enum class ServerType { kStandalone, @@ -69,9 +69,9 @@ enum class ServerType { kUnknown }; const std::vector<ServerType> allServerTypes(); -std::string toString(const ServerType serverType); +std::string toString(ServerType serverType); StatusWith<ServerType> parseServerType(StringData strServerType); -std::ostream& operator<<(std::ostream& os, const ServerType serverType); +std::ostream& operator<<(std::ostream& os, ServerType serverType); using HelloRTT = Microseconds; diff --git a/src/mongo/client/sdam/server_description.h b/src/mongo/client/sdam/server_description.h index e9674cc1332..a8d5f256542 100644 --- a/src/mongo/client/sdam/server_description.h +++ b/src/mongo/client/sdam/server_description.h @@ -119,14 +119,13 @@ private: void parseTypeFromHelloReply(BSONObj helloReply); - void calculateRtt(const boost::optional<HelloRTT> currentRtt, - const boost::optional<HelloRTT> lastRtt); + void calculateRtt(boost::optional<HelloRTT> currentRtt, boost::optional<HelloRTT> lastRtt); void saveLastWriteInfo(BSONObj lastWriteBson); - void storeHostListIfPresent(const std::string key, - const BSONObj response, + void storeHostListIfPresent(std::string key, + BSONObj response, std::set<HostAndPort>& destination); - void saveHosts(const BSONObj response); + void saveHosts(BSONObj response); void saveTags(BSONObj tagsObj); void saveElectionId(BSONElement electionId); void saveTopologyVersion(BSONElement topologyVersionField); diff --git a/src/mongo/client/sdam/server_description_builder.h b/src/mongo/client/sdam/server_description_builder.h index b0e886d4e90..d1cd53a6f06 100644 --- a/src/mongo/client/sdam/server_description_builder.h +++ b/src/mongo/client/sdam/server_description_builder.h @@ -46,16 +46,16 @@ public: // server identity ServerDescriptionBuilder& withAddress(const HostAndPort& address); - ServerDescriptionBuilder& withType(const ServerType type); + ServerDescriptionBuilder& withType(ServerType type); ServerDescriptionBuilder& withMe(const HostAndPort& me); - ServerDescriptionBuilder& withTag(const std::string key, const std::string value); - ServerDescriptionBuilder& withSetName(const std::string setName); + ServerDescriptionBuilder& withTag(std::string key, std::string value); + ServerDescriptionBuilder& withSetName(std::string setName); // network attributes ServerDescriptionBuilder& withRtt(const HelloRTT& rtt); ServerDescriptionBuilder& withError(const std::string& error); ServerDescriptionBuilder& withLogicalSessionTimeoutMinutes( - const boost::optional<int> logicalSessionTimeoutMinutes); + boost::optional<int> logicalSessionTimeoutMinutes); // server capabilities ServerDescriptionBuilder& withMinWireVersion(int minVersion); @@ -63,7 +63,7 @@ public: // server 'time' ServerDescriptionBuilder& withLastWriteDate(const Date_t& lastWriteDate); - ServerDescriptionBuilder& withOpTime(const repl::OpTime opTime); + ServerDescriptionBuilder& withOpTime(repl::OpTime opTime); ServerDescriptionBuilder& withLastUpdateTime(const Date_t& lastUpdateTime); // topology membership @@ -71,7 +71,7 @@ public: ServerDescriptionBuilder& withHost(const HostAndPort& host); ServerDescriptionBuilder& withPassive(const HostAndPort& passive); ServerDescriptionBuilder& withArbiter(const HostAndPort& arbiter); - ServerDescriptionBuilder& withSetVersion(const int setVersion); + ServerDescriptionBuilder& withSetVersion(int setVersion); ServerDescriptionBuilder& withElectionId(const OID& electionId); ServerDescriptionBuilder& withTopologyVersion(TopologyVersion topologyVersion); diff --git a/src/mongo/client/sdam/server_selector.h b/src/mongo/client/sdam/server_selector.h index ed60e32cc34..65a1047fbdb 100644 --- a/src/mongo/client/sdam/server_selector.h +++ b/src/mongo/client/sdam/server_selector.h @@ -57,7 +57,7 @@ public: * ServerDescription(s). The server is selected randomly from those that match the criteria. */ virtual boost::optional<ServerDescriptionPtr> selectServer( - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector<HostAndPort>& excludedHosts = std::vector<HostAndPort>()) = 0; @@ -70,12 +70,12 @@ public: explicit SdamServerSelector(const SdamConfiguration& config); boost::optional<std::vector<ServerDescriptionPtr>> selectServers( - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector<HostAndPort>& excludedHosts = std::vector<HostAndPort>()) override; boost::optional<ServerDescriptionPtr> selectServer( - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector<HostAndPort>& excludedHosts = std::vector<HostAndPort>()) override; @@ -84,7 +84,7 @@ public: private: void _getCandidateServers(std::vector<ServerDescriptionPtr>* result, - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector<HostAndPort>& excludedHosts); diff --git a/src/mongo/client/sdam/topology_listener.h b/src/mongo/client/sdam/topology_listener.h index 29b976cdf3f..f99ed84ba75 100644 --- a/src/mongo/client/sdam/topology_listener.h +++ b/src/mongo/client/sdam/topology_listener.h @@ -104,17 +104,16 @@ public: TopologyDescriptionPtr newDescription) override; virtual void onServerHandshakeCompleteEvent(HelloRTT duration, const HostAndPort& address, - const BSONObj reply = BSONObj()) override; + BSONObj reply = BSONObj()) override; void onServerHandshakeFailedEvent(const HostAndPort& address, const Status& status, - const BSONObj reply); + BSONObj reply); - void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, - const BSONObj reply) override; + void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; void onServerPingFailedEvent(const HostAndPort& hostAndPort, const Status& status) override; void onServerPingSucceededEvent(HelloRTT duration, const HostAndPort& hostAndPort) override; diff --git a/src/mongo/client/sdam/topology_listener_mock.h b/src/mongo/client/sdam/topology_listener_mock.h index 051d56ee589..ad8db6f46da 100644 --- a/src/mongo/client/sdam/topology_listener_mock.h +++ b/src/mongo/client/sdam/topology_listener_mock.h @@ -40,12 +40,11 @@ public: TopologyListenerMock() = default; virtual ~TopologyListenerMock() = default; - void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, - const BSONObj reply) override; + void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; /** * Returns true if _serverIsMasterReplies contains an element corresponding to hostAndPort. diff --git a/src/mongo/client/sdam/topology_state_machine.h b/src/mongo/client/sdam/topology_state_machine.h index 5c631123887..c946de9c0e3 100644 --- a/src/mongo/client/sdam/topology_state_machine.h +++ b/src/mongo/client/sdam/topology_state_machine.h @@ -89,7 +89,7 @@ private: ServerDescriptionPtr newServerDescription, bool newServer); void removeServerDescription(TopologyDescription& topologyDescription, - const HostAndPort serverAddress); + HostAndPort serverAddress); void modifyTopologyType(TopologyDescription& topologyDescription, TopologyType topologyType); void modifySetName(TopologyDescription& topologyDescription, diff --git a/src/mongo/client/server_discovery_monitor.h b/src/mongo/client/server_discovery_monitor.h index ff96724971f..93bcd4c53a8 100644 --- a/src/mongo/client/server_discovery_monitor.h +++ b/src/mongo/client/server_discovery_monitor.h @@ -85,8 +85,8 @@ private: // request. StatusWith<executor::TaskExecutor::CallbackHandle> _scheduleSingleHello(); - void _onHelloSuccess(const BSONObj bson); - void _onHelloFailure(const Status& status, const BSONObj bson); + void _onHelloSuccess(BSONObj bson); + void _onHelloFailure(const Status& status, BSONObj bson); Milliseconds _overrideRefreshPeriod(Milliseconds original); Milliseconds _currentRefreshPeriod(WithLock, bool scheduleImmediately); diff --git a/src/mongo/client/server_ping_monitor.h b/src/mongo/client/server_ping_monitor.h index 2713cb6ae99..b4667e85606 100644 --- a/src/mongo/client/server_ping_monitor.h +++ b/src/mongo/client/server_ping_monitor.h @@ -155,7 +155,7 @@ public: */ void onServerHandshakeCompleteEvent(sdam::HelloRTT durationMs, const HostAndPort& address, - const BSONObj reply = BSONObj()); + BSONObj reply = BSONObj()); /** * Drop corresponding SingleServerPingMonitors if the server is not included in the diff --git a/src/mongo/client/streamable_replica_set_monitor.h b/src/mongo/client/streamable_replica_set_monitor.h index cbd3ed2e874..8f16013daa3 100644 --- a/src/mongo/client/streamable_replica_set_monitor.h +++ b/src/mongo/client/streamable_replica_set_monitor.h @@ -236,16 +236,15 @@ private: void onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription, sdam::TopologyDescriptionPtr newDescription) override; - void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, - const BSONObj reply) override; + void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHandshakeFailedEvent(const HostAndPort& address, const Status& status, - const BSONObj reply) override; + BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; void onServerPingFailedEvent(const HostAndPort& hostAndPort, const Status& status) override; @@ -254,7 +253,7 @@ private: void onServerHandshakeCompleteEvent(sdam::HelloRTT durationMs, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; // Get a pointer to the current primary's ServerDescription // To ensure a consistent view of the Topology either _currentPrimary or _currentTopology should diff --git a/src/mongo/crypto/aead_encryption.h b/src/mongo/crypto/aead_encryption.h index 0b20291dd88..d8abd1b4e38 100644 --- a/src/mongo/crypto/aead_encryption.h +++ b/src/mongo/crypto/aead_encryption.h @@ -70,20 +70,17 @@ Status aeadDecryptDataFrame(FLEDecryptionFrame& dataframe); * Uses AEAD_AES_256_CBC_HMAC_SHA_512 encryption to encrypt a local datakey. * Writes output to out. */ -Status aeadEncryptLocalKMS(const SymmetricKey& key, - const ConstDataRange in, - uint8_t* out, - size_t outLen); +Status aeadEncryptLocalKMS(const SymmetricKey& key, ConstDataRange in, uint8_t* out, size_t outLen); /** * Internal calls for the aeadEncryption algorithm. Only used for testing. */ Status aeadEncryptWithIV(ConstDataRange key, const uint8_t* in, - const size_t inLen, + size_t inLen, const uint8_t* iv, - const size_t ivLen, + size_t ivLen, const uint8_t* associatedData, - const uint64_t associatedDataLen, + uint64_t associatedDataLen, ConstDataRange dataLenBitsEncodedStorage, uint8_t* out, size_t outLen); @@ -94,7 +91,7 @@ Status aeadEncryptWithIV(ConstDataRange key, Status aeadDecrypt(const SymmetricKey& key, ConstDataRange ciphertext, const uint8_t* associatedData, - const uint64_t associatedDataLen, + uint64_t associatedDataLen, uint8_t* out, size_t* outLen); @@ -103,7 +100,7 @@ Status aeadDecrypt(const SymmetricKey& key, * to out. */ Status aeadDecryptLocalKMS(const SymmetricKey& key, - const ConstDataRange cipher, + ConstDataRange cipher, uint8_t* out, size_t* outLen); diff --git a/src/mongo/crypto/sha1_block.h b/src/mongo/crypto/sha1_block.h index bf94ad112bd..e24f339710a 100644 --- a/src/mongo/crypto/sha1_block.h +++ b/src/mongo/crypto/sha1_block.h @@ -43,12 +43,12 @@ struct SHA1BlockTraits { static constexpr StringData name = "SHA1Block"_sd; - static void computeHash(std::initializer_list<ConstDataRange> input, HashType* const output); + static void computeHash(std::initializer_list<ConstDataRange> input, HashType* output); static void computeHmac(const uint8_t* key, size_t keyLen, std::initializer_list<ConstDataRange> input, - HashType* const output); + HashType* output); }; using SHA1Block = HashBlock<SHA1BlockTraits>; diff --git a/src/mongo/crypto/sha256_block.h b/src/mongo/crypto/sha256_block.h index 82f3f17f3df..606e36cf516 100644 --- a/src/mongo/crypto/sha256_block.h +++ b/src/mongo/crypto/sha256_block.h @@ -43,12 +43,12 @@ struct SHA256BlockTraits { static constexpr StringData name = "SHA256Block"_sd; - static void computeHash(std::initializer_list<ConstDataRange> input, HashType* const output); + static void computeHash(std::initializer_list<ConstDataRange> input, HashType* output); static void computeHmac(const uint8_t* key, size_t keyLen, std::initializer_list<ConstDataRange> input, - HashType* const output); + HashType* output); }; using SHA256Block = HashBlock<SHA256BlockTraits>; diff --git a/src/mongo/crypto/sha512_block.h b/src/mongo/crypto/sha512_block.h index 75f2b6dd1bf..58b0e1c1d16 100644 --- a/src/mongo/crypto/sha512_block.h +++ b/src/mongo/crypto/sha512_block.h @@ -45,12 +45,12 @@ struct SHA512BlockTraits { static HashType computeHash(std::initializer_list<ConstDataRange> input); - static void computeHash(std::initializer_list<ConstDataRange> input, HashType* const output); + static void computeHash(std::initializer_list<ConstDataRange> input, HashType* output); static void computeHmac(const uint8_t* key, size_t keyLen, std::initializer_list<ConstDataRange> input, - HashType* const output); + HashType* output); }; using SHA512Block = HashBlock<SHA512BlockTraits>; diff --git a/src/mongo/db/auth/authorization_session.h b/src/mongo/db/auth/authorization_session.h index 8ccb589f344..3631c8049b4 100644 --- a/src/mongo/db/auth/authorization_session.h +++ b/src/mongo/db/auth/authorization_session.h @@ -287,7 +287,7 @@ public: // when the session is accessible. Returns a `mongo::Status` with information regarding the // nature of session inaccessibility when the session is not accessible. virtual Status checkCursorSessionPrivilege( - OperationContext* const opCtx, boost::optional<LogicalSessionId> cursorSessionId) = 0; + OperationContext* opCtx, boost::optional<LogicalSessionId> cursorSessionId) = 0; // Verify the authorization contract. If contract == nullptr, no check is performed. virtual void verifyContract(const AuthorizationContract* contract) const = 0; diff --git a/src/mongo/db/auth/authorization_session_impl.h b/src/mongo/db/auth/authorization_session_impl.h index 8887a06fc4b..71c07ab949a 100644 --- a/src/mongo/db/auth/authorization_session_impl.h +++ b/src/mongo/db/auth/authorization_session_impl.h @@ -147,7 +147,7 @@ public: bool isImpersonating() const override; - Status checkCursorSessionPrivilege(OperationContext* const opCtx, + Status checkCursorSessionPrivilege(OperationContext* opCtx, boost::optional<LogicalSessionId> cursorSessionId) override; void verifyContract(const AuthorizationContract* contract) const override; diff --git a/src/mongo/db/auth/privilege.h b/src/mongo/db/auth/privilege.h index 48c0c238091..c04ca3c8734 100644 --- a/src/mongo/db/auth/privilege.h +++ b/src/mongo/db/auth/privilege.h @@ -75,7 +75,7 @@ public: Privilege(Privilege&&) = default; Privilege& operator=(Privilege&&) = default; - Privilege(const ResourcePattern& resource, const ActionType action); + Privilege(const ResourcePattern& resource, ActionType action); Privilege(const ResourcePattern& resource, const ActionSet& actions); const ResourcePattern& getResourcePattern() const { @@ -90,11 +90,11 @@ public: void removeActions(const ActionSet& actionsToRemove); // Checks if the given action is present in the Privilege. - bool includesAction(const ActionType action) const; + bool includesAction(ActionType action) const; // Checks if the given actions are present in the Privilege. bool includesActions(const ActionSet& actions) const; - static Privilege fromBSON(const BSONElement obj); + static Privilege fromBSON(BSONElement obj); static Privilege fromBSON(BSONObj obj); BSONObj toBSON() const; diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h index 79ab3305e36..46f44a022d5 100644 --- a/src/mongo/db/catalog/collection.h +++ b/src/mongo/db/catalog/collection.h @@ -333,29 +333,29 @@ public: virtual bool requiresIdIndex() const = 0; - virtual Snapshotted<BSONObj> docFor(OperationContext* const opCtx, RecordId loc) const = 0; + virtual Snapshotted<BSONObj> docFor(OperationContext* opCtx, RecordId loc) const = 0; /** * @param out - contents set to the right docs if exists, or nothing. * @return true iff loc exists */ - virtual bool findDoc(OperationContext* const opCtx, + virtual bool findDoc(OperationContext* opCtx, RecordId loc, - Snapshotted<BSONObj>* const out) const = 0; + Snapshotted<BSONObj>* out) const = 0; - virtual std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* const opCtx, - const bool forward = true) const = 0; + virtual std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* opCtx, + bool forward = true) const = 0; /** * Deletes the document with the given RecordId from the collection. For a description of the * parameters, see the overloaded function below. */ - virtual void deleteDocument(OperationContext* const opCtx, + virtual void deleteDocument(OperationContext* opCtx, StmtId stmtId, RecordId loc, - OpDebug* const opDebug, - const bool fromMigrate = false, - const bool noWarn = false, + OpDebug* opDebug, + bool fromMigrate = false, + bool noWarn = false, StoreDeletedDoc storeDeletedDoc = StoreDeletedDoc::Off) const = 0; /** @@ -370,13 +370,13 @@ public: * 'noWarn' if unindexing the record causes an error, if noWarn is true the error * will not be logged. */ - virtual void deleteDocument(OperationContext* const opCtx, + virtual void deleteDocument(OperationContext* opCtx, Snapshotted<BSONObj> doc, StmtId stmtId, RecordId loc, - OpDebug* const opDebug, - const bool fromMigrate = false, - const bool noWarn = false, + OpDebug* opDebug, + bool fromMigrate = false, + bool noWarn = false, StoreDeletedDoc storeDeletedDoc = StoreDeletedDoc::Off) const = 0; /* @@ -386,11 +386,11 @@ public: * * 'opDebug' Optional argument. When not null, will be used to record operation statistics. */ - virtual Status insertDocuments(OperationContext* const opCtx, - const std::vector<InsertStatement>::const_iterator begin, - const std::vector<InsertStatement>::const_iterator end, - OpDebug* const opDebug, - const bool fromMigrate = false) const = 0; + virtual Status insertDocuments(OperationContext* opCtx, + std::vector<InsertStatement>::const_iterator begin, + std::vector<InsertStatement>::const_iterator end, + OpDebug* opDebug, + bool fromMigrate = false) const = 0; /** * this does NOT modify the doc before inserting @@ -398,16 +398,16 @@ public: * * 'opDebug' Optional argument. When not null, will be used to record operation statistics. */ - virtual Status insertDocument(OperationContext* const opCtx, + virtual Status insertDocument(OperationContext* opCtx, const InsertStatement& doc, - OpDebug* const opDebug, - const bool fromMigrate = false) const = 0; + OpDebug* opDebug, + bool fromMigrate = false) const = 0; /** * Callers must ensure no document validation is performed for this collection when calling * this method. */ - virtual Status insertDocumentsForOplog(OperationContext* const opCtx, + virtual Status insertDocumentsForOplog(OperationContext* opCtx, std::vector<Record>* records, const std::vector<Timestamp>& timestamps) const = 0; @@ -419,7 +419,7 @@ public: * NOTE: It is up to caller to commit the indexes. */ virtual Status insertDocumentForBulkLoader( - OperationContext* const opCtx, + OperationContext* opCtx, const BSONObj& doc, const OnRecordInsertedFn& onRecordInserted) const = 0; @@ -432,13 +432,13 @@ public: * 'opDebug' Optional argument. When not null, will be used to record operation statistics. * @return the post update location of the doc (may or may not be the same as oldLocation) */ - virtual RecordId updateDocument(OperationContext* const opCtx, + virtual RecordId updateDocument(OperationContext* opCtx, RecordId oldLocation, const Snapshotted<BSONObj>& oldDoc, const BSONObj& newDoc, - const bool indexesAffected, - OpDebug* const opDebug, - CollectionUpdateArgs* const args) const = 0; + bool indexesAffected, + OpDebug* opDebug, + CollectionUpdateArgs* args) const = 0; virtual bool updateWithDamagesSupported() const = 0; @@ -450,12 +450,12 @@ public: * @return the contents of the updated record. */ virtual StatusWith<RecordData> updateDocumentWithDamages( - OperationContext* const opCtx, + OperationContext* opCtx, RecordId loc, const Snapshotted<RecordData>& oldRec, - const char* const damageSource, + const char* damageSource, const mutablebson::DamageVector& damages, - CollectionUpdateArgs* const args) const = 0; + CollectionUpdateArgs* args) const = 0; // ----------- @@ -467,7 +467,7 @@ public: * The caller should hold a collection X lock and ensure there are no index builds in progress * on the collection. */ - virtual Status truncate(OperationContext* const opCtx) = 0; + virtual Status truncate(OperationContext* opCtx) = 0; /** * Truncate documents newer than the document at 'end' from the capped @@ -478,9 +478,9 @@ public: * The caller should hold a collection X lock and ensure there are no index builds in progress * on the collection. */ - virtual void cappedTruncateAfter(OperationContext* const opCtx, + virtual void cappedTruncateAfter(OperationContext* opCtx, RecordId end, - const bool inclusive) const = 0; + bool inclusive) const = 0; /** * Returns a non-ok Status if validator is not legal for this collection. @@ -498,12 +498,10 @@ public: * An empty validator removes all validation. * Requires an exclusive lock on the collection. */ - virtual void setValidator(OperationContext* const opCtx, Validator validator) = 0; + virtual void setValidator(OperationContext* opCtx, Validator validator) = 0; - virtual Status setValidationLevel(OperationContext* const opCtx, - ValidationLevelEnum newLevel) = 0; - virtual Status setValidationAction(OperationContext* const opCtx, - ValidationActionEnum newAction) = 0; + virtual Status setValidationLevel(OperationContext* opCtx, ValidationLevelEnum newLevel) = 0; + virtual Status setValidationAction(OperationContext* opCtx, ValidationActionEnum newAction) = 0; virtual boost::optional<ValidationLevelEnum> getValidationLevel() const = 0; virtual boost::optional<ValidationActionEnum> getValidationAction() const = 0; @@ -676,26 +674,26 @@ public: */ virtual std::shared_ptr<CappedInsertNotifier> getCappedInsertNotifier() const = 0; - virtual long long numRecords(OperationContext* const opCtx) const = 0; + virtual long long numRecords(OperationContext* opCtx) const = 0; - virtual long long dataSize(OperationContext* const opCtx) const = 0; + virtual long long dataSize(OperationContext* opCtx) const = 0; /** * Returns true if the collection does not contain any records. */ - virtual bool isEmpty(OperationContext* const opCtx) const = 0; + virtual bool isEmpty(OperationContext* opCtx) const = 0; - virtual int averageObjectSize(OperationContext* const opCtx) const = 0; + virtual int averageObjectSize(OperationContext* opCtx) const = 0; - virtual uint64_t getIndexSize(OperationContext* const opCtx, - BSONObjBuilder* const details = nullptr, - const int scale = 1) const = 0; + virtual uint64_t getIndexSize(OperationContext* opCtx, + BSONObjBuilder* details = nullptr, + int scale = 1) const = 0; /** * Returns the number of unused, free bytes used by all indexes on disk. */ - virtual uint64_t getIndexFreeStorageBytes(OperationContext* const opCtx) const = 0; + virtual uint64_t getIndexFreeStorageBytes(OperationContext* opCtx) const = 0; /** * If return value is not boost::none, reads with majority read concern using an older snapshot @@ -703,7 +701,7 @@ public: */ virtual boost::optional<Timestamp> getMinimumVisibleSnapshot() const = 0; - virtual void setMinimumVisibleSnapshot(const Timestamp name) = 0; + virtual void setMinimumVisibleSnapshot(Timestamp name) = 0; /** * Returns the time-series options for this buckets collection, or boost::none if not a diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h index ec6c8e32446..da391eea8f0 100644 --- a/src/mongo/db/catalog/collection_impl.h +++ b/src/mongo/db/catalog/collection_impl.h @@ -368,7 +368,7 @@ public: BSONObjBuilder* details = nullptr, int scale = 1) const final; - uint64_t getIndexFreeStorageBytes(OperationContext* const opCtx) const final; + uint64_t getIndexFreeStorageBytes(OperationContext* opCtx) const final; /** * If return value is not boost::none, reads with majority read concern using an older snapshot diff --git a/src/mongo/db/catalog/create_collection.h b/src/mongo/db/catalog/create_collection.h index d2efe1538fe..ae9135ba08b 100644 --- a/src/mongo/db/catalog/create_collection.h +++ b/src/mongo/db/catalog/create_collection.h @@ -67,7 +67,7 @@ Status createCollectionForApplyOps(OperationContext* opCtx, const std::string& dbName, const OptionalCollectionUUID& ui, const BSONObj& cmdObj, - const bool allowRenameOutOfTheWay, + bool allowRenameOutOfTheWay, boost::optional<BSONObj> idIndex = boost::none); } // namespace mongo diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h index b81b7939919..4b1ecfdc726 100644 --- a/src/mongo/db/catalog/database.h +++ b/src/mongo/db/catalog/database.h @@ -81,7 +81,7 @@ public: virtual const std::string& name() const = 0; - virtual void clearTmpCollections(OperationContext* const opCtx) const = 0; + virtual void clearTmpCollections(OperationContext* opCtx) const = 0; /** * Sets the 'drop-pending' state of this Database. @@ -96,9 +96,9 @@ public: */ virtual bool isDropPending(OperationContext* opCtx) const = 0; - virtual void getStats(OperationContext* const opCtx, - BSONObjBuilder* const output, - const double scale = 1) const = 0; + virtual void getStats(OperationContext* opCtx, + BSONObjBuilder* output, + double scale = 1) const = 0; /** * dropCollection() will refuse to drop system collections. Use dropCollectionEvenIfSystem() if @@ -111,15 +111,15 @@ public: * collection. * N.B. Namespace argument is passed by value as it may otherwise disappear or change. */ - virtual Status dropCollection(OperationContext* const opCtx, + virtual Status dropCollection(OperationContext* opCtx, NamespaceString nss, repl::OpTime dropOpTime = {}) const = 0; - virtual Status dropCollectionEvenIfSystem(OperationContext* const opCtx, + virtual Status dropCollectionEvenIfSystem(OperationContext* opCtx, NamespaceString nss, repl::OpTime dropOpTime = {}, bool markFromMigrate = false) const = 0; - virtual Status dropView(OperationContext* const opCtx, NamespaceString viewName) const = 0; + virtual Status dropView(OperationContext* opCtx, NamespaceString viewName) const = 0; /** * A MODE_IX collection lock must be held for this call. Throws a WriteConflictException error @@ -129,23 +129,23 @@ public: * well as creating it. Otherwise the loop will endlessly throw WCEs: the caller must check that * the collection exists to break free. */ - virtual Collection* createCollection(OperationContext* const opCtx, + virtual Collection* createCollection(OperationContext* opCtx, const NamespaceString& nss, const CollectionOptions& options = CollectionOptions(), - const bool createDefaultIndexes = true, + bool createDefaultIndexes = true, const BSONObj& idIndex = BSONObj()) const = 0; - virtual Status createView(OperationContext* const opCtx, + virtual Status createView(OperationContext* opCtx, const NamespaceString& viewName, const CollectionOptions& options) const = 0; /** * Arguments are passed by value as they otherwise would be changing as result of renaming. */ - virtual Status renameCollection(OperationContext* const opCtx, + virtual Status renameCollection(OperationContext* opCtx, NamespaceString fromNss, NamespaceString toNss, - const bool stayTemp) const = 0; + bool stayTemp) const = 0; virtual const NamespaceString& getSystemViewsName() const = 0; diff --git a/src/mongo/db/catalog/database_holder.h b/src/mongo/db/catalog/database_holder.h index 38c37ea9d56..6bd33d628ef 100644 --- a/src/mongo/db/catalog/database_holder.h +++ b/src/mongo/db/catalog/database_holder.h @@ -63,7 +63,7 @@ public: * Retrieves an already opened database or returns nullptr. Must be called with the database * locked in at least IS-mode. */ - virtual Database* getDb(OperationContext* const opCtx, const StringData ns) const = 0; + virtual Database* getDb(OperationContext* opCtx, StringData ns) const = 0; /** * Fetches the ViewCatalog decorating the Database matching 'dbName', or returns nullptr if the @@ -74,7 +74,7 @@ public: * to ensure the Database object is safe to access. This class' internal mutex provides * concurrency protection around looking up and accessing the Database object matching 'dbName. */ - virtual std::shared_ptr<const ViewCatalog> getViewCatalog(OperationContext* const opCtx, + virtual std::shared_ptr<const ViewCatalog> getViewCatalog(OperationContext* opCtx, StringData dbName) const = 0; /** @@ -84,9 +84,9 @@ public: * @param justCreated Returns whether the database was newly created (true) or it already * existed (false). Can be NULL if this information is not necessary. */ - virtual Database* openDb(OperationContext* const opCtx, - const StringData ns, - bool* const justCreated = nullptr) = 0; + virtual Database* openDb(OperationContext* opCtx, + StringData ns, + bool* justCreated = nullptr) = 0; /** * Physically drops the specified opened database and removes it from the server's metadata. It @@ -102,7 +102,7 @@ public: * Closes the specified database. Must be called with the database locked in X-mode. * No background jobs must be in progress on the database when this function is called. */ - virtual void close(OperationContext* opCtx, const StringData ns) = 0; + virtual void close(OperationContext* opCtx, StringData ns) = 0; /** * Closes all opened databases. Must be called with the global lock acquired in X-mode. @@ -115,7 +115,7 @@ public: /** * Returns the set of existing database names that differ only in casing. */ - virtual std::set<std::string> getNamesWithConflictingCasing(const StringData name) = 0; + virtual std::set<std::string> getNamesWithConflictingCasing(StringData name) = 0; /** * Returns all the database names (including those which are empty). diff --git a/src/mongo/db/catalog/database_holder_impl.h b/src/mongo/db/catalog/database_holder_impl.h index d9fbf5f1763..841d042bc12 100644 --- a/src/mongo/db/catalog/database_holder_impl.h +++ b/src/mongo/db/catalog/database_holder_impl.h @@ -42,7 +42,7 @@ public: Database* getDb(OperationContext* opCtx, StringData ns) const override; - std::shared_ptr<const ViewCatalog> getViewCatalog(OperationContext* const opCtx, + std::shared_ptr<const ViewCatalog> getViewCatalog(OperationContext* opCtx, StringData dbName) const override; Database* openDb(OperationContext* opCtx, StringData ns, bool* justCreated = nullptr) override; diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h index 8c3433bbb59..40588953820 100644 --- a/src/mongo/db/catalog/index_catalog.h +++ b/src/mongo/db/catalog/index_catalog.h @@ -144,7 +144,7 @@ public: class ReadyIndexesIterator : public IndexIterator { public: - ReadyIndexesIterator(OperationContext* const opCtx, + ReadyIndexesIterator(OperationContext* opCtx, IndexCatalogEntryContainer::const_iterator beginIterator, IndexCatalogEntryContainer::const_iterator endIterator); @@ -163,7 +163,7 @@ public: * on. If the caller will keep control of the container for the entire iterator lifetime, * it should pass in a null value. */ - AllIndexesIterator(OperationContext* const opCtx, + AllIndexesIterator(OperationContext* opCtx, std::unique_ptr<std::vector<IndexCatalogEntry*>> ownedContainer); private: @@ -187,7 +187,7 @@ public: virtual std::unique_ptr<IndexCatalog> clone() const = 0; // Must be called before used. - virtual Status init(OperationContext* const opCtx, Collection* collection) = 0; + virtual Status init(OperationContext* opCtx, Collection* collection) = 0; // ---- accessors ----- @@ -195,30 +195,29 @@ public: virtual bool haveAnyIndexesInProgress() const = 0; - virtual int numIndexesTotal(OperationContext* const opCtx) const = 0; + virtual int numIndexesTotal(OperationContext* opCtx) const = 0; - virtual int numIndexesReady(OperationContext* const opCtx) const = 0; + virtual int numIndexesReady(OperationContext* opCtx) const = 0; - virtual int numIndexesInProgress(OperationContext* const opCtx) const = 0; + virtual int numIndexesInProgress(OperationContext* opCtx) const = 0; - virtual bool haveIdIndex(OperationContext* const opCtx) const = 0; + virtual bool haveIdIndex(OperationContext* opCtx) const = 0; /** * Returns the spec for the id index to create by default for this collection. */ virtual BSONObj getDefaultIdIndexSpec(const CollectionPtr& collection) const = 0; - virtual const IndexDescriptor* findIdIndex(OperationContext* const opCtx) const = 0; + virtual const IndexDescriptor* findIdIndex(OperationContext* opCtx) const = 0; /** * Find index by name. The index name uniquely identifies an index. * * @return null if cannot find */ - virtual const IndexDescriptor* findIndexByName( - OperationContext* const opCtx, - const StringData name, - const bool includeUnfinishedIndexes = false) const = 0; + virtual const IndexDescriptor* findIndexByName(OperationContext* opCtx, + StringData name, + bool includeUnfinishedIndexes = false) const = 0; /** * Find index by matching key pattern and options. The key pattern, collation spec, and partial @@ -227,10 +226,10 @@ public: * @return null if cannot find index, otherwise the index with a matching signature. */ virtual const IndexDescriptor* findIndexByKeyPatternAndOptions( - OperationContext* const opCtx, + OperationContext* opCtx, const BSONObj& key, const BSONObj& indexSpec, - const bool includeUnfinishedIndexes = false) const = 0; + bool includeUnfinishedIndexes = false) const = 0; /** * Find indexes with a matching key pattern, putting them into the vector 'matches'. The key @@ -238,11 +237,10 @@ public: * * Consider using 'findIndexByName' if expecting to match one index. */ - virtual void findIndexesByKeyPattern( - OperationContext* const opCtx, - const BSONObj& key, - const bool includeUnfinishedIndexes, - std::vector<const IndexDescriptor*>* const matches) const = 0; + virtual void findIndexesByKeyPattern(OperationContext* opCtx, + const BSONObj& key, + bool includeUnfinishedIndexes, + std::vector<const IndexDescriptor*>* matches) const = 0; /** * Returns an index suitable for shard key range scans. @@ -257,15 +255,15 @@ public: * * If no such index exists, returns NULL. */ - virtual const IndexDescriptor* findShardKeyPrefixedIndex(OperationContext* const opCtx, + virtual const IndexDescriptor* findShardKeyPrefixedIndex(OperationContext* opCtx, const CollectionPtr& collection, const BSONObj& shardKey, - const bool requireSingleKey) const = 0; + bool requireSingleKey) const = 0; - virtual void findIndexByType(OperationContext* const opCtx, + virtual void findIndexByType(OperationContext* opCtx, const std::string& type, std::vector<const IndexDescriptor*>& matches, - const bool includeUnfinishedIndexes = false) const = 0; + bool includeUnfinishedIndexes = false) const = 0; /** * Reload the index definition for 'oldDesc' from the CollectionCatalogEntry. 'oldDesc' @@ -279,15 +277,15 @@ public: * The caller must hold the collection X lock and ensure no index builds are in progress * on the collection. */ - virtual const IndexDescriptor* refreshEntry(OperationContext* const opCtx, + virtual const IndexDescriptor* refreshEntry(OperationContext* opCtx, Collection* collection, - const IndexDescriptor* const oldDesc) = 0; + const IndexDescriptor* oldDesc) = 0; /** * Returns a pointer to the index catalog entry associated with 'desc'. Throws if there is no * such index. Never returns nullptr. */ - virtual const IndexCatalogEntry* getEntry(const IndexDescriptor* const desc) const = 0; + virtual const IndexCatalogEntry* getEntry(const IndexDescriptor* desc) const = 0; /** * Returns a pointer to the index catalog entry associated with 'desc', where the caller assumes @@ -306,7 +304,7 @@ public: * Returns an iterator for the index descriptors in this IndexCatalog. */ virtual std::unique_ptr<IndexIterator> getIndexIterator( - OperationContext* const opCtx, const bool includeUnfinishedIndexes) const = 0; + OperationContext* opCtx, bool includeUnfinishedIndexes) const = 0; // ---- index set modifiers ------ @@ -325,9 +323,9 @@ public: * empty collection can be rolled back as part of a larger WUOW. Returns the full specification * of the created index, as it is stored in this index catalog. */ - virtual StatusWith<BSONObj> createIndexOnEmptyCollection(OperationContext* const opCtx, + virtual StatusWith<BSONObj> createIndexOnEmptyCollection(OperationContext* opCtx, Collection* collection, - const BSONObj spec) = 0; + BSONObj spec) = 0; /** * Checks the spec 'original' to make sure nothing is incorrectly set and cleans up any legacy @@ -338,7 +336,7 @@ public: * already being built. */ virtual StatusWith<BSONObj> prepareSpecForCreate( - OperationContext* const opCtx, + OperationContext* opCtx, const CollectionPtr& collection, const BSONObj& original, const boost::optional<ResumeIndexInfo>& resumeInfo) const = 0; @@ -358,10 +356,10 @@ public: * they are not, then IndexBuildAlreadyInProgress errors can be thrown. */ virtual std::vector<BSONObj> removeExistingIndexes( - OperationContext* const opCtx, + OperationContext* opCtx, const CollectionPtr& collection, const std::vector<BSONObj>& indexSpecsToBuild, - const bool removeIndexBuildsToo) const = 0; + bool removeIndexBuildsToo) const = 0; /** * Filters out ready and in-progress indexes that already exist and returns the remaining @@ -374,7 +372,7 @@ public: * via replica set cloning or chunk migrations. */ virtual std::vector<BSONObj> removeExistingIndexesNoChecks( - OperationContext* const opCtx, + OperationContext* opCtx, const CollectionPtr& collection, const std::vector<BSONObj>& indexSpecsToBuild) const = 0; @@ -397,18 +395,18 @@ public: * The caller must hold the collection X lock and ensure no index builds are in progress on the * collection. */ - virtual Status dropIndex(OperationContext* const opCtx, + virtual Status dropIndex(OperationContext* opCtx, Collection* collection, - const IndexDescriptor* const desc) = 0; + const IndexDescriptor* desc) = 0; /** * Drops an unfinished index given its descriptor. * * The caller must hold the collection X lock. */ - virtual Status dropUnfinishedIndex(OperationContext* const opCtx, + virtual Status dropUnfinishedIndex(OperationContext* opCtx, Collection* collection, - const IndexDescriptor* const desc) = 0; + const IndexDescriptor* desc) = 0; /** * Drops the index given its catalog entry. @@ -433,9 +431,9 @@ public: * * See IndexCatalogEntry::setMultikey(). */ - virtual void setMultikeyPaths(OperationContext* const opCtx, + virtual void setMultikeyPaths(OperationContext* opCtx, const CollectionPtr& coll, - const IndexDescriptor* const desc, + const IndexDescriptor* desc, const KeyStringSet& multikeyMetadataKeys, const MultikeyPaths& multikeyPaths) const = 0; @@ -447,10 +445,10 @@ public: * * This method may throw. */ - virtual Status indexRecords(OperationContext* const opCtx, + virtual Status indexRecords(OperationContext* opCtx, const CollectionPtr& collection, const std::vector<BsonRecord>& bsonRecords, - int64_t* const keysInsertedOut) const = 0; + int64_t* keysInsertedOut) const = 0; /** * Both 'keysInsertedOut' and 'keysDeletedOut' are required and will be set to the number of @@ -458,24 +456,24 @@ public: * * This method may throw. */ - virtual Status updateRecord(OperationContext* const opCtx, + virtual Status updateRecord(OperationContext* opCtx, const CollectionPtr& coll, const BSONObj& oldDoc, const BSONObj& newDoc, const RecordId& recordId, - int64_t* const keysInsertedOut, - int64_t* const keysDeletedOut) const = 0; + int64_t* keysInsertedOut, + int64_t* keysDeletedOut) const = 0; /** * When 'keysDeletedOut' is not null, it will be set to the number of index keys removed by * this operation. */ - virtual void unindexRecord(OperationContext* const opCtx, + virtual void unindexRecord(OperationContext* opCtx, const CollectionPtr& collection, const BSONObj& obj, const RecordId& loc, - const bool noWarn, - int64_t* const keysDeletedOut) const = 0; + bool noWarn, + int64_t* keysDeletedOut) const = 0; /* * Attempt compaction on all ready indexes to regain disk space, if the storage engine's index diff --git a/src/mongo/db/catalog/index_catalog_entry.h b/src/mongo/db/catalog/index_catalog_entry.h index 9468f0d3f89..6e733338308 100644 --- a/src/mongo/db/catalog/index_catalog_entry.h +++ b/src/mongo/db/catalog/index_catalog_entry.h @@ -94,7 +94,7 @@ public: /// --------------------- - virtual void setIsReady(const bool newIsReady) = 0; + virtual void setIsReady(bool newIsReady) = 0; virtual void setDropped() = 0; virtual bool isDropped() const = 0; @@ -104,8 +104,7 @@ public: /** * Returns true if this index is multikey and false otherwise. */ - virtual bool isMultikey(OperationContext* const opCtx, - const CollectionPtr& collection) const = 0; + virtual bool isMultikey(OperationContext* opCtx, const CollectionPtr& collection) const = 0; /** * Returns the path components that cause this index to be multikey if this index supports @@ -116,7 +115,7 @@ public: * returns a vector with size equal to the number of elements in the index key pattern where * each element in the vector is an empty set. */ - virtual MultikeyPaths getMultikeyPaths(OperationContext* const opCtx, + virtual MultikeyPaths getMultikeyPaths(OperationContext* opCtx, const CollectionPtr& collection) const = 0; /** @@ -134,7 +133,7 @@ public: * namespace, index name, and multikey paths on the OperationContext rather than set the index * as multikey here. */ - virtual void setMultikey(OperationContext* const opCtx, + virtual void setMultikey(OperationContext* opCtx, const CollectionPtr& coll, const KeyStringSet& multikeyMetadataKeys, const MultikeyPaths& multikeyPaths) const = 0; @@ -147,7 +146,7 @@ public: * This may also be used to allow indexes built before 3.4 to start tracking multikey path * metadata in the catalog. */ - virtual void forceSetMultikey(OperationContext* const opCtx, + virtual void forceSetMultikey(OperationContext* opCtx, const CollectionPtr& coll, bool isMultikey, const MultikeyPaths& multikeyPaths) const = 0; @@ -183,7 +182,7 @@ public: */ virtual boost::optional<Timestamp> getMinimumVisibleSnapshot() const = 0; - virtual void setMinimumVisibleSnapshot(const Timestamp name) = 0; + virtual void setMinimumVisibleSnapshot(Timestamp name) = 0; }; class IndexCatalogEntryContainer { diff --git a/src/mongo/db/catalog/index_catalog_entry_impl.h b/src/mongo/db/catalog/index_catalog_entry_impl.h index 6a2d84228ae..44607746903 100644 --- a/src/mongo/db/catalog/index_catalog_entry_impl.h +++ b/src/mongo/db/catalog/index_catalog_entry_impl.h @@ -124,7 +124,7 @@ public: /** * Returns true if this index is multikey, and returns false otherwise. */ - bool isMultikey(OperationContext* const opCtx, const CollectionPtr& collection) const final; + bool isMultikey(OperationContext* opCtx, const CollectionPtr& collection) const final; /** * Returns the path components that cause this index to be multikey if this index supports @@ -158,7 +158,7 @@ public: const KeyStringSet& multikeyMetadataKeys, const MultikeyPaths& multikeyPaths) const final; - void forceSetMultikey(OperationContext* const opCtx, + void forceSetMultikey(OperationContext* opCtx, const CollectionPtr& coll, bool isMultikey, const MultikeyPaths& multikeyPaths) const final; diff --git a/src/mongo/db/catalog/index_catalog_impl.h b/src/mongo/db/catalog/index_catalog_impl.h index d869d61ab92..46f3045ce9c 100644 --- a/src/mongo/db/catalog/index_catalog_impl.h +++ b/src/mongo/db/catalog/index_catalog_impl.h @@ -170,8 +170,8 @@ public: std::vector<std::shared_ptr<const IndexCatalogEntry>> getAllReadyEntriesShared() const override; using IndexIterator = IndexCatalog::IndexIterator; - std::unique_ptr<IndexIterator> getIndexIterator( - OperationContext* const opCtx, const bool includeUnfinishedIndexes) const override; + std::unique_ptr<IndexIterator> getIndexIterator(OperationContext* opCtx, + bool includeUnfinishedIndexes) const override; // ---- index set modifiers ------ @@ -195,13 +195,13 @@ public: const BSONObj& original, const boost::optional<ResumeIndexInfo>& resumeInfo = boost::none) const override; - std::vector<BSONObj> removeExistingIndexes(OperationContext* const opCtx, + std::vector<BSONObj> removeExistingIndexes(OperationContext* opCtx, const CollectionPtr& collection, const std::vector<BSONObj>& indexSpecsToBuild, - const bool removeIndexBuildsToo) const override; + bool removeIndexBuildsToo) const override; std::vector<BSONObj> removeExistingIndexesNoChecks( - OperationContext* const opCtx, + OperationContext* opCtx, const CollectionPtr& collection, const std::vector<BSONObj>& indexSpecsToBuild) const override; @@ -222,9 +222,9 @@ public: Status dropIndex(OperationContext* opCtx, Collection* collection, const IndexDescriptor* desc) override; - Status dropUnfinishedIndex(OperationContext* const opCtx, + Status dropUnfinishedIndex(OperationContext* opCtx, Collection* collection, - const IndexDescriptor* const desc) override; + const IndexDescriptor* desc) override; Status dropIndexEntry(OperationContext* opCtx, Collection* collection, @@ -243,7 +243,7 @@ public: // ---- modify single index - void setMultikeyPaths(OperationContext* const opCtx, + void setMultikeyPaths(OperationContext* opCtx, const CollectionPtr& coll, const IndexDescriptor* desc, const KeyStringSet& multikeyMetadataKeys, @@ -265,13 +265,13 @@ public: /** * See IndexCatalog::updateRecord */ - Status updateRecord(OperationContext* const opCtx, + Status updateRecord(OperationContext* opCtx, const CollectionPtr& coll, const BSONObj& oldDoc, const BSONObj& newDoc, const RecordId& recordId, - int64_t* const keysInsertedOut, - int64_t* const keysDeletedOut) const override; + int64_t* keysInsertedOut, + int64_t* keysDeletedOut) const override; /** * When 'keysDeletedOut' is not null, it will be set to the number of index keys removed by * this operation. @@ -342,14 +342,14 @@ private: const std::vector<BsonRecord>& bsonRecords, int64_t* keysInsertedOut) const; - Status _updateRecord(OperationContext* const opCtx, + Status _updateRecord(OperationContext* opCtx, const CollectionPtr& coll, const IndexCatalogEntry* index, const BSONObj& oldDoc, const BSONObj& newDoc, const RecordId& recordId, - int64_t* const keysInsertedOut, - int64_t* const keysDeletedOut) const; + int64_t* keysInsertedOut, + int64_t* keysDeletedOut) const; void _unindexKeys(OperationContext* opCtx, const CollectionPtr& collection, @@ -358,7 +358,7 @@ private: const BSONObj& obj, RecordId loc, bool logIfError, - int64_t* const keysDeletedOut) const; + int64_t* keysDeletedOut) const; void _unindexRecord(OperationContext* opCtx, const CollectionPtr& collection, @@ -411,7 +411,7 @@ private: Status _doesSpecConflictWithExisting(OperationContext* opCtx, const CollectionPtr& collection, const BSONObj& spec, - const bool includeUnfinishedIndexes) const; + bool includeUnfinishedIndexes) const; /** * Returns true if the replica set member's config has {buildIndexes:false} set, which means diff --git a/src/mongo/db/catalog/throttle_cursor.h b/src/mongo/db/catalog/throttle_cursor.h index 6b708488495..d1551fb8191 100644 --- a/src/mongo/db/catalog/throttle_cursor.h +++ b/src/mongo/db/catalog/throttle_cursor.h @@ -142,7 +142,7 @@ public: * In addition to throttling, while the thread is waiting, its operation context remains * interruptible. */ - void awaitIfNeeded(OperationContext* opCtx, const int64_t dataSize); + void awaitIfNeeded(OperationContext* opCtx, int64_t dataSize); void turnThrottlingOff() { _shouldNotThrottle = true; diff --git a/src/mongo/db/concurrency/lock_state.h b/src/mongo/db/concurrency/lock_state.h index 54a492ec99f..511163bc569 100644 --- a/src/mongo/db/concurrency/lock_state.h +++ b/src/mongo/db/concurrency/lock_state.h @@ -185,9 +185,9 @@ public: virtual ResourceId getWaitingResource() const; virtual void getLockerInfo(LockerInfo* lockerInfo, - const boost::optional<SingleThreadedLockStats> lockStatsBase) const; + boost::optional<SingleThreadedLockStats> lockStatsBase) const; virtual boost::optional<LockerInfo> getLockerInfo( - const boost::optional<SingleThreadedLockStats> lockStatsBase) const final; + boost::optional<SingleThreadedLockStats> lockStatsBase) const final; virtual bool saveLockStateAndUnlock(LockSnapshot* stateOut); diff --git a/src/mongo/db/concurrency/locker.h b/src/mongo/db/concurrency/locker.h index 75ab984bf03..9c0c49ebac0 100644 --- a/src/mongo/db/concurrency/locker.h +++ b/src/mongo/db/concurrency/locker.h @@ -345,16 +345,15 @@ public: * The precise lock stats of a sub-operation would be the stats from the locker info minus the * lockStatsBase. */ - virtual void getLockerInfo( - LockerInfo* lockerInfo, - const boost::optional<SingleThreadedLockStats> lockStatsBase) const = 0; + virtual void getLockerInfo(LockerInfo* lockerInfo, + boost::optional<SingleThreadedLockStats> lockStatsBase) const = 0; /** * Returns boost::none if this is an instance of LockerNoop, or a populated LockerInfo * otherwise. */ virtual boost::optional<LockerInfo> getLockerInfo( - const boost::optional<SingleThreadedLockStats> lockStatsBase) const = 0; + boost::optional<SingleThreadedLockStats> lockStatsBase) const = 0; /** * LockSnapshot captures the state of all resources that are locked, what modes they're diff --git a/src/mongo/db/dbdirectclient.h b/src/mongo/db/dbdirectclient.h index b580ff2e94e..23e1092b297 100644 --- a/src/mongo/db/dbdirectclient.h +++ b/src/mongo/db/dbdirectclient.h @@ -82,7 +82,7 @@ public: virtual void say(Message& toSend, bool isRetry = false, std::string* actualServer = nullptr); - virtual long long count(const NamespaceStringOrUUID nsOrUuid, + virtual long long count(NamespaceStringOrUUID nsOrUuid, const BSONObj& query = BSONObj(), int options = 0, int limit = 0, diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h index f1caed50dfe..2115fa7a144 100644 --- a/src/mongo/db/dbhelpers.h +++ b/src/mongo/db/dbhelpers.h @@ -72,7 +72,7 @@ struct Helpers { static BSONObj findOneForTesting(OperationContext* opCtx, const CollectionPtr& collection, const BSONObj& query, - const bool invariantOnError = true); + bool invariantOnError = true); /** * Similar to the 'findOne()' overload above, except returns the RecordId of the first matching diff --git a/src/mongo/db/exec/projection_executor_builder.h b/src/mongo/db/exec/projection_executor_builder.h index 2df36e8eb94..476f2b63a25 100644 --- a/src/mongo/db/exec/projection_executor_builder.h +++ b/src/mongo/db/exec/projection_executor_builder.h @@ -88,6 +88,6 @@ static constexpr auto kDefaultBuilderParams = std::unique_ptr<ProjectionExecutor> buildProjectionExecutor( boost::intrusive_ptr<ExpressionContext> expCtx, const projection_ast::Projection* projection, - const ProjectionPolicies policies, + ProjectionPolicies policies, BuilderParamsBitSet params); } // namespace mongo::projection_executor diff --git a/src/mongo/db/exec/sbe/values/value.h b/src/mongo/db/exec/sbe/values/value.h index 85b902f784c..b972cc3ad23 100644 --- a/src/mongo/db/exec/sbe/values/value.h +++ b/src/mongo/db/exec/sbe/values/value.h @@ -233,8 +233,8 @@ std::size_t hashValue(TypeTags tag, /** * Overloads for writing values and tags to stream. */ -std::ostream& operator<<(std::ostream& os, const TypeTags tag); -str::stream& operator<<(str::stream& str, const TypeTags tag); +std::ostream& operator<<(std::ostream& os, TypeTags tag); +str::stream& operator<<(str::stream& str, TypeTags tag); std::ostream& operator<<(std::ostream& os, const std::pair<TypeTags, Value>& value); str::stream& operator<<(str::stream& str, const std::pair<TypeTags, Value>& value); @@ -310,7 +310,8 @@ template <class T> using dont_deduce = typename dont_deduce_t<T>::type; template <typename T> -Value bitcastFrom(const dont_deduce<T> in) noexcept { +Value bitcastFrom( + const dont_deduce<T> in) noexcept { // NOLINT(readability-avoid-const-params-in-decls) static_assert(std::is_pointer_v<T> || std::is_integral_v<T> || std::is_floating_point_v<T>); static_assert(sizeof(Value) >= sizeof(T)); @@ -342,7 +343,7 @@ Value bitcastFrom(const dont_deduce<T> in) noexcept { } template <typename T> -T bitcastTo(const Value in) noexcept { +T bitcastTo(const Value in) noexcept { // NOLINT(readability-avoid-const-params-in-decls) static_assert(std::is_pointer_v<T> || std::is_integral_v<T> || std::is_floating_point_v<T> || std::is_same_v<Decimal128, T>); diff --git a/src/mongo/db/free_mon/free_mon_processor.h b/src/mongo/db/free_mon/free_mon_processor.h index 4064a1d3a8d..ec7c63fef45 100644 --- a/src/mongo/db/free_mon/free_mon_processor.h +++ b/src/mongo/db/free_mon/free_mon_processor.h @@ -403,7 +403,7 @@ private: /** * Notify any command registers that are waiting. */ - void notifyPendingRegisters(const Status s); + void notifyPendingRegisters(Status s); /** * Upload collected metrics. diff --git a/src/mongo/db/ftdc/ftdc_server.h b/src/mongo/db/ftdc/ftdc_server.h index e0512fe0f8b..161a93412ee 100644 --- a/src/mongo/db/ftdc/ftdc_server.h +++ b/src/mongo/db/ftdc/ftdc_server.h @@ -127,12 +127,12 @@ extern FTDCStartupParams ftdcStartupParams; /** * Server Parameter callbacks */ -Status onUpdateFTDCEnabled(const bool value); -Status onUpdateFTDCPeriod(const std::int32_t value); -Status onUpdateFTDCDirectorySize(const std::int32_t value); -Status onUpdateFTDCFileSize(const std::int32_t value); -Status onUpdateFTDCSamplesPerChunk(const std::int32_t value); -Status onUpdateFTDCPerInterimUpdate(const std::int32_t value); +Status onUpdateFTDCEnabled(bool value); +Status onUpdateFTDCPeriod(std::int32_t value); +Status onUpdateFTDCDirectorySize(std::int32_t value); +Status onUpdateFTDCFileSize(std::int32_t value); +Status onUpdateFTDCSamplesPerChunk(std::int32_t value); +Status onUpdateFTDCPerInterimUpdate(std::int32_t value); /** * Server Parameter accessors diff --git a/src/mongo/db/fts/unicode/string.h b/src/mongo/db/fts/unicode/string.h index b27f92c2960..5bf98e2bf8d 100644 --- a/src/mongo/db/fts/unicode/string.h +++ b/src/mongo/db/fts/unicode/string.h @@ -58,7 +58,7 @@ public: /** * Reset the String with the new UTF-8 source data, reusing the underlying buffer when possible. */ - void resetData(const StringData utf8_src); + void resetData(StringData utf8_src); /** * Takes a substring of the current String and puts it in another String. @@ -147,7 +147,7 @@ private: /** * Helper method for converting a UTF-8 string to a UTF-32 string. */ - void setData(const StringData utf8_src); + void setData(StringData utf8_src); /** * Unified implementation of substrToBuf and toLowerToBuf. diff --git a/src/mongo/db/geo/big_polygon.h b/src/mongo/db/geo/big_polygon.h index 6df8d3e4fd9..e7a38ecaf0e 100644 --- a/src/mongo/db/geo/big_polygon.h +++ b/src/mongo/db/geo/big_polygon.h @@ -95,11 +95,11 @@ public: bool VirtualContainsPoint(S2Point const& p) const; - void Encode(Encoder* const encoder) const; + void Encode(Encoder* encoder) const; - bool Decode(Decoder* const decoder); + bool Decode(Decoder* decoder); - bool DecodeWithinScope(Decoder* const decoder); + bool DecodeWithinScope(Decoder* decoder); private: std::unique_ptr<S2Loop> _loop; diff --git a/src/mongo/db/geo/r2_region_coverer.h b/src/mongo/db/geo/r2_region_coverer.h index e1f91624fa7..208322ff68b 100644 --- a/src/mongo/db/geo/r2_region_coverer.h +++ b/src/mongo/db/geo/r2_region_coverer.h @@ -129,9 +129,9 @@ class R2CellUnion : boost::noncopyable { public: void init(const std::vector<GeoHash>& cellIds); // Returns true if the cell union contains the given cell id. - bool contains(const GeoHash cellId) const; + bool contains(GeoHash cellId) const; // Return true if the cell union intersects the given cell id. - bool intersects(const GeoHash cellId) const; + bool intersects(GeoHash cellId) const; std::string toString() const; // Direct access to the underlying vector. diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h index be466668110..b5da30d3e0d 100644 --- a/src/mongo/db/geo/shapes.h +++ b/src/mongo/db/geo/shapes.h @@ -347,8 +347,8 @@ struct GeometryCollection { // - Polygon (from STRICT_SPHERE TO SPHERE) // struct ShapeProjection { - static bool supportsProject(const PointWithCRS& point, const CRS crs); - static bool supportsProject(const PolygonWithCRS& polygon, const CRS crs); + static bool supportsProject(const PointWithCRS& point, CRS crs); + static bool supportsProject(const PolygonWithCRS& polygon, CRS crs); static void projectInto(PointWithCRS* point, CRS crs); static void projectInto(PolygonWithCRS* point, CRS crs); }; diff --git a/src/mongo/db/index/index_build_interceptor.h b/src/mongo/db/index/index_build_interceptor.h index 091daad67f0..ed0518f8d2d 100644 --- a/src/mongo/db/index/index_build_interceptor.h +++ b/src/mongo/db/index/index_build_interceptor.h @@ -106,7 +106,7 @@ public: const MultikeyPaths& multikeyPaths, RecordId loc, Op op, - int64_t* const numKeysOut); + int64_t* numKeysOut); /** * Given a duplicate key, record the key for later verification by a call to @@ -187,8 +187,8 @@ private: const BSONObj& doc, const InsertDeleteOptions& options, TrackDuplicates trackDups, - int64_t* const keysInserted, - int64_t* const keysDeleted); + int64_t* keysInserted, + int64_t* keysDeleted); bool _checkAllWritesApplied(OperationContext* opCtx, bool fatal) const; diff --git a/src/mongo/db/index_builds_coordinator.h b/src/mongo/db/index_builds_coordinator.h index 2a8c584c201..e32a121345c 100644 --- a/src/mongo/db/index_builds_coordinator.h +++ b/src/mongo/db/index_builds_coordinator.h @@ -232,8 +232,8 @@ public: * being aborted by another caller. */ std::vector<UUID> abortCollectionIndexBuilds(OperationContext* opCx, - const NamespaceString collectionNss, - const UUID collectionUUID, + NamespaceString collectionNss, + UUID collectionUUID, const std::string& reason); /** diff --git a/src/mongo/db/mirroring_sampler.h b/src/mongo/db/mirroring_sampler.h index 9aff6957b2e..45ae3621b5c 100644 --- a/src/mongo/db/mirroring_sampler.h +++ b/src/mongo/db/mirroring_sampler.h @@ -63,12 +63,12 @@ public: * interpretations of ratio. */ struct SamplingParameters { - explicit SamplingParameters(const double ratio, const int rndMax, const int rndValue); + explicit SamplingParameters(double ratio, int rndMax, int rndValue); /** * Construct with a value from rnd(). */ - explicit SamplingParameters(const double ratio, const int rndMax, RandomFunc rnd); + explicit SamplingParameters(double ratio, int rndMax, RandomFunc rnd); /** * Construct with a value from defaultRandomFunc(). @@ -101,9 +101,9 @@ public: */ static std::vector<HostAndPort> getMirroringTargets( const std::shared_ptr<const repl::HelloResponse>& isMaster, - const double ratio, + double ratio, RandomFunc rnd = defaultRandomFunc(), - const int rndMax = defaultRandomMax()) noexcept; + int rndMax = defaultRandomMax()) noexcept; }; } // namespace mongo diff --git a/src/mongo/db/op_observer.h b/src/mongo/db/op_observer.h index d2b4c92b458..6f1777e88c3 100644 --- a/src/mongo/db/op_observer.h +++ b/src/mongo/db/op_observer.h @@ -169,16 +169,15 @@ public: * This function should only be used internally. "nss", "uuid", "o2", and the opTimes should * never be exposed to users (for instance through the appendOplogNote command). */ - virtual void onInternalOpMessage( - OperationContext* opCtx, - const NamespaceString& nss, - const boost::optional<UUID> uuid, - const BSONObj& msgObj, - const boost::optional<BSONObj> o2MsgObj, - const boost::optional<repl::OpTime> preImageOpTime, - const boost::optional<repl::OpTime> postImageOpTime, - const boost::optional<repl::OpTime> prevWriteOpTimeInTransaction, - const boost::optional<OplogSlot> slot) = 0; + virtual void onInternalOpMessage(OperationContext* opCtx, + const NamespaceString& nss, + boost::optional<UUID> uuid, + const BSONObj& msgObj, + boost::optional<BSONObj> o2MsgObj, + boost::optional<repl::OpTime> preImageOpTime, + boost::optional<repl::OpTime> postImageOpTime, + boost::optional<repl::OpTime> prevWriteOpTimeInTransaction, + boost::optional<OplogSlot> slot) = 0; /** * Logs a no-op with "msgObj" in the o field into oplog. @@ -508,7 +507,7 @@ class OpObserver::ReservedTimes { ReservedTimes& operator=(const ReservedTimes&) = delete; public: - explicit ReservedTimes(OperationContext* const opCtx); + explicit ReservedTimes(OperationContext* opCtx); ~ReservedTimes(); const Times& get() const { diff --git a/src/mongo/db/op_observer_impl.h b/src/mongo/db/op_observer_impl.h index 0c04baef118..971c7891e8b 100644 --- a/src/mongo/db/op_observer_impl.h +++ b/src/mongo/db/op_observer_impl.h @@ -109,13 +109,13 @@ public: const OplogDeleteEntryArgs& args) final; void onInternalOpMessage(OperationContext* opCtx, const NamespaceString& nss, - const boost::optional<UUID> uuid, + boost::optional<UUID> uuid, const BSONObj& msgObj, - const boost::optional<BSONObj> o2MsgObj, - const boost::optional<repl::OpTime> preImageOpTime, - const boost::optional<repl::OpTime> postImageOpTime, - const boost::optional<repl::OpTime> prevWriteOpTimeInTransaction, - const boost::optional<OplogSlot> slot) final; + boost::optional<BSONObj> o2MsgObj, + boost::optional<repl::OpTime> preImageOpTime, + boost::optional<repl::OpTime> postImageOpTime, + boost::optional<repl::OpTime> prevWriteOpTimeInTransaction, + boost::optional<OplogSlot> slot) final; void onCreateCollection(OperationContext* opCtx, const CollectionPtr& coll, const NamespaceString& collectionName, diff --git a/src/mongo/db/pipeline/accumulation_statement.h b/src/mongo/db/pipeline/accumulation_statement.h index d20bc1bb8a7..2d9ed8de52e 100644 --- a/src/mongo/db/pipeline/accumulation_statement.h +++ b/src/mongo/db/pipeline/accumulation_statement.h @@ -177,7 +177,7 @@ public: * * Throws an AssertionException if parsing fails. */ - static AccumulationStatement parseAccumulationStatement(ExpressionContext* const expCtx, + static AccumulationStatement parseAccumulationStatement(ExpressionContext* expCtx, const BSONElement& elem, const VariablesParseState& vps); diff --git a/src/mongo/db/pipeline/accumulator.h b/src/mongo/db/pipeline/accumulator.h index 63559fc3cae..3a32f06c184 100644 --- a/src/mongo/db/pipeline/accumulator.h +++ b/src/mongo/db/pipeline/accumulator.h @@ -168,14 +168,14 @@ public: * Creates a new $addToSet accumulator. If no memory limit is given, defaults to the value of * the server parameter 'internalQueryMaxAddToSetBytes'. */ - AccumulatorAddToSet(ExpressionContext* const expCtx, + AccumulatorAddToSet(ExpressionContext* expCtx, boost::optional<int> maxMemoryUsageBytes = boost::none); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); bool isAssociative() const final { return true; @@ -198,13 +198,13 @@ public: return kName.rawData(); } - explicit AccumulatorFirst(ExpressionContext* const expCtx); + explicit AccumulatorFirst(ExpressionContext* expCtx); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); AccumulatorDocumentsNeeded documentsNeeded() const final { return AccumulatorDocumentsNeeded::kFirstDocument; @@ -223,13 +223,13 @@ public: return kName.rawData(); } - explicit AccumulatorLast(ExpressionContext* const expCtx); + explicit AccumulatorLast(ExpressionContext* expCtx); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); AccumulatorDocumentsNeeded documentsNeeded() const final { return AccumulatorDocumentsNeeded::kLastDocument; @@ -247,13 +247,13 @@ public: return kName.rawData(); } - explicit AccumulatorSum(ExpressionContext* const expCtx); + explicit AccumulatorSum(ExpressionContext* expCtx); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); bool isAssociative() const final { return true; @@ -276,7 +276,7 @@ public: kMax = -1, // Used to "scale" comparison. }; - AccumulatorMinMax(ExpressionContext* const expCtx, Sense sense); + AccumulatorMinMax(ExpressionContext* expCtx, Sense sense); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; @@ -305,7 +305,7 @@ public: explicit AccumulatorMax(ExpressionContext* const expCtx) : AccumulatorMinMax(expCtx, Sense::kMax) {} - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorMin final : public AccumulatorMinMax { @@ -318,7 +318,7 @@ public: explicit AccumulatorMin(ExpressionContext* const expCtx) : AccumulatorMinMax(expCtx, Sense::kMin) {} - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorPush final : public AccumulatorState { @@ -333,14 +333,14 @@ public: * Creates a new $push accumulator. If no memory limit is given, defaults to the value of the * server parameter 'internalQueryMaxPushBytes'. */ - AccumulatorPush(ExpressionContext* const expCtx, + AccumulatorPush(ExpressionContext* expCtx, boost::optional<int> maxMemoryUsageBytes = boost::none); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); private: std::vector<Value> _array; @@ -355,13 +355,13 @@ public: return kName.rawData(); } - explicit AccumulatorAvg(ExpressionContext* const expCtx); + explicit AccumulatorAvg(ExpressionContext* expCtx); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); private: /** @@ -378,7 +378,7 @@ private: class AccumulatorStdDev : public AccumulatorState { public: - AccumulatorStdDev(ExpressionContext* const expCtx, bool isSamp); + AccumulatorStdDev(ExpressionContext* expCtx, bool isSamp); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; @@ -401,7 +401,7 @@ public: explicit AccumulatorStdDevPop(ExpressionContext* const expCtx) : AccumulatorStdDev(expCtx, false) {} - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorStdDevSamp final : public AccumulatorStdDev { @@ -414,7 +414,7 @@ public: explicit AccumulatorStdDevSamp(ExpressionContext* const expCtx) : AccumulatorStdDev(expCtx, true) {} - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorMergeObjects : public AccumulatorState { @@ -425,13 +425,13 @@ public: return kName.rawData(); } - AccumulatorMergeObjects(ExpressionContext* const expCtx); + AccumulatorMergeObjects(ExpressionContext* expCtx); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); private: MutableDocument _output; @@ -445,13 +445,13 @@ public: return kName.rawData(); } - AccumulatorExpMovingAvg(ExpressionContext* const expCtx, Decimal128 alpha); + AccumulatorExpMovingAvg(ExpressionContext* expCtx, Decimal128 alpha); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; void reset() final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx, + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx, Decimal128 alpha); private: diff --git a/src/mongo/db/pipeline/accumulator_for_window_functions.h b/src/mongo/db/pipeline/accumulator_for_window_functions.h index 63abd175ad1..77f42695935 100644 --- a/src/mongo/db/pipeline/accumulator_for_window_functions.h +++ b/src/mongo/db/pipeline/accumulator_for_window_functions.h @@ -58,7 +58,7 @@ public: class AccumulatorCovariance : public AccumulatorForWindowFunctions { public: - AccumulatorCovariance(ExpressionContext* const expCtx, bool isSamp); + AccumulatorCovariance(ExpressionContext* expCtx, bool isSamp); void processInternal(const Value& input, bool merging) final; Value getValue(bool toBeMerged) final; @@ -78,7 +78,7 @@ public: explicit AccumulatorCovarianceSamp(ExpressionContext* const expCtx) : AccumulatorCovariance(expCtx, true) {} - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorCovariancePop final : public AccumulatorCovariance { @@ -87,12 +87,12 @@ public: explicit AccumulatorCovariancePop(ExpressionContext* const expCtx) : AccumulatorCovariance(expCtx, false) {} - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorRankBase : public AccumulatorForWindowFunctions { public: - explicit AccumulatorRankBase(ExpressionContext* const expCtx); + explicit AccumulatorRankBase(ExpressionContext* expCtx); void reset(); Value getValue(bool toBeMerged) final { @@ -114,7 +114,7 @@ public: explicit AccumulatorRank(ExpressionContext* const expCtx) : AccumulatorRankBase(expCtx) {} void processInternal(const Value& input, bool merging) final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); void reset() final; private: @@ -132,7 +132,7 @@ public: explicit AccumulatorDocumentNumber(ExpressionContext* const expCtx) : AccumulatorRankBase(expCtx) {} void processInternal(const Value& input, bool merging) final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorDenseRank : public AccumulatorRankBase { @@ -145,7 +145,7 @@ public: explicit AccumulatorDenseRank(ExpressionContext* const expCtx) : AccumulatorRankBase(expCtx) {} void processInternal(const Value& input, bool merging) final; - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorIntegral : public AccumulatorForWindowFunctions { @@ -156,7 +156,7 @@ public: return kName.rawData(); } - explicit AccumulatorIntegral(ExpressionContext* const expCtx, + explicit AccumulatorIntegral(ExpressionContext* expCtx, boost::optional<long long> unitMillis = boost::none); void processInternal(const Value& input, bool merging) final; @@ -164,7 +164,7 @@ public: void reset() final; static boost::intrusive_ptr<AccumulatorState> create( - ExpressionContext* const expCtx, boost::optional<long long> unitMillis = boost::none); + ExpressionContext* expCtx, boost::optional<long long> unitMillis = boost::none); private: WindowFunctionIntegral _integralWF; diff --git a/src/mongo/db/pipeline/accumulator_js_reduce.h b/src/mongo/db/pipeline/accumulator_js_reduce.h index 3b8f6adfa8d..af025132ee0 100644 --- a/src/mongo/db/pipeline/accumulator_js_reduce.h +++ b/src/mongo/db/pipeline/accumulator_js_reduce.h @@ -46,10 +46,10 @@ public: return kName.rawData(); } - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx, + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx, StringData funcSource); - static AccumulationExpression parseInternalJsReduce(ExpressionContext* const expCtx, + static AccumulationExpression parseInternalJsReduce(ExpressionContext* expCtx, BSONElement elem, VariablesParseState vps); @@ -86,13 +86,13 @@ public: // An AccumulatorState instance only owns its "static" arguments: those that don't need to be // evaluated per input document. - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx, + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx, std::string init, std::string accumulate, std::string merge, boost::optional<std::string> finalize); - static AccumulationExpression parse(ExpressionContext* const expCtx, + static AccumulationExpression parse(ExpressionContext* expCtx, BSONElement elem, VariablesParseState vps); diff --git a/src/mongo/db/pipeline/accumulator_multi.h b/src/mongo/db/pipeline/accumulator_multi.h index aac2dc66c15..a07899cb608 100644 --- a/src/mongo/db/pipeline/accumulator_multi.h +++ b/src/mongo/db/pipeline/accumulator_multi.h @@ -43,7 +43,7 @@ using Sense = AccumulatorMinMax::Sense; */ class AccumulatorN : public AccumulatorState { public: - AccumulatorN(ExpressionContext* const expCtx); + AccumulatorN(ExpressionContext* expCtx); protected: // Initialize 'n' with 'input'. In particular, verifies that 'input' is a positive integer. @@ -52,7 +52,7 @@ protected: // Parses 'args' for the 'n' and 'output' arguments that are common to the 'N' family of // accumulators. static std::tuple<boost::intrusive_ptr<Expression>, boost::intrusive_ptr<Expression>> parseArgs( - ExpressionContext* const expCtx, const BSONObj& args, VariablesParseState vps); + ExpressionContext* expCtx, const BSONObj& args, VariablesParseState vps); // Helper which appends the 'n' and 'output' fields to 'md'. static void serializeHelper(const boost::intrusive_ptr<Expression>& initializer, @@ -72,14 +72,14 @@ private: }; class AccumulatorMinMaxN : public AccumulatorN { public: - AccumulatorMinMaxN(ExpressionContext* const expCtx, Sense sense); + AccumulatorMinMaxN(ExpressionContext* expCtx, Sense sense); /** * Verifies that 'elem' is an object, delegates argument parsing to 'AccumulatorN::parseArgs', * and constructs an AccumulationExpression representing $minN or $maxN depending on 's'. */ template <Sense s> - static AccumulationExpression parseMinMaxN(ExpressionContext* const expCtx, + static AccumulationExpression parseMinMaxN(ExpressionContext* expCtx, BSONElement elem, VariablesParseState vps); @@ -118,7 +118,7 @@ public: static const char* getName(); - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; class AccumulatorMaxN : public AccumulatorMinMaxN { @@ -129,6 +129,6 @@ public: static const char* getName(); - static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* const expCtx); + static boost::intrusive_ptr<AccumulatorState> create(ExpressionContext* expCtx); }; } // namespace mongo diff --git a/src/mongo/db/pipeline/change_stream_helpers_legacy.h b/src/mongo/db/pipeline/change_stream_helpers_legacy.h index 4c790782a20..2c1dd86008a 100644 --- a/src/mongo/db/pipeline/change_stream_helpers_legacy.h +++ b/src/mongo/db/pipeline/change_stream_helpers_legacy.h @@ -37,7 +37,6 @@ namespace mongo::change_stream_legacy { * pipeline stages. */ std::list<boost::intrusive_ptr<DocumentSource>> buildPipeline( - const boost::intrusive_ptr<ExpressionContext>& expCtx, - const DocumentSourceChangeStreamSpec spec); + const boost::intrusive_ptr<ExpressionContext>& expCtx, DocumentSourceChangeStreamSpec spec); } // namespace mongo::change_stream_legacy diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index f81aa3ff78a..bcedf219dbd 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -603,8 +603,7 @@ public: } protected: - DocumentSource(const StringData stageName, - const boost::intrusive_ptr<ExpressionContext>& pExpCtx); + DocumentSource(StringData stageName, const boost::intrusive_ptr<ExpressionContext>& pExpCtx); /** * The main execution API of a DocumentSource. Returns an intermediate query result generated by diff --git a/src/mongo/db/pipeline/document_source_change_stream.h b/src/mongo/db/pipeline/document_source_change_stream.h index 35247ef07ea..6ff91a7f689 100644 --- a/src/mongo/db/pipeline/document_source_change_stream.h +++ b/src/mongo/db/pipeline/document_source_change_stream.h @@ -193,7 +193,7 @@ public: * Helper used by various change stream stages. Used for asserting that a certain Value of a * field has a certain type. Will uassert() if the field does not have the expected type. */ - static void checkValueType(const Value v, const StringData fieldName, BSONType expectedType); + static void checkValueType(Value v, StringData fieldName, BSONType expectedType); /** * Extracts the resume token from the given spec. If a 'startAtOperationTime' is specified, 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 6f5addd5cc1..980672ca95f 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 @@ -56,7 +56,7 @@ public: } static boost::intrusive_ptr<DocumentSourceChangeStreamAddPostImage> createFromBson( - const BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); + BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); /** * Only modifies a single path: "fullDocument". 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 850130359e7..1808cbe7995 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 @@ -52,7 +52,7 @@ public: static constexpr StringData kStageName = "$_internalChangeStreamCheckTopologyChange"_sd; static boost::intrusive_ptr<DocumentSourceChangeStreamCheckTopologyChange> createFromBson( - const BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); + BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); static boost::intrusive_ptr<DocumentSourceChangeStreamCheckTopologyChange> create( const boost::intrusive_ptr<ExpressionContext>& expCtx) { diff --git a/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h b/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h index 358b36fae38..11c1ecdbe5a 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h +++ b/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h @@ -56,7 +56,7 @@ public: const DocumentSourceChangeStreamSpec& spec); static boost::intrusive_ptr<DocumentSourceChangeStreamAddPreImage> createFromBson( - const BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); + BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); DocumentSourceChangeStreamAddPreImage(const boost::intrusive_ptr<ExpressionContext>& expCtx, FullDocumentBeforeChangeModeEnum mode) diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h b/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h index ba71e5b6bea..3388d5df693 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h +++ b/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h @@ -50,7 +50,7 @@ public: const boost::intrusive_ptr<ExpressionContext>&); static boost::intrusive_ptr<DocumentSourceChangeStreamUnwindTransaction> createFromBson( - const BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); + BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); DepsTracker::State getDependencies(DepsTracker* deps) const final; diff --git a/src/mongo/db/pipeline/document_source_exchange.h b/src/mongo/db/pipeline/document_source_exchange.h index ab69ed3b010..dd2c00030de 100644 --- a/src/mongo/db/pipeline/document_source_exchange.h +++ b/src/mongo/db/pipeline/document_source_exchange.h @@ -200,7 +200,7 @@ public: * while waiting. */ DocumentSourceExchange(const boost::intrusive_ptr<ExpressionContext>& expCtx, - const boost::intrusive_ptr<Exchange> exchange, + boost::intrusive_ptr<Exchange> exchange, size_t consumerId, std::unique_ptr<ResourceYielder> yielder); 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 3452f1deb9c..c98d305df05 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 @@ -47,7 +47,7 @@ public: const boost::intrusive_ptr<ExpressionContext>&); static boost::intrusive_ptr<DocumentSourceFindAndModifyImageLookup> createFromBson( - const BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); + BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); DepsTracker::State getDependencies(DepsTracker* deps) const final; diff --git a/src/mongo/db/pipeline/document_source_group.h b/src/mongo/db/pipeline/document_source_group.h index 250779f7760..4a00a4fea7b 100644 --- a/src/mongo/db/pipeline/document_source_group.h +++ b/src/mongo/db/pipeline/document_source_group.h @@ -140,7 +140,7 @@ public: /** * Sets the expression to use to determine the group id of each document. */ - void setIdExpression(const boost::intrusive_ptr<Expression> idExpression); + void setIdExpression(boost::intrusive_ptr<Expression> idExpression); /** * Returns true if this $group stage represents a 'global' $group which is merging together 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 958e39ad5f3..ca4855dfff2 100644 --- a/src/mongo/db/pipeline/document_source_single_document_transformation.h +++ b/src/mongo/db/pipeline/document_source_single_document_transformation.h @@ -53,7 +53,7 @@ public: DocumentSourceSingleDocumentTransformation( const boost::intrusive_ptr<ExpressionContext>& pExpCtx, std::unique_ptr<TransformerInterface> parsedTransform, - const StringData name, + StringData name, bool independentOfAnyCollection); // virtuals from DocumentSource diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index 4b4bf8287b9..bece437d250 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -247,7 +247,7 @@ public: * Calls parseExpression() on any sub-document (including possibly the entire document) which * consists of a single field name starting with a '$'. */ - static boost::intrusive_ptr<Expression> parseObject(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parseObject(ExpressionContext* expCtx, BSONObj obj, const VariablesParseState& vps); @@ -257,7 +257,7 @@ public: * Throws an error if 'obj' does not contain exactly one field, or if that field's name does not * match a registered expression name. */ - static boost::intrusive_ptr<Expression> parseExpression(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parseExpression(ExpressionContext* expCtx, BSONObj obj, const VariablesParseState& vps); @@ -268,7 +268,7 @@ public: * parseObject(), ExpressionFieldPath::parse(), ExpressionArray::parse(), or * ExpressionConstant::parse() as necessary. */ - static boost::intrusive_ptr<Expression> parseOperand(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parseOperand(ExpressionContext* expCtx, BSONElement exprElement, const VariablesParseState& vps); @@ -369,7 +369,7 @@ public: virtual void validateArguments(const ExpressionVector& args) const {} - static ExpressionVector parseArguments(ExpressionContext* const expCtx, + static ExpressionVector parseArguments(ExpressionContext* expCtx, BSONElement bsonExpr, const VariablesParseState& vps); @@ -596,7 +596,7 @@ public: */ class ExpressionConstant final : public Expression { public: - ExpressionConstant(ExpressionContext* const expCtx, const Value& value); + ExpressionConstant(ExpressionContext* expCtx, const Value& value); boost::intrusive_ptr<Expression> optimize() final; Value evaluate(const Document& root, Variables* variables) const final; @@ -607,10 +607,10 @@ public: /** * Creates a new ExpressionConstant with value 'value'. */ - static boost::intrusive_ptr<ExpressionConstant> create(ExpressionContext* const expCtx, + static boost::intrusive_ptr<ExpressionConstant> create(ExpressionContext* expCtx, const Value& value); - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement bsonExpr, const VariablesParseState& vps); @@ -1121,7 +1121,7 @@ public: Value serialize(bool explain) const final; static boost::intrusive_ptr<ExpressionCoerceToBool> create( - ExpressionContext* const expCtx, boost::intrusive_ptr<Expression> pExpression); + ExpressionContext* expCtx, boost::intrusive_ptr<Expression> pExpression); void acceptVisitor(ExpressionMutableVisitor* visitor) final { return visitor->visit(this); @@ -1135,8 +1135,7 @@ protected: void _doAddDependencies(DepsTracker* deps) const final; private: - ExpressionCoerceToBool(ExpressionContext* const expCtx, - boost::intrusive_ptr<Expression> pExpression); + ExpressionCoerceToBool(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> pExpression); boost::intrusive_ptr<Expression>& pExpression; }; @@ -1170,13 +1169,13 @@ public: return cmpOp; } - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement bsonExpr, const VariablesParseState& vps, CmpOp cmpOp); static boost::intrusive_ptr<ExpressionCompare> create( - ExpressionContext* const expCtx, + ExpressionContext* expCtx, CmpOp cmpOp, const boost::intrusive_ptr<Expression>& exprLeft, const boost::intrusive_ptr<Expression>& exprRight); @@ -1250,7 +1249,7 @@ public: Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -1268,7 +1267,7 @@ private: class ExpressionDateFromString final : public Expression { public: - ExpressionDateFromString(ExpressionContext* const expCtx, + ExpressionDateFromString(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> dateString, boost::intrusive_ptr<Expression> timeZone, boost::intrusive_ptr<Expression> format, @@ -1279,7 +1278,7 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -1304,7 +1303,7 @@ private: class ExpressionDateFromParts final : public Expression { public: - ExpressionDateFromParts(ExpressionContext* const expCtx, + ExpressionDateFromParts(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> year, boost::intrusive_ptr<Expression> month, boost::intrusive_ptr<Expression> day, @@ -1321,7 +1320,7 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -1392,7 +1391,7 @@ public: /** * The iso8601 argument controls whether to output ISO8601 elements or natural calendar. */ - ExpressionDateToParts(ExpressionContext* const expCtx, + ExpressionDateToParts(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone, boost::intrusive_ptr<Expression> iso8601); @@ -1401,7 +1400,7 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -1426,7 +1425,7 @@ private: class ExpressionDateToString final : public Expression { public: - ExpressionDateToString(ExpressionContext* const expCtx, + ExpressionDateToString(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> format, boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> timeZone, @@ -1435,7 +1434,7 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -1537,7 +1536,7 @@ public: * startOfWeek - expression defining the week start day that resolves to a string Value. Can be * nullptr. */ - ExpressionDateDiff(ExpressionContext* const expCtx, + ExpressionDateDiff(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> startDate, boost::intrusive_ptr<Expression> endDate, boost::intrusive_ptr<Expression> unit, @@ -1546,7 +1545,7 @@ public: boost::intrusive_ptr<Expression> optimize() final; Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); void acceptVisitor(ExpressionMutableVisitor* visitor) final { @@ -1689,19 +1688,19 @@ public: indicator @returns the newly created field path expression */ - static boost::intrusive_ptr<ExpressionFieldPath> deprecatedCreate( - ExpressionContext* const expCtx, const std::string& fieldPath); + static boost::intrusive_ptr<ExpressionFieldPath> deprecatedCreate(ExpressionContext* expCtx, + const std::string& fieldPath); // Parse from the raw std::string from the user with the "$" prefixes. - static boost::intrusive_ptr<ExpressionFieldPath> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<ExpressionFieldPath> parse(ExpressionContext* expCtx, const std::string& raw, const VariablesParseState& vps); // Create from a non-prefixed string. Assumes path not variable. static boost::intrusive_ptr<ExpressionFieldPath> createPathFromString( - ExpressionContext* const expCtx, const std::string& raw, const VariablesParseState& vps); + ExpressionContext* expCtx, const std::string& raw, const VariablesParseState& vps); // Create from a non-prefixed string. Assumes variable not path. static boost::intrusive_ptr<ExpressionFieldPath> createVarFromString( - ExpressionContext* const expCtx, const std::string& raw, const VariablesParseState& vps); + ExpressionContext* expCtx, const std::string& raw, const VariablesParseState& vps); /** * Returns true if this expression logically represents the path 'dottedPath'. For example, if @@ -1745,7 +1744,7 @@ protected: void _doAddDependencies(DepsTracker* deps) const final; private: - ExpressionFieldPath(ExpressionContext* const expCtx, + ExpressionFieldPath(ExpressionContext* expCtx, const std::string& fieldPath, Variables::Id variable); @@ -1778,11 +1777,11 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); - ExpressionFilter(ExpressionContext* const expCtx, + ExpressionFilter(ExpressionContext* expCtx, std::string varName, Variables::Id varId, boost::intrusive_ptr<Expression> input, @@ -2001,7 +2000,7 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -2032,7 +2031,7 @@ protected: void _doAddDependencies(DepsTracker* deps) const final; private: - ExpressionLet(ExpressionContext* const expCtx, + ExpressionLet(ExpressionContext* expCtx, VariableMap&& vars, std::vector<boost::intrusive_ptr<Expression>> children, std::vector<Variables::Id> orderedVariableIds); @@ -2113,7 +2112,7 @@ public: Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -2133,7 +2132,7 @@ protected: private: ExpressionMap( - ExpressionContext* const expCtx, + ExpressionContext* expCtx, const std::string& varName, // name of variable to set Variables::Id varId, // id of variable to set boost::intrusive_ptr<Expression> input, // yields array to iterate @@ -2147,12 +2146,12 @@ private: class ExpressionMeta final : public Expression { public: - ExpressionMeta(ExpressionContext* const expCtx, DocumentMetadataFields::MetaType metaType); + ExpressionMeta(ExpressionContext* expCtx, DocumentMetadataFields::MetaType metaType); Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -2344,14 +2343,14 @@ public: Value serialize(bool explain) const final; static boost::intrusive_ptr<ExpressionObject> create( - ExpressionContext* const expCtx, + ExpressionContext* expCtx, std::vector<std::pair<std::string, boost::intrusive_ptr<Expression>>>&& expressionsWithChildrenInPlace); /** * Parses and constructs an ExpressionObject from 'obj'. */ - static boost::intrusive_ptr<ExpressionObject> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<ExpressionObject> parse(ExpressionContext* expCtx, BSONObj obj, const VariablesParseState& vps); @@ -2378,7 +2377,7 @@ protected: private: ExpressionObject( - ExpressionContext* const expCtx, + ExpressionContext* expCtx, std::vector<boost::intrusive_ptr<Expression>> children, std::vector<std::pair<std::string, boost::intrusive_ptr<Expression>&>>&& expressions); @@ -2426,7 +2425,7 @@ public: ExpressionPow(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionFixedArity<ExpressionPow, 2>(expCtx, std::move(children)) {} - static boost::intrusive_ptr<Expression> create(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> create(ExpressionContext* expCtx, Value base, Value exp); @@ -2481,7 +2480,7 @@ public: Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); Value serialize(bool explain) const final; @@ -2540,7 +2539,7 @@ class ExpressionReplaceOne final : public ExpressionReplaceBase { public: using ExpressionReplaceBase::ExpressionReplaceBase; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -2571,7 +2570,7 @@ public: expCtx->sbeCompatible = false; } - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -3066,7 +3065,7 @@ public: Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); Value serialize(bool explain) const final; @@ -3155,7 +3154,7 @@ public: Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); Value serialize(bool explain) const final; @@ -3214,7 +3213,7 @@ public: ExpressionTrunc(ExpressionContext* const expCtx, ExpressionVector&& children) : ExpressionRangedArity<ExpressionTrunc, 1, 2>(expCtx, std::move(children)) {} - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement elem, const VariablesParseState& vps); Value evaluate(const Document& root, Variables* variables) const final; @@ -3406,7 +3405,7 @@ public: Value evaluate(const Document& root, Variables* variables) const final; boost::intrusive_ptr<Expression> optimize() final; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); Value serialize(bool explain) const final; @@ -3430,7 +3429,7 @@ private: class ExpressionConvert final : public Expression { public: - ExpressionConvert(ExpressionContext* const expCtx, + ExpressionConvert(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> input, boost::intrusive_ptr<Expression> to, boost::intrusive_ptr<Expression> onError, @@ -3439,11 +3438,11 @@ public: * Creates a $convert expression converting from 'input' to the type given by 'toType'. Leaves * 'onNull' and 'onError' unspecified. */ - static boost::intrusive_ptr<Expression> create(ExpressionContext* const, + static boost::intrusive_ptr<Expression> create(ExpressionContext*, boost::intrusive_ptr<Expression> input, BSONType toType); - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); @@ -3604,7 +3603,7 @@ private: class ExpressionRegexFind final : public ExpressionRegex { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); @@ -3623,7 +3622,7 @@ public: class ExpressionRegexFindAll final : public ExpressionRegex { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); @@ -3641,7 +3640,7 @@ public: class ExpressionRegexMatch final : public ExpressionRegex { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vpsIn); @@ -3667,11 +3666,11 @@ class ExpressionRandom final : public Expression { static constexpr double kMaxValue = 1.0; public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement exprElement, const VariablesParseState& vps); - Value serialize(const bool explain) const final; + Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; @@ -3691,7 +3690,7 @@ protected: void _doAddDependencies(DepsTracker* deps) const final override; private: - explicit ExpressionRandom(ExpressionContext* const expCtx); + explicit ExpressionRandom(ExpressionContext* expCtx); double getRandomValue() const; }; @@ -3704,7 +3703,7 @@ public: expCtx->sbeCompatible = false; }; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -3776,7 +3775,7 @@ class ExpressionDateAdd final : public ExpressionDateArithmetics { public: using ExpressionDateArithmetics::ExpressionDateArithmetics; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -3799,7 +3798,7 @@ class ExpressionDateSubtract final : public ExpressionDateArithmetics { public: using ExpressionDateArithmetics::ExpressionDateArithmetics; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -3837,7 +3836,7 @@ struct SubstituteFieldPathWalker { */ class ExpressionDateTrunc final : public Expression { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); /** @@ -3850,7 +3849,7 @@ public: * startOfWeek - an expression defining the week start day that resolves to a string Value. Can * be nullptr. */ - ExpressionDateTrunc(ExpressionContext* const expCtx, + ExpressionDateTrunc(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> date, boost::intrusive_ptr<Expression> unit, boost::intrusive_ptr<Expression> binSize, @@ -3925,7 +3924,7 @@ private: class ExpressionGetField final : public Expression { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement exprElement, const VariablesParseState& vps); @@ -3945,7 +3944,7 @@ public: expCtx->sbeCompatible = false; } - Value serialize(const bool explain) const final; + Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; @@ -3971,7 +3970,7 @@ private: class ExpressionSetField final : public Expression { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement exprElement, const VariablesParseState& vps); @@ -3990,7 +3989,7 @@ public: expCtx->sbeCompatible = false; } - Value serialize(const bool explain) const final; + Value serialize(bool explain) const final; Value evaluate(const Document& root, Variables* variables) const final; diff --git a/src/mongo/db/pipeline/expression_context.h b/src/mongo/db/pipeline/expression_context.h index 4d4de66f0ed..b40028dc30a 100644 --- a/src/mongo/db/pipeline/expression_context.h +++ b/src/mongo/db/pipeline/expression_context.h @@ -89,8 +89,7 @@ public: * This constructor is private, all CollatorStashes should be created by calling * ExpressionContext::temporarilyChangeCollator(). */ - CollatorStash(ExpressionContext* const expCtx, - std::unique_ptr<CollatorInterface> newCollator); + CollatorStash(ExpressionContext* expCtx, std::unique_ptr<CollatorInterface> newCollator); friend class ExpressionContext; diff --git a/src/mongo/db/pipeline/expression_function.h b/src/mongo/db/pipeline/expression_function.h index d570bdfbc89..b8d6b95e35a 100644 --- a/src/mongo/db/pipeline/expression_function.h +++ b/src/mongo/db/pipeline/expression_function.h @@ -40,7 +40,7 @@ namespace mongo { */ class ExpressionFunction final : public Expression { public: - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -83,7 +83,7 @@ public: static constexpr auto kJavaScript = "js"; private: - ExpressionFunction(ExpressionContext* const expCtx, + ExpressionFunction(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> passedArgs, bool assignFirstArgToThis, std::string funcSourceString, diff --git a/src/mongo/db/pipeline/expression_js_emit.h b/src/mongo/db/pipeline/expression_js_emit.h index 7aebbf3cb1d..e19907de84e 100644 --- a/src/mongo/db/pipeline/expression_js_emit.h +++ b/src/mongo/db/pipeline/expression_js_emit.h @@ -42,7 +42,7 @@ class ExpressionInternalJsEmit final : public Expression { public: static constexpr auto kExpressionName = "$_internalJsEmit"_sd; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -88,7 +88,7 @@ public: } _emitState; private: - ExpressionInternalJsEmit(ExpressionContext* const expCtx, + ExpressionInternalJsEmit(ExpressionContext* expCtx, boost::intrusive_ptr<Expression> thisRef, std::string funcSourceString); diff --git a/src/mongo/db/pipeline/expression_test_api_version.h b/src/mongo/db/pipeline/expression_test_api_version.h index a78464dff45..cd5436d61b3 100644 --- a/src/mongo/db/pipeline/expression_test_api_version.h +++ b/src/mongo/db/pipeline/expression_test_api_version.h @@ -42,7 +42,7 @@ public: static constexpr auto kUnstableField = "unstable"; static constexpr auto kDeprecatedField = "deprecated"; - static boost::intrusive_ptr<Expression> parse(ExpressionContext* const expCtx, + static boost::intrusive_ptr<Expression> parse(ExpressionContext* expCtx, BSONElement expr, const VariablesParseState& vps); @@ -59,7 +59,7 @@ public: } private: - ExpressionTestApiVersion(ExpressionContext* const expCtx, bool unstable, bool deprecated); + ExpressionTestApiVersion(ExpressionContext* expCtx, bool unstable, bool deprecated); void _doAddDependencies(DepsTracker* deps) const final override; bool _unstable; diff --git a/src/mongo/db/pipeline/granularity_rounder.h b/src/mongo/db/pipeline/granularity_rounder.h index a3cdb0c6086..82b067f5d0a 100644 --- a/src/mongo/db/pipeline/granularity_rounder.h +++ b/src/mongo/db/pipeline/granularity_rounder.h @@ -139,7 +139,7 @@ public: */ static boost::intrusive_ptr<GranularityRounder> create( const boost::intrusive_ptr<ExpressionContext>& expCtx, - const std::vector<double> baseSeries, + std::vector<double> baseSeries, std::string name); Value roundUp(Value value); Value roundDown(Value value); diff --git a/src/mongo/db/pipeline/lite_parsed_pipeline.h b/src/mongo/db/pipeline/lite_parsed_pipeline.h index 51303f3aa04..47f164f4e06 100644 --- a/src/mongo/db/pipeline/lite_parsed_pipeline.h +++ b/src/mongo/db/pipeline/lite_parsed_pipeline.h @@ -145,11 +145,10 @@ public: * before forwarding an aggregation command on an unsharded collection, in order to verify that * the involved namespaces are allowed to be sharded. */ - void verifyIsSupported( - OperationContext* opCtx, - const std::function<bool(OperationContext*, const NamespaceString&)> isSharded, - const boost::optional<ExplainOptions::Verbosity> explain, - bool enableMajorityReadConcern) const; + void verifyIsSupported(OperationContext* opCtx, + std::function<bool(OperationContext*, const NamespaceString&)> isSharded, + boost::optional<ExplainOptions::Verbosity> explain, + bool enableMajorityReadConcern) const; /** * Returns true if the first stage in the pipeline does not require an input source. diff --git a/src/mongo/db/pipeline/make_js_function.h b/src/mongo/db/pipeline/make_js_function.h index 9b36b23d9a6..aa619cff7f5 100644 --- a/src/mongo/db/pipeline/make_js_function.h +++ b/src/mongo/db/pipeline/make_js_function.h @@ -37,6 +37,6 @@ namespace mongo { /** * Parses and returns an executable Javascript function. */ -ScriptingFunction makeJsFunc(ExpressionContext* const expCtx, const std::string& func); +ScriptingFunction makeJsFunc(ExpressionContext* expCtx, const std::string& func); } // namespace mongo diff --git a/src/mongo/db/pipeline/pipeline.h b/src/mongo/db/pipeline/pipeline.h index eded6e32740..7559e3f6a97 100644 --- a/src/mongo/db/pipeline/pipeline.h +++ b/src/mongo/db/pipeline/pipeline.h @@ -150,7 +150,7 @@ public: static std::unique_ptr<Pipeline, PipelineDeleter> makePipeline( const std::vector<BSONObj>& rawPipeline, const boost::intrusive_ptr<ExpressionContext>& expCtx, - const MakePipelineOptions opts = MakePipelineOptions{}); + MakePipelineOptions opts = MakePipelineOptions{}); static std::unique_ptr<Pipeline, PipelineDeleter> makePipelineFromViewDefinition( const boost::intrusive_ptr<ExpressionContext>& expCtx, diff --git a/src/mongo/db/pipeline/pipeline_metadata_tree.h b/src/mongo/db/pipeline/pipeline_metadata_tree.h index 8e82cbbdab0..9c055a7f994 100644 --- a/src/mongo/db/pipeline/pipeline_metadata_tree.h +++ b/src/mongo/db/pipeline/pipeline_metadata_tree.h @@ -129,7 +129,7 @@ inline auto findStageContents(const NamespaceString& ns, namespace detail { template <typename T> std::pair<boost::optional<Stage<T>>, std::function<T(const T&)>> makeTreeWithOffTheEndStage( - std::map<NamespaceString, T>&& initialStageContents, + const std::map<NamespaceString, T>& initialStageContents, const Pipeline& pipeline, const std::function<T(const T&, const std::vector<T>&, const DocumentSource&)>& propagator); @@ -145,18 +145,17 @@ std::pair<boost::optional<Stage<T>>, std::function<T(const T&)>> makeTreeWithOff */ template <typename T> inline auto makeAdditionalChildren( - std::map<NamespaceString, T>&& initialStageContents, + const std::map<NamespaceString, T>& initialStageContents, const DocumentSource& source, const std::function<T(const T&, const std::vector<T>&, const DocumentSource&)>& propagator, const T& currentContentsToCopyForFacet) { std::vector<Stage<T>> children; std::vector<T> offTheEndContents; + if (auto lookupSource = dynamic_cast<const DocumentSourceLookUp*>(&source); lookupSource && lookupSource->hasPipeline()) { - auto [child, offTheEndReshaper] = - makeTreeWithOffTheEndStage(std::move(initialStageContents), - lookupSource->getResolvedIntrospectionPipeline(), - propagator); + auto [child, offTheEndReshaper] = makeTreeWithOffTheEndStage( + initialStageContents, lookupSource->getResolvedIntrospectionPipeline(), propagator); offTheEndContents.push_back(offTheEndReshaper(child.get().contents)); children.push_back(std::move(*child)); } @@ -166,7 +165,7 @@ inline auto makeAdditionalChildren( std::back_inserter(children), [&](const auto& fPipe) { auto [child, offTheEndReshaper] = makeTreeWithOffTheEndStage( - std::move(initialStageContents), *fPipe.pipeline, propagator); + initialStageContents, *fPipe.pipeline, propagator); offTheEndContents.push_back(offTheEndReshaper(child.get().contents)); return std::move(*child); }); @@ -183,7 +182,7 @@ inline auto makeAdditionalChildren( */ template <typename T> inline auto makeStage( - std::map<NamespaceString, T>&& initialStageContents, + const std::map<NamespaceString, T>& initialStageContents, boost::optional<Stage<T>>&& previous, const std::function<T(const T&)>& reshapeContents, const DocumentSource& source, @@ -192,7 +191,7 @@ inline auto makeStage( : findStageContents(source.getContext()->ns, initialStageContents); auto [additionalChildren, offTheEndContents] = - makeAdditionalChildren(std::move(initialStageContents), source, propagator, contents); + makeAdditionalChildren(initialStageContents, source, propagator, contents); auto principalChild = previous ? std::make_unique<Stage<T>>(std::move(previous.get())) : std::unique_ptr<Stage<T>>(); @@ -208,12 +207,12 @@ inline auto makeStage( template <typename T> inline std::pair<boost::optional<Stage<T>>, std::function<T(const T&)>> makeTreeWithOffTheEndStage( - std::map<NamespaceString, T>&& initialStageContents, + const std::map<NamespaceString, T>& initialStageContents, const Pipeline& pipeline, const std::function<T(const T&, const std::vector<T>&, const DocumentSource&)>& propagator) { std::pair<boost::optional<Stage<T>>, std::function<T(const T&)>> stageAndReshapeContents; for (const auto& source : pipeline.getSources()) - stageAndReshapeContents = makeStage(std::move(initialStageContents), + stageAndReshapeContents = makeStage(initialStageContents, std::move(stageAndReshapeContents.first), stageAndReshapeContents.second, *source, @@ -269,7 +268,7 @@ inline void walk(Stage<T>* stage, */ template <typename T> inline std::pair<boost::optional<Stage<T>>, T> makeTree( - std::map<NamespaceString, T>&& initialStageContents, + const std::map<NamespaceString, T>& initialStageContents, const Pipeline& pipeline, const std::function<T(const T&, const std::vector<T>&, const DocumentSource&)>& propagator) { // For empty pipelines, there's no Stage<T> to return and the output schema is the same as the @@ -280,7 +279,7 @@ inline std::pair<boost::optional<Stage<T>>, T> makeTree( } auto&& [finalStage, reshaper] = - detail::makeTreeWithOffTheEndStage(std::move(initialStageContents), pipeline, propagator); + detail::makeTreeWithOffTheEndStage(initialStageContents, pipeline, propagator); return std::pair(std::move(*finalStage), reshaper(finalStage.get().contents)); } diff --git a/src/mongo/db/pipeline/semantic_analysis.h b/src/mongo/db/pipeline/semantic_analysis.h index f7c0b3f56b5..1931800b9df 100644 --- a/src/mongo/db/pipeline/semantic_analysis.h +++ b/src/mongo/db/pipeline/semantic_analysis.h @@ -70,8 +70,8 @@ boost::optional<StringMap<std::string>> renamedPaths(const std::set<std::string> * 'end' should be an iterator referring to the past-the-end stage. */ boost::optional<StringMap<std::string>> renamedPaths( - const Pipeline::SourceContainer::const_iterator start, - const Pipeline::SourceContainer::const_iterator end, + Pipeline::SourceContainer::const_iterator start, + Pipeline::SourceContainer::const_iterator end, const std::set<std::string>& pathsOfInterest, boost::optional<std::function<bool(DocumentSource*)>> additionalStageValidatorCallback = boost::none); @@ -87,8 +87,8 @@ boost::optional<StringMap<std::string>> renamedPaths( * (the 'reverse end'). */ boost::optional<StringMap<std::string>> renamedPaths( - const Pipeline::SourceContainer::const_reverse_iterator start, - const Pipeline::SourceContainer::const_reverse_iterator end, + Pipeline::SourceContainer::const_reverse_iterator start, + Pipeline::SourceContainer::const_reverse_iterator end, const std::set<std::string>& pathsOfInterest, boost::optional<std::function<bool(DocumentSource*)>> additionalStageValidatorCallback = boost::none); @@ -102,8 +102,8 @@ boost::optional<StringMap<std::string>> renamedPaths( * fails 'additionalStageValidatorCallback', or returns 'end' if no such stage exists. */ std::pair<Pipeline::SourceContainer::const_iterator, StringMap<std::string>> -findLongestViablePrefixPreservingPaths(const Pipeline::SourceContainer::const_iterator start, - const Pipeline::SourceContainer::const_iterator end, +findLongestViablePrefixPreservingPaths(Pipeline::SourceContainer::const_iterator start, + Pipeline::SourceContainer::const_iterator end, const std::set<std::string>& pathsOfInterest, boost::optional<std::function<bool(DocumentSource*)>> additionalStageValidatorCallback = boost::none); diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.h b/src/mongo/db/pipeline/sharded_agg_helpers.h index 1791411cdb4..45237dad4ce 100644 --- a/src/mongo/db/pipeline/sharded_agg_helpers.h +++ b/src/mongo/db/pipeline/sharded_agg_helpers.h @@ -139,7 +139,7 @@ BSONObj createPassthroughCommandForShard( BSONObj createCommandForTargetedShards(const boost::intrusive_ptr<ExpressionContext>& expCtx, Document serializedCommand, const SplitPipeline& splitPipeline, - const boost::optional<ShardedExchangePolicy> exchangeSpec, + boost::optional<ShardedExchangePolicy> exchangeSpec, bool needsMerge, boost::optional<BSONObj> readConcern = boost::none); diff --git a/src/mongo/db/pipeline/variables.h b/src/mongo/db/pipeline/variables.h index 03407882adf..d7a79c523b9 100644 --- a/src/mongo/db/pipeline/variables.h +++ b/src/mongo/db/pipeline/variables.h @@ -160,8 +160,7 @@ public: /** * Seed let parameters with the given BSONObj. */ - void seedVariablesWithLetParameters(ExpressionContext* const expCtx, - const BSONObj letParameters); + void seedVariablesWithLetParameters(ExpressionContext* expCtx, BSONObj letParameters); bool hasValue(Variables::Id id) const { return _definitions.find(id) != _definitions.end(); diff --git a/src/mongo/db/pipeline/window_function/window_function_covariance.h b/src/mongo/db/pipeline/window_function/window_function_covariance.h index a736be00c9c..a907f791b31 100644 --- a/src/mongo/db/pipeline/window_function/window_function_covariance.h +++ b/src/mongo/db/pipeline/window_function/window_function_covariance.h @@ -40,7 +40,7 @@ class WindowFunctionCovariance : public WindowFunctionState { public: static inline const Value kDefault = Value(BSONNULL); - WindowFunctionCovariance(ExpressionContext* const expCtx, bool isSamp); + WindowFunctionCovariance(ExpressionContext* expCtx, bool isSamp); void add(Value value) override; diff --git a/src/mongo/db/query/expression_index.h b/src/mongo/db/query/expression_index.h index 47b64bc6c7e..a07f1b12f71 100644 --- a/src/mongo/db/query/expression_index.h +++ b/src/mongo/db/query/expression_index.h @@ -66,7 +66,7 @@ public: static std::vector<S2CellId> get2dsphereCovering(const S2Region& region); static void S2CellIdsToIntervals(const std::vector<S2CellId>& intervalSet, - const S2IndexVersion indexVersion, + S2IndexVersion indexVersion, OrderedIntervalList* oilOut); // Creates an ordered interval list from range intervals and diff --git a/src/mongo/db/query/index_bounds.h b/src/mongo/db/query/index_bounds.h index 47b66ffe697..056dbe6e513 100644 --- a/src/mongo/db/query/index_bounds.h +++ b/src/mongo/db/query/index_bounds.h @@ -266,7 +266,7 @@ public: */ static Location findIntervalForField(const BSONElement& elt, const OrderedIntervalList& oil, - const int expectedDirection, + int expectedDirection, size_t* newIntervalIndex); private: diff --git a/src/mongo/db/query/internal_plans.h b/src/mongo/db/query/internal_plans.h index 920f964868b..bc979ac9f34 100644 --- a/src/mongo/db/query/internal_plans.h +++ b/src/mongo/db/query/internal_plans.h @@ -75,7 +75,7 @@ public: OperationContext* opCtx, const CollectionPtr* collection, PlanYieldPolicy::YieldPolicy yieldPolicy, - const Direction direction = FORWARD, + Direction direction = FORWARD, boost::optional<RecordId> resumeAfterRecordId = boost::none, boost::optional<RecordId> minRecord = boost::none, boost::optional<RecordId> maxRecord = boost::none); diff --git a/src/mongo/db/query/query_planner.h b/src/mongo/db/query/query_planner.h index dcd6ca6e542..ea2fabe7edb 100644 --- a/src/mongo/db/query/query_planner.h +++ b/src/mongo/db/query/query_planner.h @@ -119,7 +119,7 @@ public: * the tree (i.e. index numbers in the tags refer to entries in this vector) */ static StatusWith<std::unique_ptr<PlanCacheIndexTree>> cacheDataFromTaggedTree( - const MatchExpression* const taggedTree, const std::vector<IndexEntry>& relevantIndices); + const MatchExpression* taggedTree, const std::vector<IndexEntry>& relevantIndices); /** * @param filter -- an untagged MatchExpression @@ -139,7 +139,7 @@ public: * Does not take ownership of either filter or indexTree. */ static Status tagAccordingToCache(MatchExpression* filter, - const PlanCacheIndexTree* const indexTree, + const PlanCacheIndexTree* indexTree, const std::map<IndexEntry::Identifier, size_t>& indexMap); /** diff --git a/src/mongo/db/query/query_planner_test_lib.h b/src/mongo/db/query/query_planner_test_lib.h index 66c27a2a4ad..e02fbc1e950 100644 --- a/src/mongo/db/query/query_planner_test_lib.h +++ b/src/mongo/db/query/query_planner_test_lib.h @@ -60,7 +60,7 @@ public: * [1, 2) and (3, 4] and the index bounds on field 'b' are [-Infinity, Infinity]. */ static Status boundsMatch(const BSONObj& testBounds, - const IndexBounds trueBounds, + IndexBounds trueBounds, bool relaxBoundsCheck); /** diff --git a/src/mongo/db/query/sbe_stage_builder_helpers.h b/src/mongo/db/query/sbe_stage_builder_helpers.h index f79ff0911c9..431091dd99f 100644 --- a/src/mongo/db/query/sbe_stage_builder_helpers.h +++ b/src/mongo/db/query/sbe_stage_builder_helpers.h @@ -74,8 +74,8 @@ std::unique_ptr<sbe::EExpression> makeIsMember(std::unique_ptr<sbe::EExpression> */ std::unique_ptr<sbe::EExpression> generateNullOrMissing(const sbe::EVariable& var); -std::unique_ptr<sbe::EExpression> generateNullOrMissing(const sbe::FrameId frameId, - const sbe::value::SlotId slotId); +std::unique_ptr<sbe::EExpression> generateNullOrMissing(sbe::FrameId frameId, + sbe::value::SlotId slotId); /** * Generates an EExpression that checks if the input expression is a non-numeric type _assuming 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 4a7cbcb219f..446dd89e03d 100644 --- a/src/mongo/db/repl/check_quorum_for_config_change.h +++ b/src/mongo/db/repl/check_quorum_for_config_change.h @@ -134,7 +134,7 @@ private: */ Status checkQuorumForInitiate(executor::TaskExecutor* executor, const ReplSetConfig& rsConfig, - const int myIndex, + int myIndex, long long term); /** @@ -154,7 +154,7 @@ Status checkQuorumForInitiate(executor::TaskExecutor* executor, */ Status checkQuorumForReconfig(executor::TaskExecutor* executor, const ReplSetConfig& rsConfig, - const int myIndex, + int myIndex, long long term); } // namespace repl diff --git a/src/mongo/db/repl/collection_bulk_loader.h b/src/mongo/db/repl/collection_bulk_loader.h index 7fc018f6a6a..261fc3e9bfd 100644 --- a/src/mongo/db/repl/collection_bulk_loader.h +++ b/src/mongo/db/repl/collection_bulk_loader.h @@ -58,8 +58,8 @@ public: * Inserts the documents into the collection record store, and indexes them with the * MultiIndexBlock on the side. */ - virtual Status insertDocuments(const std::vector<BSONObj>::const_iterator begin, - const std::vector<BSONObj>::const_iterator end) = 0; + virtual Status insertDocuments(std::vector<BSONObj>::const_iterator begin, + std::vector<BSONObj>::const_iterator end) = 0; /** * Called when inserts are done and indexes can be committed. */ diff --git a/src/mongo/db/repl/collection_bulk_loader_impl.h b/src/mongo/db/repl/collection_bulk_loader_impl.h index fab8ed9c922..d7077376478 100644 --- a/src/mongo/db/repl/collection_bulk_loader_impl.h +++ b/src/mongo/db/repl/collection_bulk_loader_impl.h @@ -68,8 +68,8 @@ public: virtual Status init(const std::vector<BSONObj>& secondaryIndexSpecs) override; - virtual Status insertDocuments(const std::vector<BSONObj>::const_iterator begin, - const std::vector<BSONObj>::const_iterator end) override; + virtual Status insertDocuments(std::vector<BSONObj>::const_iterator begin, + std::vector<BSONObj>::const_iterator end) override; virtual Status commit() override; CollectionBulkLoaderImpl::Stats getStats() const; @@ -86,16 +86,16 @@ private: /** * For capped collections, each document will be inserted in its own WriteUnitOfWork. */ - Status _insertDocumentsForCappedCollection(const std::vector<BSONObj>::const_iterator begin, - const std::vector<BSONObj>::const_iterator end); + Status _insertDocumentsForCappedCollection(std::vector<BSONObj>::const_iterator begin, + std::vector<BSONObj>::const_iterator end); /** * For uncapped collections, we will insert documents in batches of size * collectionBulkLoaderBatchSizeInBytes or up to one document size greater. All insertions in a * given batch will be inserted in one WriteUnitOfWork. */ - Status _insertDocumentsForUncappedCollection(const std::vector<BSONObj>::const_iterator begin, - const std::vector<BSONObj>::const_iterator end); + Status _insertDocumentsForUncappedCollection(std::vector<BSONObj>::const_iterator begin, + std::vector<BSONObj>::const_iterator end); /** * Adds document and associated RecordId to index blocks after inserting into RecordStore. diff --git a/src/mongo/db/repl/hello_response.h b/src/mongo/db/repl/hello_response.h index 82fc3c00339..489f97e4d2d 100644 --- a/src/mongo/db/repl/hello_response.h +++ b/src/mongo/db/repl/hello_response.h @@ -234,10 +234,9 @@ public: void setElectionId(const OID& electionId); - void setLastWrite(const OpTime& lastWriteOpTime, const time_t lastWriteDate); + void setLastWrite(const OpTime& lastWriteOpTime, time_t lastWriteDate); - void setLastMajorityWrite(const OpTime& lastMajorityWriteOpTime, - const time_t lastMajorityWriteDate); + void setLastMajorityWrite(const OpTime& lastMajorityWriteOpTime, time_t lastMajorityWriteDate); /** * Marks _configSet as false, which will cause future calls to toBSON/addToBSON to ignore diff --git a/src/mongo/db/repl/isself.h b/src/mongo/db/repl/isself.h index 6358f53037d..84264978720 100644 --- a/src/mongo/db/repl/isself.h +++ b/src/mongo/db/repl/isself.h @@ -59,7 +59,7 @@ bool isSelf(const HostAndPort& hostAndPort, ServiceContext* ctx); * Note: this only works on Linux and Windows. All calls should be properly ifdef'd, * otherwise an invariant will be triggered. */ -std::vector<std::string> getBoundAddrs(const bool ipv6enabled); +std::vector<std::string> getBoundAddrs(bool ipv6enabled); } // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h index e975ee42095..c3c9c2de13a 100644 --- a/src/mongo/db/repl/oplog.h +++ b/src/mongo/db/repl/oplog.h @@ -215,7 +215,7 @@ Status applyOperation_inlock(OperationContext* opCtx, const OplogEntryOrGroupedInserts& opOrGroupedInserts, bool alwaysUpsert, OplogApplication::Mode mode, - const bool isDataConsistent, + bool isDataConsistent, IncrementOpsAppliedStatsFn incrementOpsAppliedStats = {}); /** diff --git a/src/mongo/db/repl/oplog_applier_impl.h b/src/mongo/db/repl/oplog_applier_impl.h index 574965802fc..b93756d9456 100644 --- a/src/mongo/db/repl/oplog_applier_impl.h +++ b/src/mongo/db/repl/oplog_applier_impl.h @@ -141,7 +141,7 @@ protected: virtual Status applyOplogBatchPerWorker(OperationContext* opCtx, std::vector<const OplogEntry*>* ops, WorkerMultikeyPathInfo* workerMultikeyPathInfo, - const bool isDataConsistent); + bool isDataConsistent); }; /** @@ -150,7 +150,7 @@ protected: Status applyOplogEntryOrGroupedInserts(OperationContext* opCtx, const OplogEntryOrGroupedInserts& entryOrGroupedInserts, OplogApplication::Mode oplogApplicationMode, - const bool isDataConsistent); + bool isDataConsistent); } // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/oplog_applier_impl_test_fixture.h b/src/mongo/db/repl/oplog_applier_impl_test_fixture.h index 9e142904876..7cc2cc81e1d 100644 --- a/src/mongo/db/repl/oplog_applier_impl_test_fixture.h +++ b/src/mongo/db/repl/oplog_applier_impl_test_fixture.h @@ -308,7 +308,7 @@ bool collectionExists(OperationContext* opCtx, const NamespaceString& nss); */ void createIndex(OperationContext* opCtx, const NamespaceString& nss, - const UUID collUUID, + UUID collUUID, const BSONObj& spec); } // namespace repl diff --git a/src/mongo/db/repl/oplog_entry.h b/src/mongo/db/repl/oplog_entry.h index 7c39c7618c2..021261c64d6 100644 --- a/src/mongo/db/repl/oplog_entry.h +++ b/src/mongo/db/repl/oplog_entry.h @@ -93,7 +93,7 @@ public: static ReplOperation makeInsertOperation(const NamespaceString& nss, UUID uuid, const BSONObj& docToInsert); - static ReplOperation makeUpdateOperation(const NamespaceString nss, + static ReplOperation makeUpdateOperation(NamespaceString nss, UUID uuid, const BSONObj& update, const BSONObj& criteria); @@ -101,11 +101,11 @@ public: UUID uuid, const BSONObj& docToDelete); - static ReplOperation makeCreateCommand(const NamespaceString nss, + static ReplOperation makeCreateCommand(NamespaceString nss, const mongo::CollectionOptions& options, const BSONObj& idIndex); - static ReplOperation makeCreateIndexesCommand(const NamespaceString nss, + static ReplOperation makeCreateIndexesCommand(NamespaceString nss, CollectionUUID uuid, const BSONObj& indexDoc); @@ -305,7 +305,7 @@ public: static StatusWith<DurableOplogEntry> parse(const BSONObj& object); DurableOplogEntry(OpTime opTime, - const boost::optional<int64_t> hash, + boost::optional<int64_t> hash, OpTypeEnum opType, const NamespaceString& nss, const boost::optional<UUID>& uuid, diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h index 808495d9623..9e2c5a2f71a 100644 --- a/src/mongo/db/repl/oplog_fetcher.h +++ b/src/mongo/db/repl/oplog_fetcher.h @@ -434,8 +434,7 @@ private: * This will be called when we check the first batch of results and our last fetched optime does * not equal the first document in that batch. This function should never return Status::OK(). */ - Status _checkTooStaleToSyncFromSource(const OpTime lastFetched, - const OpTime firstOpTimeInDocument); + Status _checkTooStaleToSyncFromSource(OpTime lastFetched, OpTime firstOpTimeInDocument); // Protects member data of this OplogFetcher. mutable Mutex _mutex = MONGO_MAKE_LATCH("OplogFetcher::_mutex"); diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h index fcb9d2a44d0..ff5c96ba861 100644 --- a/src/mongo/db/repl/replication_coordinator.h +++ b/src/mongo/db/repl/replication_coordinator.h @@ -1065,9 +1065,9 @@ public: * internal operations occurs (i.e. step up, step down, or rollback). Also logs the metrics. */ virtual void updateAndLogStateTransitionMetrics( - const ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, - const size_t numOpsKilled, - const size_t numOpsRunning) const = 0; + ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, + size_t numOpsKilled, + size_t numOpsRunning) const = 0; /** * Increment the server TopologyVersion and fulfill the promise of any currently waiting diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index 5c7ec29b3dd..a017021ba03 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -380,9 +380,9 @@ public: virtual void finishRecoveryIfEligible(OperationContext* opCtx) override; virtual void updateAndLogStateTransitionMetrics( - const ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, - const size_t numOpsKilled, - const size_t numOpsRunning) const override; + ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, + size_t numOpsKilled, + size_t numOpsRunning) const override; virtual TopologyVersion getTopologyVersion() const override; @@ -1265,7 +1265,7 @@ private: */ std::shared_ptr<HelloResponse> _makeHelloResponse(boost::optional<StringData> horizonString, WithLock, - const bool hasValidConfig) const; + bool hasValidConfig) const; /** * Creates a semi-future for HelloResponse. horizonString should be passed in if and only if diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h index 74cf6bad540..7d6afaddb35 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.h +++ b/src/mongo/db/repl/replication_coordinator_mock.h @@ -360,9 +360,9 @@ public: virtual void finishRecoveryIfEligible(OperationContext* opCtx) override; virtual void updateAndLogStateTransitionMetrics( - const ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, - const size_t numOpsKilled, - const size_t numOpsRunning) const override; + ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, + size_t numOpsKilled, + size_t numOpsRunning) const override; virtual void setCanAcceptNonLocalWrites(bool canAcceptNonLocalWrites); diff --git a/src/mongo/db/repl/replication_coordinator_noop.h b/src/mongo/db/repl/replication_coordinator_noop.h index 85ca9de0a2a..33f51c6094a 100644 --- a/src/mongo/db/repl/replication_coordinator_noop.h +++ b/src/mongo/db/repl/replication_coordinator_noop.h @@ -297,9 +297,9 @@ public: void incrementTopologyVersion() final; void updateAndLogStateTransitionMetrics( - const ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, - const size_t numOpsKilled, - const size_t numOpsRunning) const final; + ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, + size_t numOpsKilled, + size_t numOpsRunning) const final; TopologyVersion getTopologyVersion() const final; diff --git a/src/mongo/db/repl/replication_metrics.h b/src/mongo/db/repl/replication_metrics.h index 108510bbcd8..6eef7fc5268 100644 --- a/src/mongo/db/repl/replication_metrics.h +++ b/src/mongo/db/repl/replication_metrics.h @@ -81,15 +81,15 @@ public: // All the election candidate metrics that should be set when a node calls an election are set // in this one function, so that the 'electionCandidateMetrics' section of replSetStatus shows a // consistent state. - void setElectionCandidateMetrics(const StartElectionReasonEnum reason, - const Date_t lastElectionDate, - const long long electionTerm, - const OpTime lastCommittedOpTime, - const OpTime lastSeenOpTime, - const int numVotesNeeded, - const double priorityAtElection, - const Milliseconds electionTimeoutMillis, - const boost::optional<int> priorPrimary); + void setElectionCandidateMetrics(StartElectionReasonEnum reason, + Date_t lastElectionDate, + long long electionTerm, + OpTime lastCommittedOpTime, + OpTime lastSeenOpTime, + int numVotesNeeded, + double priorityAtElection, + Milliseconds electionTimeoutMillis, + boost::optional<int> priorPrimary); void setTargetCatchupOpTime(OpTime opTime); void setNumCatchUpOps(long numCatchUpOps); void setCandidateNewTermStartDate(Date_t newTermStartDate); @@ -106,14 +106,14 @@ public: // All the election participant metrics that should be set when a node votes in an election are // set in this one function, so that the 'electionParticipantMetrics' section of replSetStatus // shows a consistent state. - void setElectionParticipantMetrics(const bool votedForCandidate, - const long long electionTerm, - const Date_t lastVoteDate, - const int electionCandidateMemberId, - const std::string voteReason, - const OpTime lastAppliedOpTime, - const OpTime maxAppliedOpTimeInSet, - const double priorityAtElection); + void setElectionParticipantMetrics(bool votedForCandidate, + long long electionTerm, + Date_t lastVoteDate, + int electionCandidateMemberId, + std::string voteReason, + OpTime lastAppliedOpTime, + OpTime maxAppliedOpTimeInSet, + double priorityAtElection); BSONObj getElectionParticipantMetricsBSON(); void setParticipantNewTermDates(Date_t newTermStartDate, Date_t newTermAppliedDate); diff --git a/src/mongo/db/repl/scatter_gather_runner.h b/src/mongo/db/repl/scatter_gather_runner.h index 90f20bc20b5..610d21a675d 100644 --- a/src/mongo/db/repl/scatter_gather_runner.h +++ b/src/mongo/db/repl/scatter_gather_runner.h @@ -109,7 +109,7 @@ private: * The returned event will eventually be signaled. */ StatusWith<executor::TaskExecutor::EventHandle> start( - const executor::TaskExecutor::RemoteCommandCallbackFn cb); + executor::TaskExecutor::RemoteCommandCallbackFn cb); /** * Informs the runner to cancel further processing. diff --git a/src/mongo/db/repl/storage_interface.h b/src/mongo/db/repl/storage_interface.h index a4e5442c0b2..027b14af6df 100644 --- a/src/mongo/db/repl/storage_interface.h +++ b/src/mongo/db/repl/storage_interface.h @@ -117,7 +117,7 @@ public: virtual StatusWith<std::unique_ptr<CollectionBulkLoader>> createCollectionForBulkLoading( const NamespaceString& nss, const CollectionOptions& options, - const BSONObj idIndexSpec, + BSONObj idIndexSpec, const std::vector<BSONObj>& secondaryIndexSpecs) = 0; /** @@ -170,7 +170,7 @@ public: virtual Status createCollection(OperationContext* opCtx, const NamespaceString& nss, const CollectionOptions& options, - const bool createIdIndex = true, + bool createIdIndex = true, const BSONObj& idIndexSpec = BSONObj()) = 0; /** diff --git a/src/mongo/db/repl/storage_interface_impl.h b/src/mongo/db/repl/storage_interface_impl.h index 5c935d1bbc5..f99b3a0c094 100644 --- a/src/mongo/db/repl/storage_interface_impl.h +++ b/src/mongo/db/repl/storage_interface_impl.h @@ -62,7 +62,7 @@ public: StatusWith<std::unique_ptr<CollectionBulkLoader>> createCollectionForBulkLoading( const NamespaceString& nss, const CollectionOptions& options, - const BSONObj idIndexSpec, + BSONObj idIndexSpec, const std::vector<BSONObj>& secondaryIndexSpecs) override; Status insertDocument(OperationContext* opCtx, @@ -82,7 +82,7 @@ public: Status createCollection(OperationContext* opCtx, const NamespaceString& nss, const CollectionOptions& options, - const bool createIdIndex = true, + bool createIdIndex = true, const BSONObj& idIndexSpec = BSONObj()) override; Status createIndexesOnEmptyCollection(OperationContext* opCtx, diff --git a/src/mongo/db/repl/storage_interface_mock.h b/src/mongo/db/repl/storage_interface_mock.h index 0b35fe833e3..03416512bb9 100644 --- a/src/mongo/db/repl/storage_interface_mock.h +++ b/src/mongo/db/repl/storage_interface_mock.h @@ -64,8 +64,8 @@ public: virtual ~CollectionBulkLoaderMock() = default; Status init(const std::vector<BSONObj>& secondaryIndexSpecs) override; - Status insertDocuments(const std::vector<BSONObj>::const_iterator begin, - const std::vector<BSONObj>::const_iterator end) override; + Status insertDocuments(std::vector<BSONObj>::const_iterator begin, + std::vector<BSONObj>::const_iterator end) override; Status commit() override; std::string toString() const override { diff --git a/src/mongo/db/repl/tenant_migration_access_blocker_util.h b/src/mongo/db/repl/tenant_migration_access_blocker_util.h index 8c4f66a4837..f5d9a36b89e 100644 --- a/src/mongo/db/repl/tenant_migration_access_blocker_util.h +++ b/src/mongo/db/repl/tenant_migration_access_blocker_util.h @@ -41,10 +41,10 @@ namespace mongo { namespace tenant_migration_access_blocker { std::shared_ptr<TenantMigrationDonorAccessBlocker> getTenantMigrationDonorAccessBlocker( - ServiceContext* const serviceContext, StringData tenantId); + ServiceContext* serviceContext, StringData tenantId); std::shared_ptr<TenantMigrationRecipientAccessBlocker> getTenantMigrationRecipientAccessBlocker( - ServiceContext* const serviceContext, StringData tenantId); + ServiceContext* serviceContext, StringData tenantId); /** * Returns a TenantMigrationDonorDocument constructed from the given bson doc and validate the diff --git a/src/mongo/db/repl/tenant_migration_donor_service.h b/src/mongo/db/repl/tenant_migration_donor_service.h index 799f02af7f8..eb61d5ade1b 100644 --- a/src/mongo/db/repl/tenant_migration_donor_service.h +++ b/src/mongo/db/repl/tenant_migration_donor_service.h @@ -80,7 +80,7 @@ public: boost::optional<Status> abortReason; }; - explicit Instance(ServiceContext* const serviceContext, + explicit Instance(ServiceContext* serviceContext, const TenantMigrationDonorService* donorService, const BSONObj& initialState); @@ -208,7 +208,7 @@ public: */ ExecutorFuture<repl::OpTime> _updateStateDoc( std::shared_ptr<executor::ScopedTaskExecutor> executor, - const TenantMigrationDonorStateEnum nextState, + TenantMigrationDonorStateEnum nextState, const CancellationToken& token); /** diff --git a/src/mongo/db/repl/tenant_migration_recipient_service.h b/src/mongo/db/repl/tenant_migration_recipient_service.h index 5c9f375b59f..3ada46582fb 100644 --- a/src/mongo/db/repl/tenant_migration_recipient_service.h +++ b/src/mongo/db/repl/tenant_migration_recipient_service.h @@ -64,7 +64,7 @@ public: "TenantMigrationRecipientService"_sd; static constexpr StringData kNoopMsg = "Resume token noop"_sd; - explicit TenantMigrationRecipientService(ServiceContext* const serviceContext); + explicit TenantMigrationRecipientService(ServiceContext* serviceContext); ~TenantMigrationRecipientService() = default; StringData getServiceName() const final; @@ -82,7 +82,7 @@ public: class Instance final : public PrimaryOnlyService::TypedInstance<Instance> { public: - explicit Instance(ServiceContext* const serviceContext, + explicit Instance(ServiceContext* serviceContext, const TenantMigrationRecipientService* recipientService, BSONObj stateDoc); @@ -419,8 +419,8 @@ public: * should resume from. The oplog applier should resume applying entries that have a greater * optime than the returned value. */ - OpTime _getOplogResumeApplyingDonorOptime(const OpTime startApplyingDonorOpTime, - const OpTime cloneFinishedRecipientOpTime) const; + OpTime _getOplogResumeApplyingDonorOptime(OpTime startApplyingDonorOpTime, + OpTime cloneFinishedRecipientOpTime) const; /* * Starts the tenant cloner. diff --git a/src/mongo/db/repl/tenant_oplog_applier.h b/src/mongo/db/repl/tenant_oplog_applier.h index 9953150b657..58c4533b0d6 100644 --- a/src/mongo/db/repl/tenant_oplog_applier.h +++ b/src/mongo/db/repl/tenant_oplog_applier.h @@ -134,7 +134,7 @@ private: Status _applyOplogEntryOrGroupedInserts(OperationContext* opCtx, const OplogEntryOrGroupedInserts& entryOrGroupedInserts, OplogApplication::Mode oplogApplicationMode, - const bool isDataConsistent); + bool isDataConsistent); std::vector<std::vector<const OplogEntry*>> _fillWriterVectors(OperationContext* opCtx, TenantOplogBatch* batch); diff --git a/src/mongo/db/repl/tenant_oplog_batcher.h b/src/mongo/db/repl/tenant_oplog_batcher.h index 7349969aa7c..a2c266061c5 100644 --- a/src/mongo/db/repl/tenant_oplog_batcher.h +++ b/src/mongo/db/repl/tenant_oplog_batcher.h @@ -76,7 +76,7 @@ public: TenantOplogBatcher(const std::string& tenantId, RandomAccessOplogBuffer* oplogBuffer, std::shared_ptr<executor::TaskExecutor> executor, - const Timestamp resumeBatchingTs); + Timestamp resumeBatchingTs); virtual ~TenantOplogBatcher(); diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h index 91ee17012c2..3f61c836c56 100644 --- a/src/mongo/db/repl/topology_coordinator.h +++ b/src/mongo/db/repl/topology_coordinator.h @@ -279,7 +279,7 @@ public: const MemberState& memberState, const OpTime& previousOpTimeFetched, Date_t now, - const ReadPreference readPreference); + ReadPreference readPreference); /** * Sets the reported mode of this node to one of RS_SECONDARY, RS_STARTUP2, RS_ROLLBACK or @@ -512,7 +512,7 @@ public: * Marks a member as down from our perspective and returns a bool which indicates if we can no * longer see a majority of the nodes and thus should step down. */ - bool setMemberAsDown(Date_t now, const int memberIndex); + bool setMemberAsDown(Date_t now, int memberIndex); /** * Goes through the memberData and determines which member that is currently live @@ -703,7 +703,7 @@ public: /** * Set the outgoing heartbeat message from self */ - void setMyHeartbeatMessage(const Date_t now, const std::string& s); + void setMyHeartbeatMessage(Date_t now, const std::string& s); /** * Prepares a ReplSetMetadata object describing the current term, primary, and lastOp @@ -743,7 +743,7 @@ public: /** * Transitions to the candidate role if the node is electable. */ - Status becomeCandidateIfElectable(const Date_t now, StartElectionReasonEnum reason); + Status becomeCandidateIfElectable(Date_t now, StartElectionReasonEnum reason); /** * Updates the storage engine read committed support in the TopologyCoordinator options after @@ -754,7 +754,7 @@ public: /** * Reset the booleans to record the last heartbeat restart for the target node. */ - void restartHeartbeat(const Date_t now, const HostAndPort& target); + void restartHeartbeat(Date_t now, const HostAndPort& target); /** * Increments the counter field of the current TopologyVersion. @@ -828,7 +828,7 @@ public: /** * Records the ping for the given host. For use only in testing. */ - void setPing_forTest(const HostAndPort& host, const Milliseconds ping); + void setPing_forTest(const HostAndPort& host, Milliseconds ping); // Returns _electionTime. Only used in unittests. Timestamp getElectionTime() const; @@ -946,7 +946,7 @@ private: // Checks if the node can see a healthy primary of equal or greater priority to the // candidate. If so, returns the index of that node. Otherwise returns -1. - int _findHealthyPrimaryOfEqualOrGreaterPriority(const int candidateIndex) const; + int _findHealthyPrimaryOfEqualOrGreaterPriority(int candidateIndex) const; // Is our optime close enough to the latest known optime to call for a priority takeover. bool _amIFreshEnoughForPriorityTakeover() const; @@ -956,8 +956,7 @@ private: bool _amIFreshEnoughForCatchupTakeover() const; // Returns reason why "self" member is unelectable - UnelectableReasonMask _getMyUnelectableReason(const Date_t now, - StartElectionReasonEnum reason) const; + UnelectableReasonMask _getMyUnelectableReason(Date_t now, StartElectionReasonEnum reason) const; // Returns reason why memberIndex is unelectable UnelectableReasonMask _getUnelectableReason(int memberIndex) const; @@ -984,7 +983,7 @@ private: * Returns information we have on the state of the node identified by memberId. Returns * nullptr if memberId is not found in the configuration. */ - MemberData* _findMemberDataByMemberId(const int memberId); + MemberData* _findMemberDataByMemberId(int memberId); /** * Performs updating "_currentPrimaryIndex" for processHeartbeatResponse(). diff --git a/src/mongo/db/repl/transaction_oplog_application.h b/src/mongo/db/repl/transaction_oplog_application.h index 6b108447b00..57f554acafe 100644 --- a/src/mongo/db/repl/transaction_oplog_application.h +++ b/src/mongo/db/repl/transaction_oplog_application.h @@ -79,7 +79,7 @@ std::pair<std::vector<repl::OplogEntry>, bool> _readTransactionOperationsFromOpl OperationContext* opCtx, const repl::OplogEntry& lastEntryInTxn, const std::vector<repl::OplogEntry*>& cachedOps, - const bool checkForCommands) noexcept; + bool checkForCommands) noexcept; /** * Apply `prepareTransaction` oplog entry. diff --git a/src/mongo/db/s/balancer/migration_test_fixture.h b/src/mongo/db/s/balancer/migration_test_fixture.h index a0cd6397bb9..12de7c22f1c 100644 --- a/src/mongo/db/s/balancer/migration_test_fixture.h +++ b/src/mongo/db/s/balancer/migration_test_fixture.h @@ -67,7 +67,7 @@ protected: * Inserts a document into the config.databases collection to indicate that "dbName" is sharded * with primary "primaryShard". */ - void setUpDatabase(const std::string& dbName, const ShardId primaryShard); + void setUpDatabase(const std::string& dbName, ShardId primaryShard); /** * Inserts a document into the config.collections collection to indicate that "collName" is 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 ace9ed3bcaf..91037615543 100644 --- a/src/mongo/db/s/config/config_server_test_fixture.h +++ b/src/mongo/db/s/config/config_server_test_fixture.h @@ -70,7 +70,7 @@ protected: const NamespaceString& ns, const BSONObj& query, const BSONObj& update, - const bool upsert); + bool upsert); /** * Deletes a document to this config server to the specified namespace. @@ -78,7 +78,7 @@ protected: Status deleteToConfigCollection(OperationContext* opCtx, const NamespaceString& ns, const BSONObj& doc, - const bool multi); + bool multi); /** * Reads a single document from a collection living on the config server. @@ -136,7 +136,7 @@ protected: /** * Inserts a document for the database into the config.databases collection. */ - void setupDatabase(const std::string& dbName, const ShardId primaryShard, const bool sharded); + void setupDatabase(const std::string& dbName, ShardId primaryShard, bool sharded); /** * Returns the indexes definitions defined on a given collection. diff --git a/src/mongo/db/s/config/initial_split_policy.h b/src/mongo/db/s/config/initial_split_policy.h index faf008a7f15..f138956a6b8 100644 --- a/src/mongo/db/s/config/initial_split_policy.h +++ b/src/mongo/db/s/config/initial_split_policy.h @@ -61,8 +61,8 @@ public: static std::unique_ptr<InitialSplitPolicy> calculateOptimizationStrategy( OperationContext* opCtx, const ShardKeyPattern& shardKeyPattern, - const std::int64_t numInitialChunks, - const bool presplitHashedZones, + std::int64_t numInitialChunks, + bool presplitHashedZones, const boost::optional<std::vector<BSONObj>>& initialSplitPoints, const std::vector<TagsType>& tags, size_t numShards, diff --git a/src/mongo/db/s/config/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h index d897868740d..f357d88d8d8 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager.h +++ b/src/mongo/db/s/config/sharding_catalog_manager.h @@ -376,7 +376,7 @@ public: void updateShardingCatalogEntryForCollectionInTxn(OperationContext* opCtx, const NamespaceString& nss, const CollectionType& coll, - const bool upsert, + bool upsert, TxnNumber txnNumber); @@ -406,7 +406,7 @@ public: StatusWith<std::string> addShard(OperationContext* opCtx, const std::string* shardProposedName, const ConnectionString& shardConnectionString, - const long long maxSize); + long long maxSize); /** * Tries to remove a shard. To completely remove a shard from a sharded cluster, diff --git a/src/mongo/db/s/database_sharding_state.h b/src/mongo/db/s/database_sharding_state.h index 7fafc0fc495..fc752a05966 100644 --- a/src/mongo/db/s/database_sharding_state.h +++ b/src/mongo/db/s/database_sharding_state.h @@ -53,7 +53,7 @@ public: */ using DSSLock = ShardingStateLock<DatabaseShardingState>; - DatabaseShardingState(const StringData dbName); + DatabaseShardingState(StringData dbName); ~DatabaseShardingState() = default; /** @@ -63,15 +63,15 @@ public: * Must be called with some lock held on the database being looked up and the returned * pointer must not be stored. */ - static DatabaseShardingState* get(OperationContext* opCtx, const StringData dbName); + static DatabaseShardingState* get(OperationContext* opCtx, StringData dbName); /** * Obtain a pointer to the DatabaseShardingState that remains safe to access without holding * a database lock. Should be called instead of the regular get() if no database lock is held. * The returned DatabaseShardingState instance should not be modified! */ - static std::shared_ptr<DatabaseShardingState> getSharedForLockFreeReads( - OperationContext* opCtx, const StringData dbName); + static std::shared_ptr<DatabaseShardingState> getSharedForLockFreeReads(OperationContext* opCtx, + StringData dbName); /** * Checks if this shard is the primary shard for the given DB. diff --git a/src/mongo/db/s/dist_lock_manager_replset.h b/src/mongo/db/s/dist_lock_manager_replset.h index 564eac82fae..830d80c889c 100644 --- a/src/mongo/db/s/dist_lock_manager_replset.h +++ b/src/mongo/db/s/dist_lock_manager_replset.h @@ -103,7 +103,7 @@ private: * the lock expiration threshold. */ StatusWith<bool> isLockExpired(OperationContext* opCtx, - const LocksType lockDoc, + LocksType lockDoc, const Milliseconds& lockExpiration); long long _waitForRecovery(OperationContext* opCtx); diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.h b/src/mongo/db/s/migration_chunk_cloner_source_legacy.h index 016ad590e58..0beed19779a 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.h +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.h @@ -264,7 +264,7 @@ private: * corresponding operation track request from the operation track requests queue. */ void _addToTransferModsQueue(const BSONObj& idObj, - const char op, + char op, const repl::OpTime& opTime, const repl::OpTime& prePostImageOpTime); diff --git a/src/mongo/db/s/op_observer_sharding_impl.h b/src/mongo/db/s/op_observer_sharding_impl.h index 95c7d609c2e..0fafcf833ff 100644 --- a/src/mongo/db/s/op_observer_sharding_impl.h +++ b/src/mongo/db/s/op_observer_sharding_impl.h @@ -47,34 +47,34 @@ protected: NamespaceString const& nss, BSONObj const& docToDelete) override; void shardObserveInsertOp(OperationContext* opCtx, - const NamespaceString nss, + NamespaceString nss, const BSONObj& insertedDoc, const repl::OpTime& opTime, CollectionShardingState* css, - const bool fromMigrate, - const bool inMultiDocumentTransaction) override; + bool fromMigrate, + bool inMultiDocumentTransaction) override; void shardObserveUpdateOp(OperationContext* opCtx, - const NamespaceString nss, + NamespaceString nss, boost::optional<BSONObj> preImageDoc, const BSONObj& updatedDoc, const repl::OpTime& opTime, CollectionShardingState* css, const repl::OpTime& prePostImageOpTime, - const bool inMultiDocumentTransaction) override; + bool inMultiDocumentTransaction) override; void shardObserveDeleteOp(OperationContext* opCtx, - const NamespaceString nss, + NamespaceString nss, const BSONObj& documentKey, const repl::OpTime& opTime, CollectionShardingState* css, const repl::OpTime& preImageOpTime, - const bool inMultiDocumentTransaction) override; + bool inMultiDocumentTransaction) override; void shardObserveTransactionPrepareOrUnpreparedCommit( OperationContext* opCtx, const std::vector<repl::ReplOperation>& stmts, const repl::OpTime& prepareOrCommitOptime) override; void shardAnnotateOplogEntry(OperationContext* opCtx, - const NamespaceString nss, + NamespaceString nss, const BSONObj& doc, repl::DurableReplOperation& op, CollectionShardingState* css, diff --git a/src/mongo/db/s/operation_sharding_state.h b/src/mongo/db/s/operation_sharding_state.h index c77b11ead07..a8b31541cab 100644 --- a/src/mongo/db/s/operation_sharding_state.h +++ b/src/mongo/db/s/operation_sharding_state.h @@ -132,7 +132,7 @@ public: * If 'db' matches the 'db' in the namespace the client sent versions for, returns the database * version sent by the client (if any), else returns boost::none. */ - boost::optional<DatabaseVersion> getDbVersion(const StringData dbName) const; + boost::optional<DatabaseVersion> getDbVersion(StringData dbName) const; /** * This call is a no op if there isn't a currently active migration critical section. Otherwise 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 2917666feed..abf1207e8bd 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 @@ -50,7 +50,7 @@ public: const boost::intrusive_ptr<ExpressionContext>&); static boost::intrusive_ptr<DocumentSourceReshardingIterateTransaction> createFromBson( - const BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); + BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx); DepsTracker::State getDependencies(DepsTracker* deps) const final; diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher.h b/src/mongo/db/s/resharding/resharding_oplog_fetcher.h index 16bce5ac1f2..bf75536d4ae 100644 --- a/src/mongo/db/s/resharding/resharding_oplog_fetcher.h +++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher.h @@ -139,7 +139,7 @@ private: */ void _ensureCollection(Client* client, CancelableOperationContextFactory factory, - const NamespaceString nss); + NamespaceString nss); AggregateCommandRequest _makeAggregateCommandRequest(Client* client, CancelableOperationContextFactory factory); ExecutorFuture<void> _reschedule(std::shared_ptr<executor::TaskExecutor> executor, diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.h b/src/mongo/db/s/shard_filtering_metadata_refresh.h index 8ebec832d75..1c48039c482 100644 --- a/src/mongo/db/s/shard_filtering_metadata_refresh.h +++ b/src/mongo/db/s/shard_filtering_metadata_refresh.h @@ -68,7 +68,7 @@ void onShardVersionMismatch(OperationContext* opCtx, * recover any ongoing migrations if runRecover is true. */ SharedSemiFuture<void> recoverRefreshShardVersion(ServiceContext* serviceContext, - const NamespaceString nss, + NamespaceString nss, bool runRecover); /** @@ -97,11 +97,11 @@ ChunkVersion forceShardFilteringMetadataRefresh(OperationContext* opCtx, */ Status onDbVersionMismatchNoExcept( OperationContext* opCtx, - const StringData dbName, + StringData dbName, const DatabaseVersion& clientDbVersion, const boost::optional<DatabaseVersion>& serverDbVersion) noexcept; -void forceDatabaseRefresh(OperationContext* opCtx, const StringData dbName); +void forceDatabaseRefresh(OperationContext* opCtx, StringData dbName); /** * RAII-style class that enters the migration critical section and refresh the filtering diff --git a/src/mongo/db/s/shard_metadata_util.h b/src/mongo/db/s/shard_metadata_util.h index 9a6170c4de7..2e31f972a77 100644 --- a/src/mongo/db/s/shard_metadata_util.h +++ b/src/mongo/db/s/shard_metadata_util.h @@ -142,7 +142,7 @@ StatusWith<ShardDatabaseType> readShardDatabasesEntry(OperationContext* opCtx, S Status updateShardCollectionsEntry(OperationContext* opCtx, const BSONObj& query, const BSONObj& update, - const bool upsert); + bool upsert); /** * Updates the databases collection entry matching 'query' with 'update' using local write @@ -158,7 +158,7 @@ Status updateShardDatabasesEntry(OperationContext* opCtx, const BSONObj& query, const BSONObj& update, const BSONObj& inc, - const bool upsert); + bool upsert); /** * Reads the shard server's chunks collection corresponding to 'nss' or 'uuid' for chunks matching 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 e9d643d1c9e..5d673ec6855 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.h +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.h @@ -242,7 +242,7 @@ private: * Iterates over the task list to retrieve the enqueued metadata. Only retrieves collects * data from tasks that have terms matching the specified 'term'. */ - EnqueuedMetadataResults getEnqueuedMetadataForTerm(const long long term) const; + EnqueuedMetadataResults getEnqueuedMetadataForTerm(long long term) const; private: @@ -429,9 +429,7 @@ private: * Only run on the shard primary. */ std::pair<bool, EnqueuedMetadataResults> _getEnqueuedMetadata( - const NamespaceString& nss, - const ChunkVersion& catalogCacheSinceVersion, - const long long term); + const NamespaceString& nss, const ChunkVersion& catalogCacheSinceVersion, long long term); /** * First ensures that this server is a majority primary in the case of a replica set with two diff --git a/src/mongo/db/s/sharding_ddl_util.h b/src/mongo/db/s/sharding_ddl_util.h index 0cdee451176..5a34e125924 100644 --- a/src/mongo/db/s/sharding_ddl_util.h +++ b/src/mongo/db/s/sharding_ddl_util.h @@ -108,7 +108,7 @@ void shardedRenameMetadata(OperationContext* opCtx, */ void checkShardedRenamePreconditions(OperationContext* opCtx, const NamespaceString& toNss, - const bool dropTarget); + bool dropTarget); /** * Throws if the DB primary shards of the provided namespaces differs. diff --git a/src/mongo/db/s/sharding_logging.h b/src/mongo/db/s/sharding_logging.h index 4e6f2890886..724a87910b5 100644 --- a/src/mongo/db/s/sharding_logging.h +++ b/src/mongo/db/s/sharding_logging.h @@ -50,14 +50,14 @@ public: static ShardingLogging* get(OperationContext* operationContext); Status logAction(OperationContext* opCtx, - const StringData what, - const StringData ns, + StringData what, + StringData ns, const BSONObj& detail); Status logChangeChecked( OperationContext* opCtx, - const StringData what, - const StringData ns, + StringData what, + StringData ns, const BSONObj& detail = BSONObj(), const WriteConcernOptions& writeConcern = ShardingCatalogClient::kMajorityWriteConcern); @@ -94,9 +94,9 @@ private: * @param writeConcern Write concern options to use for logging */ Status _log(OperationContext* opCtx, - const StringData logCollName, - const StringData what, - const StringData operationNSS, + StringData logCollName, + StringData what, + StringData operationNSS, const BSONObj& detail, const WriteConcernOptions& writeConcern); diff --git a/src/mongo/db/s/transaction_coordinator_worker_curop_repository.h b/src/mongo/db/s/transaction_coordinator_worker_curop_repository.h index 17987137c91..6d494c5f841 100644 --- a/src/mongo/db/s/transaction_coordinator_worker_curop_repository.h +++ b/src/mongo/db/s/transaction_coordinator_worker_curop_repository.h @@ -54,8 +54,8 @@ public: */ virtual void set(OperationContext* opCtx, const LogicalSessionId& lsid, - const TxnNumber txnNumber, - const CoordinatorAction action) = 0; + TxnNumber txnNumber, + CoordinatorAction action) = 0; /** * Output the state into BSON previously associated with this OperationContext instance. diff --git a/src/mongo/db/s/type_lockpings.h b/src/mongo/db/s/type_lockpings.h index 349324d9bd3..e834e3ae32f 100644 --- a/src/mongo/db/s/type_lockpings.h +++ b/src/mongo/db/s/type_lockpings.h @@ -82,7 +82,7 @@ public: const Date_t getPing() const { return _ping.get(); } - void setPing(const Date_t ping); + void setPing(Date_t ping); private: // Convention: (M)andatory, (O)ptional, (S)pecial rule. diff --git a/src/mongo/db/s/type_locks.h b/src/mongo/db/s/type_locks.h index c404aabd43b..6ee4a7a7682 100644 --- a/src/mongo/db/s/type_locks.h +++ b/src/mongo/db/s/type_locks.h @@ -95,7 +95,7 @@ public: State getState() const { return _state.get(); } - void setState(const State state); + void setState(State state); const std::string& getProcess() const { return _process.get(); diff --git a/src/mongo/db/s/type_shard_database.h b/src/mongo/db/s/type_shard_database.h index 44e1afb6944..7b4c2579540 100644 --- a/src/mongo/db/s/type_shard_database.h +++ b/src/mongo/db/s/type_shard_database.h @@ -69,9 +69,9 @@ public: static const BSONField<bool> partitioned; static const BSONField<int> enterCriticalSectionCounter; - ShardDatabaseType(const std::string dbName, + ShardDatabaseType(std::string dbName, DatabaseVersion version, - const ShardId primary, + ShardId primary, bool partitioned); /** diff --git a/src/mongo/db/stats/api_version_metrics.h b/src/mongo/db/stats/api_version_metrics.h index 354312a3992..6a57e0953fa 100644 --- a/src/mongo/db/stats/api_version_metrics.h +++ b/src/mongo/db/stats/api_version_metrics.h @@ -52,7 +52,7 @@ public: APIVersionMetrics() = default; // Update the timestamp for the API version used by the application. - void update(const std::string appName, const APIParameters& apiParams); + void update(std::string appName, const APIParameters& apiParams); void appendAPIVersionMetricsInfo(BSONObjBuilder* b); diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h index ad2f2dd8dd2..e8071e72907 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h @@ -594,7 +594,7 @@ public: } std::pair<const_iterator, bool> insert(value_type&& value) { - const Key& key = std::move(value).first; + const Key& key = value.first; Node* node = _findNode(key); if (node != nullptr || key.size() == 0) @@ -604,7 +604,7 @@ public: } std::pair<const_iterator, bool> update(value_type&& value) { - const Key& key = std::move(value).first; + const Key& key = value.first; // Ensure that the item to be updated exists. auto item = RadixStore::find(key); diff --git a/src/mongo/db/storage/flow_control.h b/src/mongo/db/storage/flow_control.h index 4a2d66a0af9..2ed3e3ddef8 100644 --- a/src/mongo/db/storage/flow_control.h +++ b/src/mongo/db/storage/flow_control.h @@ -132,7 +132,7 @@ public: double locksPerOp, std::uint64_t lagMillis, std::uint64_t thresholdLagMillis); - void _trimSamples(const Timestamp trimSamplesTo); + void _trimSamples(Timestamp trimSamplesTo); // Sample of (timestamp, ops, lock acquisitions) where ops and lock acquisitions are // observations of the corresponding counter at (roughly) <timestamp>. diff --git a/src/mongo/db/storage/key_string.h b/src/mongo/db/storage/key_string.h index 2b846e55270..e56b309106f 100644 --- a/src/mongo/db/storage/key_string.h +++ b/src/mongo/db/storage/key_string.h @@ -549,7 +549,7 @@ public: /** * Appends a Discriminator byte and kEnd byte to a key string. */ - void appendDiscriminator(const Discriminator discriminator); + void appendDiscriminator(Discriminator discriminator); /** * Resets to an empty state. @@ -635,12 +635,12 @@ protected: void _appendArray(const BSONArray& val, bool invert, const StringTransformFn& f); void _appendSetAsArray(const BSONElementSet& val, bool invert, const StringTransformFn& f); void _appendObject(const BSONObj& val, bool invert, const StringTransformFn& f); - void _appendNumberDouble(const double num, bool invert); - void _appendNumberLong(const long long num, bool invert); - void _appendNumberInt(const int num, bool invert); - void _appendNumberDecimal(const Decimal128 num, bool invert); + void _appendNumberDouble(double num, bool invert); + void _appendNumberLong(long long num, bool invert); + void _appendNumberInt(int num, bool invert); + void _appendNumberDecimal(Decimal128 num, bool invert); - void _appendRecordIdLong(const int64_t val); + void _appendRecordIdLong(int64_t val); void _appendRecordIdStr(const char* val, int size); /** @@ -657,12 +657,12 @@ protected: void _appendBson(const BSONObj& obj, bool invert, const StringTransformFn& f); void _appendSmallDouble(double value, DecimalContinuationMarker dcm, bool invert); void _appendLargeDouble(double value, DecimalContinuationMarker dcm, bool invert); - void _appendInteger(const long long num, bool invert); + void _appendInteger(long long num, bool invert); void _appendPreshiftedIntegerPortion(uint64_t value, bool isNegative, bool invert); - void _appendDoubleWithoutTypeBits(const double num, DecimalContinuationMarker dcm, bool invert); - void _appendHugeDecimalWithoutTypeBits(const Decimal128 dec, bool invert); - void _appendTinyDecimalWithoutTypeBits(const Decimal128 dec, const double bin, bool invert); + void _appendDoubleWithoutTypeBits(double num, DecimalContinuationMarker dcm, bool invert); + void _appendHugeDecimalWithoutTypeBits(Decimal128 dec, bool invert); + void _appendTinyDecimalWithoutTypeBits(Decimal128 dec, double bin, bool invert); void _appendEnd(); template <typename T> diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h index a99638bf85f..11b4ab609b8 100644 --- a/src/mongo/db/storage/storage_engine.h +++ b/src/mongo/db/storage/storage_engine.h @@ -349,7 +349,7 @@ public: virtual ~StreamingCursor() = default; - virtual StatusWith<std::vector<BackupBlock>> getNextBatch(const std::size_t batchSize) = 0; + virtual StatusWith<std::vector<BackupBlock>> getNextBatch(std::size_t batchSize) = 0; protected: BackupOptions options; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h index 2b6d957ac35..d4f012d7541 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h @@ -80,7 +80,7 @@ public: * The document 'options' is typically obtained from the 'wiredTiger' field of * CollectionOptions::storageEngine. */ - static StatusWith<std::string> parseOptionsField(const BSONObj options); + static StatusWith<std::string> parseOptionsField(BSONObj options); /** * Creates a configuration string suitable for 'config' parameter in WT_SESSION::create(). diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h index c143b9e87f5..60b2b885ae0 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h @@ -76,9 +76,7 @@ public: AtomicWord<bool> _dirty; }; - WiredTigerSizeStorer(WT_CONNECTION* conn, - const std::string& storageUri, - const bool readOnly = false); + WiredTigerSizeStorer(WT_CONNECTION* conn, const std::string& storageUri, bool readOnly = false); ~WiredTigerSizeStorer(); /** diff --git a/src/mongo/db/update/array_culling_node.h b/src/mongo/db/update/array_culling_node.h index c3ab2849689..93aa5adef5f 100644 --- a/src/mongo/db/update/array_culling_node.h +++ b/src/mongo/db/update/array_culling_node.h @@ -53,7 +53,7 @@ public: mutablebson::ConstElement rightSibling, std::uint32_t recursionLevel, ModifyResult modifyResult, - const bool validateForStorage, + bool validateForStorage, bool* containsDotsAndDollarsField) const final; void setCollator(const CollatorInterface* collator) final { diff --git a/src/mongo/db/update/modifier_node.h b/src/mongo/db/update/modifier_node.h index 9ae0786c073..53ec3e7f375 100644 --- a/src/mongo/db/update/modifier_node.h +++ b/src/mongo/db/update/modifier_node.h @@ -125,7 +125,7 @@ protected: mutablebson::ConstElement rightSibling, std::uint32_t recursionLevel, ModifyResult modifyResult, - const bool validateForStorage, + bool validateForStorage, bool* containsDotsAndDollarsField) const; /** diff --git a/src/mongo/db/update/pop_node.h b/src/mongo/db/update/pop_node.h index c245d296362..d5047b59507 100644 --- a/src/mongo/db/update/pop_node.h +++ b/src/mongo/db/update/pop_node.h @@ -48,7 +48,7 @@ public: mutablebson::ConstElement rightSibling, std::uint32_t recursionLevel, ModifyResult modifyResult, - const bool validateForStorage, + bool validateForStorage, bool* containsDotsAndDollarsField) const final; std::unique_ptr<UpdateNode> clone() const final { diff --git a/src/mongo/db/update/storage_validation.h b/src/mongo/db/update/storage_validation.h index a65612137b7..381abf66a9b 100644 --- a/src/mongo/db/update/storage_validation.h +++ b/src/mongo/db/update/storage_validation.h @@ -56,8 +56,8 @@ Status storageValidIdField(const mongo::BSONElement& element); * during validation. */ void storageValid(const mutablebson::Document& doc, - const bool allowTopLevelDollarPrefixes, - const bool shouldValidate, + bool allowTopLevelDollarPrefixes, + bool shouldValidate, bool* containsDotsAndDollarsField); /** @@ -75,10 +75,10 @@ void storageValid(const mutablebson::Document& doc, * during validation. */ void storageValid(mutablebson::ConstElement elem, - const bool deep, + bool deep, std::uint32_t recursionLevel, - const bool allowTopLevelDollarPrefixes, - const bool shouldValidate, + bool allowTopLevelDollarPrefixes, + bool shouldValidate, bool* containsDotsAndDollarsField); } // namespace storage_validation diff --git a/src/mongo/db/update/update_driver.h b/src/mongo/db/update/update_driver.h index e4104a313ec..18cce2c38b8 100644 --- a/src/mongo/db/update/update_driver.h +++ b/src/mongo/db/update/update_driver.h @@ -67,7 +67,7 @@ public: void parse(const write_ops::UpdateModification& updateExpr, const std::map<StringData, std::unique_ptr<ExpressionWithPlaceholder>>& arrayFilters, boost::optional<BSONObj> constants = boost::none, - const bool multi = false); + bool multi = false); /** * Fills in document with any fields in the query which are valid. @@ -211,7 +211,7 @@ public: private: /** Create the modifier and add it to the back of the modifiers vector */ - inline Status addAndParse(const modifiertable::ModifierType type, const BSONElement& elem); + inline Status addAndParse(modifiertable::ModifierType type, const BSONElement& elem); // // immutable properties after parsing diff --git a/src/mongo/db/update/v1_log_builder.h b/src/mongo/db/update/v1_log_builder.h index c532b007ab8..7be6abc57a0 100644 --- a/src/mongo/db/update/v1_log_builder.h +++ b/src/mongo/db/update/v1_log_builder.h @@ -101,7 +101,7 @@ private: * * If any problem occurs then the operation will stop and return that error Status. */ - Status addToSetsWithNewFieldName(StringData name, const mutablebson::Element val); + Status addToSetsWithNewFieldName(StringData name, mutablebson::Element val); /** * Convenience method which calls addToSets after diff --git a/src/mongo/db/vector_clock.h b/src/mongo/db/vector_clock.h index 332681b3eb4..b6f58fd5e87 100644 --- a/src/mongo/db/vector_clock.h +++ b/src/mongo/db/vector_clock.h @@ -142,7 +142,7 @@ public: */ bool gossipOut(OperationContext* opCtx, BSONObjBuilder* outMessage, - const transport::Session::TagMask defaultClientSessionTags = 0) const; + transport::Session::TagMask defaultClientSessionTags = 0) const; /** * Read the necessary fields from inMessage in order to update the current time, based on this @@ -152,7 +152,7 @@ public: void gossipIn(OperationContext* opCtx, const BSONObj& inMessage, bool couldBeUnauthenticated, - const transport::Session::TagMask defaultClientSessionTags = 0); + transport::Session::TagMask defaultClientSessionTags = 0); /** * Returns true if the clock is enabled and can be used. Defaults to true. diff --git a/src/mongo/embedded/replication_coordinator_embedded.h b/src/mongo/embedded/replication_coordinator_embedded.h index 71cf923e5ee..1b441a74319 100644 --- a/src/mongo/embedded/replication_coordinator_embedded.h +++ b/src/mongo/embedded/replication_coordinator_embedded.h @@ -305,9 +305,9 @@ public: void finishRecoveryIfEligible(OperationContext* opCtx) override; void updateAndLogStateTransitionMetrics( - const ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, - const size_t numOpsKilled, - const size_t numOpsRunning) const override; + ReplicationCoordinator::OpsKillingStateTransitionEnum stateTransition, + size_t numOpsKilled, + size_t numOpsRunning) const override; TopologyVersion getTopologyVersion() const override; diff --git a/src/mongo/embedded/stitch_support/stitch_support.h b/src/mongo/embedded/stitch_support/stitch_support.h index ecce75e1635..8f4999589ab 100644 --- a/src/mongo/embedded/stitch_support/stitch_support.h +++ b/src/mongo/embedded/stitch_support/stitch_support.h @@ -226,8 +226,8 @@ stitch_support_v1_init(stitch_support_v1_status* status); * Returns STITCH_SUPPORT_V1_ERROR_LIBRARY_NOT_INITIALIZED and modifies 'status' if * stitch_support_v1_lib_init() has not been called previously. */ -STITCH_SUPPORT_API int MONGO_API_CALL -stitch_support_v1_fini(stitch_support_v1_lib* const lib, stitch_support_v1_status* const status); +STITCH_SUPPORT_API int MONGO_API_CALL stitch_support_v1_fini(stitch_support_v1_lib* lib, + stitch_support_v1_status* status); /** * A collator object represents a parsed collation. A single collator can be used by multiple @@ -246,10 +246,8 @@ typedef struct stitch_support_v1_collator stitch_support_v1_collator; * This function will fail if the collationBSON is invalid. On failure, it returns NULL and * populates the 'status' object if it is not NULL. */ -STITCH_SUPPORT_API stitch_support_v1_collator* MONGO_API_CALL -stitch_support_v1_collator_create(stitch_support_v1_lib* lib, - const uint8_t* collationBSON, - stitch_support_v1_status* const status); +STITCH_SUPPORT_API stitch_support_v1_collator* MONGO_API_CALL stitch_support_v1_collator_create( + stitch_support_v1_lib* lib, const uint8_t* collationBSON, stitch_support_v1_status* status); /** * Destroys a valid stitch_support_v1_collator object. @@ -304,7 +302,7 @@ stitch_support_v1_matcher_create(stitch_support_v1_lib* lib, * This function does not report failures. */ STITCH_SUPPORT_API void MONGO_API_CALL -stitch_support_v1_matcher_destroy(stitch_support_v1_matcher* const matcher); +stitch_support_v1_matcher_destroy(stitch_support_v1_matcher* matcher); /** * Check if the 'documentBSON' input matches the predicate represented by the 'matcher' object. @@ -380,7 +378,7 @@ stitch_support_v1_projection_create(stitch_support_v1_lib* lib, * This function does not report failures. */ STITCH_SUPPORT_API void MONGO_API_CALL -stitch_support_v1_projection_destroy(stitch_support_v1_projection* const projection); +stitch_support_v1_projection_destroy(stitch_support_v1_projection* projection); /** * Apply a projection to an input document, writing the resulting BSON to a newly allocated 'output' @@ -393,7 +391,7 @@ stitch_support_v1_projection_destroy(stitch_support_v1_projection* const project * trigger an assertion failure. */ STITCH_SUPPORT_API uint8_t* MONGO_API_CALL -stitch_support_v1_projection_apply(stitch_support_v1_projection* const projection, +stitch_support_v1_projection_apply(stitch_support_v1_projection* projection, const uint8_t* documentBSON, stitch_support_v1_status* status); @@ -406,7 +404,7 @@ stitch_support_v1_projection_apply(stitch_support_v1_projection* const projectio * the matcher matches the input document. */ STITCH_SUPPORT_API bool MONGO_API_CALL -stitch_support_v1_projection_requires_match(stitch_support_v1_projection* const projection); +stitch_support_v1_projection_requires_match(stitch_support_v1_projection* projection); /** * An update details object stores the list of paths modified by a call to @@ -503,7 +501,7 @@ stitch_support_v1_update_create(stitch_support_v1_lib* lib, * This function does not report failures. */ STITCH_SUPPORT_API void MONGO_API_CALL -stitch_support_v1_update_destroy(stitch_support_v1_update* const update); +stitch_support_v1_update_destroy(stitch_support_v1_update* update); /** * Apply an update to an input document writing the resulting BSON to a newly allocated output @@ -516,7 +514,7 @@ stitch_support_v1_update_destroy(stitch_support_v1_update* const update); * trigger an assertion failure. */ STITCH_SUPPORT_API uint8_t* MONGO_API_CALL -stitch_support_v1_update_apply(stitch_support_v1_update* const update, +stitch_support_v1_update_apply(stitch_support_v1_update* update, const uint8_t* documentBSON, stitch_support_v1_update_details* update_details, stitch_support_v1_status* status); @@ -542,8 +540,8 @@ stitch_support_v1_update_apply(stitch_support_v1_update* const update, * an '_id' field, this function does not populate an '_id' field if one is not in the match or * update document. */ -STITCH_SUPPORT_API uint8_t* MONGO_API_CALL stitch_support_v1_update_upsert( - stitch_support_v1_update* const update, stitch_support_v1_status* status); +STITCH_SUPPORT_API uint8_t* MONGO_API_CALL +stitch_support_v1_update_upsert(stitch_support_v1_update* update, stitch_support_v1_status* status); /** * Returns true iff applying this update requires a matcher that matches the input document, as is @@ -554,7 +552,7 @@ STITCH_SUPPORT_API uint8_t* MONGO_API_CALL stitch_support_v1_update_upsert( * matches the input document. */ STITCH_SUPPORT_API bool MONGO_API_CALL -stitch_support_v1_update_requires_match(stitch_support_v1_update* const update); +stitch_support_v1_update_requires_match(stitch_support_v1_update* update); /** * Free the memory of a BSON buffer returned by stitch_support_v1_projection_apply() or diff --git a/src/mongo/executor/async_multicaster.h b/src/mongo/executor/async_multicaster.h index 63eaaa4993d..400a7371f0a 100644 --- a/src/mongo/executor/async_multicaster.h +++ b/src/mongo/executor/async_multicaster.h @@ -66,7 +66,7 @@ public: * or * timeoutMillis * (servers.size() / maxConcurrency) - if not */ - std::vector<Reply> multicast(const std::vector<HostAndPort> servers, + std::vector<Reply> multicast(std::vector<HostAndPort> servers, const std::string& theDbName, const BSONObj& theCmdObj, OperationContext* opCtx, diff --git a/src/mongo/executor/network_interface_mock.h b/src/mongo/executor/network_interface_mock.h index 5d29786f091..ecbba32e7ae 100644 --- a/src/mongo/executor/network_interface_mock.h +++ b/src/mongo/executor/network_interface_mock.h @@ -238,7 +238,7 @@ public: * "when" defaults to now(). */ RemoteCommandRequest scheduleErrorResponse(const Status& response); - RemoteCommandRequest scheduleErrorResponse(const TaskExecutor::ResponseStatus response); + RemoteCommandRequest scheduleErrorResponse(TaskExecutor::ResponseStatus response); RemoteCommandRequest scheduleErrorResponse(NetworkOperationIterator noi, const Status& response); RemoteCommandRequest scheduleErrorResponse(NetworkOperationIterator noi, diff --git a/src/mongo/platform/process_id.h b/src/mongo/platform/process_id.h index 2e2e6396de9..3b915b0916f 100644 --- a/src/mongo/platform/process_id.h +++ b/src/mongo/platform/process_id.h @@ -129,7 +129,8 @@ public: } template <typename H> - friend H AbslHashValue(H h, const ProcessId pid) { + friend H AbslHashValue( + H h, const ProcessId pid) { // NOLINT(readability-avoid-const-params-in-decls) return H::combine(std::move(h), pid.asUInt32()); } diff --git a/src/mongo/rpc/legacy_reply_builder.h b/src/mongo/rpc/legacy_reply_builder.h index 16ea869c46e..45e986ab9ed 100644 --- a/src/mongo/rpc/legacy_reply_builder.h +++ b/src/mongo/rpc/legacy_reply_builder.h @@ -61,7 +61,7 @@ public: Protocol getProtocol() const final; - void reserveBytes(const std::size_t bytes) final; + void reserveBytes(std::size_t bytes) final; private: BufBuilder _builder; diff --git a/src/mongo/rpc/protocol.h b/src/mongo/rpc/protocol.h index f81fcaa542b..1f0a966e1f2 100644 --- a/src/mongo/rpc/protocol.h +++ b/src/mongo/rpc/protocol.h @@ -116,7 +116,7 @@ StatusWith<ProtocolSet> parseProtocolSet(StringData repr); * Validates client and server wire version. The server is returned from isMaster, and the client is * from WireSpec.instance(). */ -Status validateWireVersion(const WireVersionInfo client, const WireVersionInfo server); +Status validateWireVersion(WireVersionInfo client, WireVersionInfo server); /** * Struct to pass around information about protocol set and wire version. @@ -135,7 +135,7 @@ StatusWith<ProtocolSetAndWireVersionInfo> parseProtocolSetFromIsMasterReply( /** * Computes supported protocols from wire versions. */ -ProtocolSet computeProtocolSet(const WireVersionInfo version); +ProtocolSet computeProtocolSet(WireVersionInfo version); } // namespace rpc } // namespace mongo diff --git a/src/mongo/rpc/reply_builder_interface.h b/src/mongo/rpc/reply_builder_interface.h index 860f52a5d02..bd87aef468f 100644 --- a/src/mongo/rpc/reply_builder_interface.h +++ b/src/mongo/rpc/reply_builder_interface.h @@ -136,7 +136,7 @@ public: /** * Reserves and claims bytes for the Message generated by this interface. */ - virtual void reserveBytes(const std::size_t bytes) = 0; + virtual void reserveBytes(std::size_t bytes) = 0; /** * For exhaust commands, returns whether the command should be run again. diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.h b/src/mongo/s/catalog/sharding_catalog_client_impl.h index 1526dfd0302..c26562206cd 100644 --- a/src/mongo/s/catalog/sharding_catalog_client_impl.h +++ b/src/mongo/s/catalog/sharding_catalog_client_impl.h @@ -62,7 +62,7 @@ public: static Status updateShardingCatalogEntryForCollection(OperationContext* opCtx, const NamespaceString& nss, const CollectionType& coll, - const bool upsert); + bool upsert); DatabaseType getDatabase(OperationContext* opCtx, StringData db, diff --git a/src/mongo/s/catalog/type_config_version.h b/src/mongo/s/catalog/type_config_version.h index 842b6679385..9734061ef4d 100644 --- a/src/mongo/s/catalog/type_config_version.h +++ b/src/mongo/s/catalog/type_config_version.h @@ -92,12 +92,12 @@ public: int getMinCompatibleVersion() const { return _minCompatibleVersion.get(); } - void setMinCompatibleVersion(const int minCompatibleVersion); + void setMinCompatibleVersion(int minCompatibleVersion); int getCurrentVersion() const { return _currentVersion.get(); } - void setCurrentVersion(const int currentVersion); + void setCurrentVersion(int currentVersion); const OID& getClusterId() const { return _clusterId.get(); diff --git a/src/mongo/s/catalog/type_mongos.h b/src/mongo/s/catalog/type_mongos.h index 6bb27889adf..945907532b9 100644 --- a/src/mongo/s/catalog/type_mongos.h +++ b/src/mongo/s/catalog/type_mongos.h @@ -93,7 +93,7 @@ public: long long getUptime() const { return _uptime.get(); } - void setUptime(const long long uptime); + void setUptime(long long uptime); bool getWaiting() const { return _waiting.get(); @@ -101,7 +101,7 @@ public: bool isWaitingSet() const { return _waiting.is_initialized(); } - void setWaiting(const bool waiting); + void setWaiting(bool waiting); const std::string& getMongoVersion() const { return _mongoVersion.get(); @@ -114,7 +114,7 @@ public: long long getConfigVersion() const { return _configVersion.get(); } - void setConfigVersion(const long long configVersion); + void setConfigVersion(long long configVersion); std::vector<std::string> getAdvisoryHostFQDNs() const { return _advisoryHostFQDNs.value_or(std::vector<std::string>()); diff --git a/src/mongo/s/catalog/type_shard.h b/src/mongo/s/catalog/type_shard.h index e81df532c01..fa73e1271a4 100644 --- a/src/mongo/s/catalog/type_shard.h +++ b/src/mongo/s/catalog/type_shard.h @@ -107,12 +107,12 @@ public: bool getDraining() const { return _draining.value_or(false); } - void setDraining(const bool draining); + void setDraining(bool draining); long long getMaxSizeMB() const { return _maxSizeMB.value_or(0); } - void setMaxSizeMB(const long long maxSizeMB); + void setMaxSizeMB(long long maxSizeMB); std::vector<std::string> getTags() const { return _tags.value_or(std::vector<std::string>()); @@ -122,7 +122,7 @@ public: ShardState getState() const { return _state.value_or(ShardState::kNotShardAware); } - void setState(const ShardState state); + void setState(ShardState state); Timestamp getTopologyTime() const { return _topologyTime.value_or(Timestamp()); diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h index 863ee2ec8cf..c5b73cdf529 100644 --- a/src/mongo/s/catalog_cache.h +++ b/src/mongo/s/catalog_cache.h @@ -153,7 +153,7 @@ public: * * In the case the passed version is boost::none, nothing will be done. */ - void onStaleDatabaseVersion(const StringData dbName, + void onStaleDatabaseVersion(StringData dbName, const boost::optional<DatabaseVersion>& wantedVersion); /** @@ -275,7 +275,7 @@ private: } _stats; - void _updateRefreshesStats(const bool isIncremental, const bool add); + void _updateRefreshesStats(bool isIncremental, bool add); }; StatusWith<ChunkManager> _getCollectionRoutingInfoAt(OperationContext* opCtx, diff --git a/src/mongo/s/client/shard.h b/src/mongo/s/client/shard.h index 9c28d5139c8..fa6c26f0d39 100644 --- a/src/mongo/s/client/shard.h +++ b/src/mongo/s/client/shard.h @@ -227,7 +227,7 @@ public: * retriable errors must be done differently. */ BatchedCommandResponse runBatchWriteCommand(OperationContext* opCtx, - const Milliseconds maxTimeMS, + Milliseconds maxTimeMS, const BatchedCommandRequest& batchRequest, RetryPolicy retryPolicy); @@ -246,7 +246,7 @@ public: const NamespaceString& nss, const BSONObj& query, const BSONObj& sort, - const boost::optional<long long> limit, + boost::optional<long long> limit, const boost::optional<BSONObj>& hint = boost::none); /** diff --git a/src/mongo/s/is_mongos.h b/src/mongo/s/is_mongos.h index e72068624cf..c3d1c26a560 100644 --- a/src/mongo/s/is_mongos.h +++ b/src/mongo/s/is_mongos.h @@ -39,7 +39,7 @@ bool isMongos(); /** * Set the global state flag indicating whether the running process is `mongos` or not. */ -void setMongos(const bool state = true); +void setMongos(bool state = true); /** * Returns whether this node is config server or a shard. diff --git a/src/mongo/s/query/cluster_aggregation_planner.h b/src/mongo/s/query/cluster_aggregation_planner.h index 8cc0ccc4cea..cf8c52583ff 100644 --- a/src/mongo/s/query/cluster_aggregation_planner.h +++ b/src/mongo/s/query/cluster_aggregation_planner.h @@ -78,7 +78,7 @@ struct AggregationTargeter { static AggregationTargeter make( OperationContext* opCtx, const NamespaceString& executionNss, - const std::function<std::unique_ptr<Pipeline, PipelineDeleter>()> buildPipelineFn, + std::function<std::unique_ptr<Pipeline, PipelineDeleter>()> buildPipelineFn, boost::optional<ChunkManager> cm, stdx::unordered_set<NamespaceString> involvedNamespaces, bool hasChangeStream, diff --git a/src/mongo/s/query/establish_cursors.h b/src/mongo/s/query/establish_cursors.h index 1fedd6aea16..3a904adcadd 100644 --- a/src/mongo/s/query/establish_cursors.h +++ b/src/mongo/s/query/establish_cursors.h @@ -67,7 +67,7 @@ std::vector<RemoteCursor> establishCursors( OperationContext* opCtx, std::shared_ptr<executor::TaskExecutor> executor, const NamespaceString& nss, - const ReadPreferenceSetting readPref, + ReadPreferenceSetting readPref, const std::vector<std::pair<ShardId, BSONObj>>& remotes, bool allowPartialResults, Shard::RetryPolicy retryPolicy = Shard::RetryPolicy::kIdempotent); diff --git a/src/mongo/s/shard_key_pattern.h b/src/mongo/s/shard_key_pattern.h index aed37e46889..7f194c8ab1e 100644 --- a/src/mongo/s/shard_key_pattern.h +++ b/src/mongo/s/shard_key_pattern.h @@ -215,7 +215,7 @@ public: /** * Returns the document with missing shard key values set to null. */ - BSONObj emplaceMissingShardKeyValuesForDocument(const BSONObj doc) const; + BSONObj emplaceMissingShardKeyValuesForDocument(BSONObj doc) const; /** * Given a simple BSON query, extracts the shard key corresponding to the key pattern diff --git a/src/mongo/s/transaction_router.h b/src/mongo/s/transaction_router.h index 3d6be675077..b31be66cc5d 100644 --- a/src/mongo/s/transaction_router.h +++ b/src/mongo/s/transaction_router.h @@ -594,7 +594,7 @@ public: */ void _setReadOnlyForParticipant(OperationContext* opCtx, const ShardId& shard, - const Participant::ReadOnly readOnly); + Participant::ReadOnly readOnly); /** * Updates relevant metrics when the router receives an explicit abort from the client. diff --git a/src/mongo/s/write_ops/batch_write_exec.h b/src/mongo/s/write_ops/batch_write_exec.h index 9b6773ecb47..b1043fb3523 100644 --- a/src/mongo/s/write_ops/batch_write_exec.h +++ b/src/mongo/s/write_ops/batch_write_exec.h @@ -94,7 +94,7 @@ public: void noteWriteAt(const HostAndPort& host, repl::OpTime opTime, const OID& electionId); void noteTargetedShard(const ShardId& shardId); - void noteNumShardsOwningChunks(const int nShardsOwningChunks); + void noteNumShardsOwningChunks(int nShardsOwningChunks); const std::set<ShardId>& getTargetedShards() const; const HostOpTimeMap& getWriteOpTimes() const; diff --git a/src/mongo/s/write_ops/batched_command_request.h b/src/mongo/s/write_ops/batched_command_request.h index 8337d208daf..a7e02f2e58a 100644 --- a/src/mongo/s/write_ops/batched_command_request.h +++ b/src/mongo/s/write_ops/batched_command_request.h @@ -167,7 +167,7 @@ public: * Returns batch of insert operations to be attached to a transaction */ static BatchedCommandRequest buildInsertOp(const NamespaceString& nss, - const std::vector<BSONObj> docs); + std::vector<BSONObj> docs); /* * Returns batch of update operations to be attached to a transaction diff --git a/src/mongo/scripting/bson_template_evaluator.h b/src/mongo/scripting/bson_template_evaluator.h index 472f7452d75..ff1de6f420c 100644 --- a/src/mongo/scripting/bson_template_evaluator.h +++ b/src/mongo/scripting/bson_template_evaluator.h @@ -146,7 +146,7 @@ private: VarMap _varMap; // evaluates a BSON element. This is internally called by the top level evaluate method. - Status _evalElem(const BSONElement in, BSONObjBuilder& out); + Status _evalElem(BSONElement in, BSONObjBuilder& out); // evaluates a BSON object. This is internally called by the top level evaluate method // and the _evalElem method. diff --git a/src/mongo/shell/encrypted_dbclient_base.h b/src/mongo/shell/encrypted_dbclient_base.h index 5062dfa8266..f043d9bb28a 100644 --- a/src/mongo/shell/encrypted_dbclient_base.h +++ b/src/mongo/shell/encrypted_dbclient_base.h @@ -149,11 +149,9 @@ public: protected: std::pair<rpc::UniqueReply, DBClientBase*> processResponse(rpc::UniqueReply result, - const StringData databaseName); + StringData databaseName); - BSONObj encryptDecryptCommand(const BSONObj& object, - bool encrypt, - const StringData databaseName); + BSONObj encryptDecryptCommand(const BSONObj& object, bool encrypt, StringData databaseName); JS::Value getCollection() const; diff --git a/src/mongo/shell/shell_utils_launcher.h b/src/mongo/shell/shell_utils_launcher.h index 9cecdc13a2c..14a6ce06390 100644 --- a/src/mongo/shell/shell_utils_launcher.h +++ b/src/mongo/shell/shell_utils_launcher.h @@ -99,17 +99,17 @@ public: * @param block if true, block the thread until the child has exited * @param exit_code[out] if set, and an exit code is available, the code will be stored here * @return true if the process has exited, false otherwise */ - bool waitForPid(const ProcessId pid, const bool block, int* const exit_code = nullptr); + bool waitForPid(ProcessId pid, bool block, int* exit_code = nullptr); /** check if a child process is alive. Never blocks * @param pid the processid * @param exit_code[out] if set, and an exit code is available, the code will be stored here * @return true if the process has exited, false otherwise */ - bool isPidDead(const ProcessId pids, int* const exit_code = nullptr); + bool isPidDead(ProcessId pids, int* exit_code = nullptr); void getRegisteredPorts(std::vector<int>& ports); void getRegisteredPids(std::vector<ProcessId>& pids); private: - void updatePidExitCode(const ProcessId pid, int exitCode); + void updatePidExitCode(ProcessId pid, int exitCode); private: stdx::unordered_set<ProcessId> _registeredPids; diff --git a/src/mongo/util/net/ssl_manager.h b/src/mongo/util/net/ssl_manager.h index f651821e64c..124fd6ae1e3 100644 --- a/src/mongo/util/net/ssl_manager.h +++ b/src/mongo/util/net/ssl_manager.h @@ -478,16 +478,16 @@ void tlsEmitWarningExpiringClientCertificate(const SSLX509Name& peer, Days days) * Logs the SSL information by dispatching to either logCert() or logCRL(). */ void logSSLInfo(const SSLInformationToLog& info, - const int logNumPEM = 4913010, - const int logNumCluster = 4913011, - const int logNumCrl = 4913012); + int logNumPEM = 4913010, + int logNumCluster = 4913011, + int logNumCrl = 4913012); /** * Logs the certificate. * @param certType human-readable description of the certificate type. */ -void logCert(const CertInformationToLog& cert, StringData certType, const int logNum); -void logCRL(const CRLInformationToLog& crl, const int logNum); +void logCert(const CertInformationToLog& cert, StringData certType, int logNum); +void logCRL(const CRLInformationToLog& crl, int logNum); } // namespace mongo #endif // #ifdef MONGO_CONFIG_SSL diff --git a/src/mongo/util/options_parser/option_description.h b/src/mongo/util/options_parser/option_description.h index 819619537eb..48cf4161fa2 100644 --- a/src/mongo/util/options_parser/option_description.h +++ b/src/mongo/util/options_parser/option_description.h @@ -82,7 +82,7 @@ private: OptionDescription() = delete; OptionDescription(const std::string& dottedName, const std::string& singleName, - const OptionType type, + OptionType type, const std::string& description, const std::vector<std::string>& deprecatedDottedNames = {}, const std::vector<std::string>& deprecatedSingleNames = {}); diff --git a/src/mongo/util/options_parser/option_section.h b/src/mongo/util/options_parser/option_section.h index 1669904445f..b9da75700c6 100644 --- a/src/mongo/util/options_parser/option_section.h +++ b/src/mongo/util/options_parser/option_section.h @@ -89,7 +89,7 @@ public: }; OptionDescription& addOptionChaining(const std::string& dottedName, const std::string& singleName, - const OptionType type, + OptionType type, const std::string& description, const std::vector<std::string>& deprecatedDottedNames, const std::vector<std::string>& deprecatedSingleNames, diff --git a/src/mongo/util/read_through_cache.h b/src/mongo/util/read_through_cache.h index b3ff5aeefc8..2fe230bdd41 100644 --- a/src/mongo/util/read_through_cache.h +++ b/src/mongo/util/read_through_cache.h @@ -540,10 +540,11 @@ private: auto p(std::move(promisesToSet.back())); promisesToSet.pop_back(); - if (promisesToSet.empty()) + if (promisesToSet.empty()) { p->setFrom(std::move(result)); - else - p->setFrom(result); + break; + } + p->setFrom(result); } return mustDoAnotherLoop |