summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-01-04 12:19:37 -0500
committerBilly Donahue <billy.donahue@mongodb.com>2019-01-07 12:08:23 -0500
commit11bb071e91461b1f8e40b9b15ddf3b9e1a2d23d1 (patch)
tree7037865f9bf4445fb3295ca7ce72f4182f012554 /src/mongo
parent6a0a21214dd96663c899cb8f2562d6121351ed3c (diff)
downloadmongo-11bb071e91461b1f8e40b9b15ddf3b9e1a2d23d1.tar.gz
SERVER-36644 remove AtomicWord typedefs
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/base/counter.h2
-rw-r--r--src/mongo/base/status-inl.h2
-rw-r--r--src/mongo/base/status.h4
-rw-r--r--src/mongo/bson/oid.cpp5
-rw-r--r--src/mongo/client/connpool.cpp2
-rw-r--r--src/mongo/client/connpool.h2
-rw-r--r--src/mongo/client/dbclient_base.cpp2
-rw-r--r--src/mongo/client/dbclient_base.h2
-rw-r--r--src/mongo/client/dbclient_connection.cpp2
-rw-r--r--src/mongo/client/dbclient_connection.h6
-rw-r--r--src/mongo/client/replica_set_monitor.cpp2
-rw-r--r--src/mongo/client/replica_set_monitor.h2
-rw-r--r--src/mongo/db/auth/authorization_manager_impl.h4
-rw-r--r--src/mongo/db/auth/sasl_options.cpp2
-rw-r--r--src/mongo/db/auth/sasl_options.h6
-rw-r--r--src/mongo/db/auth/user.h2
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job_parameters.idl2
-rw-r--r--src/mongo/db/catalog/multi_index_block.idl4
-rw-r--r--src/mongo/db/catalog/util/partitioned_test.cpp2
-rw-r--r--src/mongo/db/collection_index_usage_tracker.h2
-rw-r--r--src/mongo/db/commands/mr.cpp2
-rw-r--r--src/mongo/db/commands/mr.h2
-rw-r--r--src/mongo/db/concurrency/d_concurrency_test.cpp10
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp2
-rw-r--r--src/mongo/db/concurrency/lock_stats.cpp4
-rw-r--r--src/mongo/db/concurrency/lock_stats.h10
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.cpp2
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.h2
-rw-r--r--src/mongo/db/free_mon/free_mon_controller_test.cpp4
-rw-r--r--src/mongo/db/ftdc/ftdc_server.h12
-rw-r--r--src/mongo/db/index/duplicate_key_tracker.h2
-rw-r--r--src/mongo/db/index/index_access_method.cpp2
-rw-r--r--src/mongo/db/index/index_build_interceptor.h2
-rw-r--r--src/mongo/db/index_builder.cpp2
-rw-r--r--src/mongo/db/index_builder.h2
-rw-r--r--src/mongo/db/logical_session_cache.cpp3
-rw-r--r--src/mongo/db/pipeline/document_source_bucket_auto.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_group.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_out_replace_coll.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_sort.cpp2
-rw-r--r--src/mongo/db/query/expression_index_knobs.h10
-rw-r--r--src/mongo/db/query/query_knobs.h54
-rw-r--r--src/mongo/db/repl/initial_syncer.cpp4
-rw-r--r--src/mongo/db/repl/initial_syncer.h2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.h10
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.h2
-rw-r--r--src/mongo/db/retryable_writes_stats.h6
-rw-r--r--src/mongo/db/s/collection_range_deleter.h4
-rw-r--r--src/mongo/db/s/shard_server_catalog_cache_loader.cpp2
-rw-r--r--src/mongo/db/s/sharding_logging.h4
-rw-r--r--src/mongo/db/s/sharding_state.h2
-rw-r--r--src/mongo/db/s/sharding_statistics.h20
-rw-r--r--src/mongo/db/server_options.h6
-rw-r--r--src/mongo/db/server_parameters_test.cpp4
-rw-r--r--src/mongo/db/server_transactions_metrics.h20
-rw-r--r--src/mongo/db/service_context.h2
-rw-r--r--src/mongo/db/snapshot_window_options.h14
-rw-r--r--src/mongo/db/sorter/sorter_test.cpp2
-rw-r--r--src/mongo/db/stats/counters.cpp4
-rw-r--r--src/mongo/db/stats/counters.h38
-rw-r--r--src/mongo/db/stats/timer_stats.h4
-rw-r--r--src/mongo/db/storage/biggie/biggie_record_store.h4
-rw-r--r--src/mongo/db/storage/kv/kv_catalog.h2
-rw-r--r--src/mongo/db/storage/mobile/mobile_record_store.h2
-rw-r--r--src/mongo/db/storage/mobile/mobile_recovery_unit.cpp2
-rw-r--r--src/mongo/db/storage/mobile/mobile_recovery_unit.h2
-rw-r--r--src/mongo/db/storage/mobile/mobile_session_pool.h2
-rw-r--r--src/mongo/db/storage/mobile/mobile_sqlite_statement.cpp2
-rw-r--r--src/mongo/db/storage/mobile/mobile_sqlite_statement.h2
-rw-r--r--src/mongo/db/storage/storage_options.h4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h6
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h6
-rw-r--r--src/mongo/db/transaction_coordinator_driver.h2
-rw-r--r--src/mongo/db/transaction_participant.h2
-rw-r--r--src/mongo/db/views/view_catalog.h2
-rw-r--r--src/mongo/dbtests/plan_ranking.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_multiplan.cpp2
-rw-r--r--src/mongo/dbtests/threadedtests.cpp10
-rw-r--r--src/mongo/executor/connection_pool_tl.cpp2
-rw-r--r--src/mongo/executor/connection_pool_tl.h2
-rw-r--r--src/mongo/executor/network_interface_tl.h4
-rw-r--r--src/mongo/executor/remote_command_request.cpp2
-rw-r--r--src/mongo/executor/task_executor_pool.h2
-rw-r--r--src/mongo/executor/thread_pool_task_executor.cpp2
-rw-r--r--src/mongo/idl/server_parameter_with_storage.h2
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.cpp8
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.h4
-rw-r--r--src/mongo/idl/server_parameter_with_storage_test.idl2
-rw-r--r--src/mongo/logger/component_message_log_domain.h2
-rw-r--r--src/mongo/logger/log_component_settings.h4
-rw-r--r--src/mongo/logger/log_component_settings_test.cpp2
-rw-r--r--src/mongo/platform/atomic_word.h8
-rw-r--r--src/mongo/platform/atomic_word_test.cpp24
-rw-r--r--src/mongo/rpc/op_msg.cpp2
-rw-r--r--src/mongo/rpc/op_msg.h2
-rw-r--r--src/mongo/s/balancer_configuration.h4
-rw-r--r--src/mongo/s/catalog_cache.h14
-rw-r--r--src/mongo/s/chunk_manager.cpp2
-rw-r--r--src/mongo/s/chunk_writes_tracker.h2
-rw-r--r--src/mongo/s/commands/cluster_map_reduce_cmd.cpp2
-rw-r--r--src/mongo/s/grid.h2
-rw-r--r--src/mongo/s/query/cluster_query_knobs.h6
-rw-r--r--src/mongo/scripting/engine.cpp2
-rw-r--r--src/mongo/scripting/engine.h2
-rw-r--r--src/mongo/shell/bench.h4
-rw-r--r--src/mongo/shell/dbshell.cpp2
-rw-r--r--src/mongo/stdx/condition_variable.h2
-rw-r--r--src/mongo/transport/message_compressor_base.h8
-rw-r--r--src/mongo/transport/service_executor_adaptive_test.cpp2
-rw-r--r--src/mongo/transport/service_executor_reserved.h4
-rw-r--r--src/mongo/transport/service_executor_synchronous.h2
-rw-r--r--src/mongo/transport/session.cpp2
-rw-r--r--src/mongo/transport/transport_layer_asio.cpp2
-rw-r--r--src/mongo/util/assert_util.cpp2
-rw-r--r--src/mongo/util/assert_util.h12
-rw-r--r--src/mongo/util/background_thread_clock_source.h4
-rw-r--r--src/mongo/util/concurrency/thread_name.cpp2
-rw-r--r--src/mongo/util/concurrency/thread_pool.cpp2
-rw-r--r--src/mongo/util/concurrency/ticketholder.h4
-rw-r--r--src/mongo/util/debug_util.h2
-rw-r--r--src/mongo/util/exit.cpp2
-rw-r--r--src/mongo/util/fail_point.cpp2
-rw-r--r--src/mongo/util/fail_point.h6
-rw-r--r--src/mongo/util/intrusive_counter.h2
-rw-r--r--src/mongo/util/invalidating_lru_cache_test.cpp2
-rw-r--r--src/mongo/util/net/ssl_manager.h10
-rw-r--r--src/mongo/util/net/ssl_options.cpp8
-rw-r--r--src/mongo/util/net/ssl_options.h8
-rw-r--r--src/mongo/util/net/ssl_parameters.cpp3
-rw-r--r--src/mongo/util/shared_buffer.h4
136 files changed, 316 insertions, 319 deletions
diff --git a/src/mongo/base/counter.h b/src/mongo/base/counter.h
index c7ada029928..c26f4444b6a 100644
--- a/src/mongo/base/counter.h
+++ b/src/mongo/base/counter.h
@@ -64,6 +64,6 @@ public:
}
private:
- AtomicInt64 _counter;
+ AtomicWord<long long> _counter;
};
} // namespace mongo
diff --git a/src/mongo/base/status-inl.h b/src/mongo/base/status-inl.h
index 48204488eb4..b106456fa77 100644
--- a/src/mongo/base/status-inl.h
+++ b/src/mongo/base/status-inl.h
@@ -74,7 +74,7 @@ inline std::string Status::codeString() const {
return ErrorCodes::errorString(code());
}
-inline AtomicUInt32::WordType Status::refCount() const {
+inline unsigned Status::refCount() const {
return _error ? _error->refs.load() : 0;
}
diff --git a/src/mongo/base/status.h b/src/mongo/base/status.h
index 04792f49396..be00e68997e 100644
--- a/src/mongo/base/status.h
+++ b/src/mongo/base/status.h
@@ -227,7 +227,7 @@ public:
// Below interface used for testing code only.
//
- inline AtomicUInt32::WordType refCount() const;
+ inline unsigned refCount() const;
private:
// Private since it could result in a type mismatch between code and extraInfo.
@@ -237,7 +237,7 @@ private:
inline Status();
struct ErrorInfo {
- AtomicUInt32 refs; // reference counter
+ AtomicWord<unsigned> refs; // reference counter
const ErrorCodes::Error code; // error code
const std::string reason; // description of error cause
const std::shared_ptr<const ErrorExtraInfo> extra;
diff --git a/src/mongo/bson/oid.cpp b/src/mongo/bson/oid.cpp
index b309f59639c..b55f818b729 100644
--- a/src/mongo/bson/oid.cpp
+++ b/src/mongo/bson/oid.cpp
@@ -36,6 +36,7 @@
#include <boost/functional/hash.hpp>
#include <limits>
+#include <memory>
#include "mongo/base/init.h"
#include "mongo/bson/bsonobjbuilder.h"
@@ -46,7 +47,7 @@
namespace mongo {
namespace {
-std::unique_ptr<AtomicUInt32> counter;
+std::unique_ptr<AtomicWord<int64_t>> counter;
const std::size_t kTimestampOffset = 0;
const std::size_t kInstanceUniqueOffset = kTimestampOffset + OID::kTimestampSize;
@@ -57,7 +58,7 @@ OID::InstanceUnique _instanceUnique;
MONGO_INITIALIZER_GENERAL(OIDGeneration, MONGO_NO_PREREQUISITES, ("default"))
(InitializerContext* context) {
std::unique_ptr<SecureRandom> entropy(SecureRandom::create());
- counter.reset(new AtomicUInt32(uint32_t(entropy->nextInt64())));
+ counter = std::make_unique<AtomicWord<int64_t>>(entropy->nextInt64());
_instanceUnique = OID::InstanceUnique::generate(*entropy);
return Status::OK();
}
diff --git a/src/mongo/client/connpool.cpp b/src/mongo/client/connpool.cpp
index 56b6a85edfc..230ea33e049 100644
--- a/src/mongo/client/connpool.cpp
+++ b/src/mongo/client/connpool.cpp
@@ -674,7 +674,7 @@ void ScopedDbConnection::clearPool() {
globalConnPool.clear();
}
-AtomicInt32 AScopedConnection::_numConnections;
+AtomicWord<int> AScopedConnection::_numConnections;
MONGO_INITIALIZER(SetupDBClientBaseWithConnection)(InitializerContext*) {
DBClientBase::withConnection_do_not_use = [](std::string host,
diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h
index c10cf59c9b8..bea0d840029 100644
--- a/src/mongo/client/connpool.h
+++ b/src/mongo/client/connpool.h
@@ -441,7 +441,7 @@ public:
}
private:
- static AtomicInt32 _numConnections;
+ static AtomicWord<int> _numConnections;
};
/** Use to get a connection from the pool. On exceptions things
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index b74f1fe9ec1..bd94e397811 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -101,7 +101,7 @@ SSLManagerInterface* sslManager() {
} // namespace
-AtomicInt64 DBClientBase::ConnectionIdSequence;
+AtomicWord<long long> DBClientBase::ConnectionIdSequence;
void (*DBClientBase::withConnection_do_not_use)(std::string host,
std::function<void(DBClientBase*)>) = nullptr;
diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h
index 6f0458e95ee..f8aa0a41ff6 100644
--- a/src/mongo/client/dbclient_base.h
+++ b/src/mongo/client/dbclient_base.h
@@ -710,7 +710,7 @@ protected:
/** controls how chatty the client is about network errors & such. See log.h */
const logger::LogSeverity _logLevel;
- static AtomicInt64 ConnectionIdSequence;
+ static AtomicWord<long long> ConnectionIdSequence;
long long _connectionId; // unique connection id for this connection
private:
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp
index c494e7b6d51..51940bd819a 100644
--- a/src/mongo/client/dbclient_connection.cpp
+++ b/src/mongo/client/dbclient_connection.cpp
@@ -666,6 +666,6 @@ void DBClientConnection::handleNotMasterResponse(const BSONObj& replyBody,
_markFailed(kSetFlag);
}
-AtomicInt32 DBClientConnection::_numConnections;
+AtomicWord<int> DBClientConnection::_numConnections;
} // namespace mongo
diff --git a/src/mongo/client/dbclient_connection.h b/src/mongo/client/dbclient_connection.h
index ddadf5c0230..d7d58150257 100644
--- a/src/mongo/client/dbclient_connection.h
+++ b/src/mongo/client/dbclient_connection.h
@@ -301,8 +301,8 @@ protected:
uint64_t _sessionCreationMicros = INVALID_SOCK_CREATION_TIME;
Date_t _lastConnectivityCheck;
- AtomicBool _stayFailed{false};
- AtomicBool _failed{false};
+ AtomicWord<bool> _stayFailed{false};
+ AtomicWord<bool> _failed{false};
const bool autoReconnect;
Backoff autoReconnectBackoff;
@@ -315,7 +315,7 @@ protected:
bool _internalAuthOnReconnect = false;
std::map<std::string, BSONObj> authCache;
- static AtomicInt32 _numConnections;
+ static AtomicWord<int> _numConnections;
private:
/**
diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp
index d78adff5a50..41c59fa9800 100644
--- a/src/mongo/client/replica_set_monitor.cpp
+++ b/src/mongo/client/replica_set_monitor.cpp
@@ -94,7 +94,7 @@ const int64_t unknownLatency = numeric_limits<int64_t>::max();
const ReadPreferenceSetting kPrimaryOnlyReadPreference(ReadPreference::PrimaryOnly, TagSet());
const Milliseconds kExpeditedRefreshPeriod(500);
-AtomicBool areRefreshRetriesDisabledForTest{false}; // Only true in tests.
+AtomicWord<bool> areRefreshRetriesDisabledForTest{false}; // Only true in tests.
// TODO: Move to ReplicaSetMonitorManager
ReplicaSetMonitor::ConfigChangeHook asyncConfigChangeHook;
diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h
index 669e3de777e..ecfe03388a5 100644
--- a/src/mongo/client/replica_set_monitor.h
+++ b/src/mongo/client/replica_set_monitor.h
@@ -295,7 +295,7 @@ private:
executor::TaskExecutor::CallbackHandle _refresherHandle;
const SetStatePtr _state;
- AtomicBool _isRemovedFromManager{false};
+ AtomicWord<bool> _isRemovedFromManager{false};
};
diff --git a/src/mongo/db/auth/authorization_manager_impl.h b/src/mongo/db/auth/authorization_manager_impl.h
index a734a1301b8..c3e68183c25 100644
--- a/src/mongo/db/auth/authorization_manager_impl.h
+++ b/src/mongo/db/auth/authorization_manager_impl.h
@@ -203,7 +203,7 @@ private:
/**
* A cache of whether there are any users set up for the cluster.
*/
- AtomicBool _privilegeDocsExist;
+ AtomicWord<bool> _privilegeDocsExist;
std::unique_ptr<AuthzManagerExternalState> _externalState;
@@ -256,7 +256,7 @@ private:
*/
stdx::condition_variable _fetchPhaseIsReady;
- AtomicBool _inUserManagementCommand{false};
+ AtomicWord<bool> _inUserManagementCommand{false};
};
extern int authorizationManagerCacheSize;
diff --git a/src/mongo/db/auth/sasl_options.cpp b/src/mongo/db/auth/sasl_options.cpp
index 8a8597304b3..ab6152d7556 100644
--- a/src/mongo/db/auth/sasl_options.cpp
+++ b/src/mongo/db/auth/sasl_options.cpp
@@ -210,7 +210,7 @@ ExportedServerParameter<std::string, ServerParameterType::kStartupOnly> SASLAuth
class ExportedScramIterationCountParameter
: public ExportedServerParameter<int, ServerParameterType::kStartupAndRuntime> {
public:
- ExportedScramIterationCountParameter(StringData name, AtomicInt32* value, int minimum)
+ ExportedScramIterationCountParameter(StringData name, AtomicWord<int>* value, int minimum)
: ExportedServerParameter<int, ServerParameterType::kStartupAndRuntime>(
ServerParameterSet::getGlobal(), name.toString(), value),
_minimum(minimum) {}
diff --git a/src/mongo/db/auth/sasl_options.h b/src/mongo/db/auth/sasl_options.h
index c88da92b615..b9df88e04cf 100644
--- a/src/mongo/db/auth/sasl_options.h
+++ b/src/mongo/db/auth/sasl_options.h
@@ -51,9 +51,9 @@ struct SASLGlobalParams {
std::string hostName;
std::string serviceName;
std::string authdPath;
- AtomicInt32 scramSHA1IterationCount;
- AtomicInt32 scramSHA256IterationCount;
- AtomicInt32 authFailedDelay;
+ AtomicWord<int> scramSHA1IterationCount;
+ AtomicWord<int> scramSHA256IterationCount;
+ AtomicWord<int> authFailedDelay;
SASLGlobalParams();
};
diff --git a/src/mongo/db/auth/user.h b/src/mongo/db/auth/user.h
index c77b3e551df..c96a03ed5c4 100644
--- a/src/mongo/db/auth/user.h
+++ b/src/mongo/db/auth/user.h
@@ -252,7 +252,7 @@ private:
RestrictionDocuments _restrictions;
// Indicates whether the user has been marked as invalid by the AuthorizationManager.
- AtomicBool _isValid{true};
+ AtomicWord<bool> _isValid{true};
};
using UserHandle = std::shared_ptr<User>;
diff --git a/src/mongo/db/auth/user_cache_invalidator_job_parameters.idl b/src/mongo/db/auth/user_cache_invalidator_job_parameters.idl
index 3f662facedb..19a37d19d5f 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job_parameters.idl
+++ b/src/mongo/db/auth/user_cache_invalidator_job_parameters.idl
@@ -40,7 +40,7 @@ server_parameters:
checks to determine whether the in-memory cache of user objects has stale data, and if so,
clears the cache. If there are no changes to user objects, mongos will not clear the cache.
cpp_varname: userCacheInvalidationIntervalSecs
- cpp_vartype: AtomicInt32
+ cpp_vartype: AtomicWord<int>
set_at:
- startup
- runtime
diff --git a/src/mongo/db/catalog/multi_index_block.idl b/src/mongo/db/catalog/multi_index_block.idl
index 14c5e3bf696..3d1d4a145d7 100644
--- a/src/mongo/db/catalog/multi_index_block.idl
+++ b/src/mongo/db/catalog/multi_index_block.idl
@@ -39,7 +39,7 @@ server_parameters:
- runtime
- startup
cpp_varname: useReadOnceCursorsForIndexBuilds
- cpp_vartype: AtomicBool
+ cpp_vartype: AtomicWord<bool>
default: true
maxIndexBuildMemoryUsageMegabytes:
@@ -48,7 +48,7 @@ server_parameters:
- runtime
- startup
cpp_varname: maxIndexBuildMemoryUsageMegabytes
- cpp_vartype: AtomicInt32
+ cpp_vartype: AtomicWord<int>
default: 500
validator:
gte: 100
diff --git a/src/mongo/db/catalog/util/partitioned_test.cpp b/src/mongo/db/catalog/util/partitioned_test.cpp
index f7eb220f37c..1bffbf7c201 100644
--- a/src/mongo/db/catalog/util/partitioned_test.cpp
+++ b/src/mongo/db/catalog/util/partitioned_test.cpp
@@ -235,7 +235,7 @@ TEST(PartitionedConcurrency, ShouldProtectConcurrentAccesses) {
std::vector<stdx::thread> threads;
const size_t opsPerThread = 1000;
- AtomicUInt32 ready{0};
+ AtomicWord<unsigned> ready{0};
for (size_t threadId = 1; threadId <= numThreads; ++threadId) {
auto workerThreadBody = [&, threadId, opsPerThread]() {
diff --git a/src/mongo/db/collection_index_usage_tracker.h b/src/mongo/db/collection_index_usage_tracker.h
index c5d15769f5f..6a784ec8bd7 100644
--- a/src/mongo/db/collection_index_usage_tracker.h
+++ b/src/mongo/db/collection_index_usage_tracker.h
@@ -70,7 +70,7 @@ public:
}
// Number of operations that have used this index.
- AtomicInt64 accesses;
+ AtomicWord<long long> accesses;
// Date/Time that we started tracking index usage.
Date_t trackerStartTime;
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index a5008110e29..23c7261d18d 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -165,7 +165,7 @@ void assertCollectionNotNull(const NamespaceString& nss, AutoT& autoT) {
} // namespace
-AtomicUInt32 Config::JOB_NUMBER;
+AtomicWord<unsigned> Config::JOB_NUMBER;
JSFunction::JSFunction(const std::string& type, const BSONElement& e) {
_type = type;
diff --git a/src/mongo/db/commands/mr.h b/src/mongo/db/commands/mr.h
index 20c5bec2173..13fd4a43cd6 100644
--- a/src/mongo/db/commands/mr.h
+++ b/src/mongo/db/commands/mr.h
@@ -250,7 +250,7 @@ public:
// if the output collection is sharded, we must be told what UUID to use for it
boost::optional<UUID> finalOutputCollUUID;
- static AtomicUInt32 JOB_NUMBER;
+ static AtomicWord<unsigned> JOB_NUMBER;
}; // end MRsetup
/**
diff --git a/src/mongo/db/concurrency/d_concurrency_test.cpp b/src/mongo/db/concurrency/d_concurrency_test.cpp
index b3604fe8f55..8723904ba81 100644
--- a/src/mongo/db/concurrency/d_concurrency_test.cpp
+++ b/src/mongo/db/concurrency/d_concurrency_test.cpp
@@ -188,7 +188,7 @@ TEST_F(DConcurrencyTestFixture, ResourceMutex) {
void waitFor(int n) {
waitFor([this, n]() { return this->step.load() == n; });
}
- AtomicInt32 step{0};
+ AtomicWord<int> step{0};
} state;
stdx::thread t1([&]() {
@@ -1127,7 +1127,7 @@ TEST_F(DConcurrencyTestFixture, Stress) {
std::vector<std::pair<ServiceContext::UniqueClient, ServiceContext::UniqueOperationContext>>
clients = makeKClientsWithLockers(kMaxStressThreads);
- AtomicInt32 ready{0};
+ AtomicWord<int> ready{0};
std::vector<stdx::thread> threads;
@@ -1251,7 +1251,7 @@ TEST_F(DConcurrencyTestFixture, StressPartitioned) {
std::vector<std::pair<ServiceContext::UniqueClient, ServiceContext::UniqueOperationContext>>
clients = makeKClientsWithLockers(kMaxStressThreads);
- AtomicInt32 ready{0};
+ AtomicWord<int> ready{0};
std::vector<stdx::thread> threads;
for (int threadId = 0; threadId < kMaxStressThreads; threadId++) {
@@ -1753,8 +1753,8 @@ TEST_F(DConcurrencyTestFixture, CompatibleFirstWithXSXIXIS) {
TEST_F(DConcurrencyTestFixture, CompatibleFirstStress) {
int numThreads = 8;
int testMicros = 500'000;
- AtomicUInt64 readOnlyInterval{0};
- AtomicBool done{false};
+ AtomicWord<unsigned long long> readOnlyInterval{0};
+ AtomicWord<bool> done{false};
std::vector<uint64_t> acquisitionCount(numThreads);
std::vector<uint64_t> timeoutCount(numThreads);
std::vector<uint64_t> busyWaitCount(numThreads);
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index 8b3c8cf7abc..8ffbee8c523 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -112,7 +112,7 @@ const ResourceId resourceIdGlobal = ResourceId(RESOURCE_GLOBAL, ResourceId::SING
const Milliseconds MaxWaitTime = Milliseconds(500);
// Dispenses unique LockerId identifiers
-AtomicUInt64 idCounter(0);
+AtomicWord<unsigned long long> idCounter(0);
// Partitioned global lock statistics, so we don't hit the same bucket
PartitionedInstanceWideLockStats globalStats;
diff --git a/src/mongo/db/concurrency/lock_stats.cpp b/src/mongo/db/concurrency/lock_stats.cpp
index b4e1105c081..8a3410fc6ef 100644
--- a/src/mongo/db/concurrency/lock_stats.cpp
+++ b/src/mongo/db/concurrency/lock_stats.cpp
@@ -131,8 +131,8 @@ void LockStats<CounterType>::reset() {
}
-// Ensures that there are instances compiled for LockStats for AtomicInt64 and int64_t
+// Ensures that there are instances compiled for LockStats for AtomicWord<long long> and int64_t
template class LockStats<int64_t>;
-template class LockStats<AtomicInt64>;
+template class LockStats<AtomicWord<long long>>;
} // namespace mongo
diff --git a/src/mongo/db/concurrency/lock_stats.h b/src/mongo/db/concurrency/lock_stats.h
index 6add6cfefa6..188b92565d2 100644
--- a/src/mongo/db/concurrency/lock_stats.h
+++ b/src/mongo/db/concurrency/lock_stats.h
@@ -46,7 +46,7 @@ struct CounterOps {
return counter;
}
- static int64_t get(const AtomicInt64& counter) {
+ static int64_t get(const AtomicWord<long long>& counter) {
return counter.load();
}
@@ -54,7 +54,7 @@ struct CounterOps {
counter = value;
}
- static void set(AtomicInt64& counter, int64_t value) {
+ static void set(AtomicWord<long long>& counter, int64_t value) {
counter.store(value);
}
@@ -62,11 +62,11 @@ struct CounterOps {
counter += value;
}
- static void add(int64_t& counter, const AtomicInt64& value) {
+ static void add(int64_t& counter, const AtomicWord<long long>& value) {
counter += value.load();
}
- static void add(AtomicInt64& counter, int64_t value) {
+ static void add(AtomicWord<long long>& counter, int64_t value) {
counter.addAndFetch(value);
}
};
@@ -208,7 +208,7 @@ private:
};
typedef LockStats<int64_t> SingleThreadedLockStats;
-typedef LockStats<AtomicInt64> AtomicLockStats;
+typedef LockStats<AtomicWord<long long>> AtomicLockStats;
/**
diff --git a/src/mongo/db/concurrency/write_conflict_exception.cpp b/src/mongo/db/concurrency/write_conflict_exception.cpp
index 7be5003291f..3885f6491f5 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.cpp
+++ b/src/mongo/db/concurrency/write_conflict_exception.cpp
@@ -40,7 +40,7 @@
namespace mongo {
-AtomicBool WriteConflictException::trace(false);
+AtomicWord<bool> WriteConflictException::trace(false);
WriteConflictException::WriteConflictException()
: DBException(Status(ErrorCodes::WriteConflict, "WriteConflict")) {
diff --git a/src/mongo/db/concurrency/write_conflict_exception.h b/src/mongo/db/concurrency/write_conflict_exception.h
index 9e8c4c4fcbf..e0844cb7ae7 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.h
+++ b/src/mongo/db/concurrency/write_conflict_exception.h
@@ -61,7 +61,7 @@ public:
* If true, will call printStackTrace on every WriteConflictException created.
* Can be set via setParameter named traceWriteConflictExceptions.
*/
- static AtomicBool trace;
+ static AtomicWord<bool> trace;
private:
void defineOnlyInFinalSubclassToPreventSlicing() final {}
diff --git a/src/mongo/db/free_mon/free_mon_controller_test.cpp b/src/mongo/db/free_mon/free_mon_controller_test.cpp
index e6e3ad70b28..bb1b7ff410d 100644
--- a/src/mongo/db/free_mon/free_mon_controller_test.cpp
+++ b/src/mongo/db/free_mon/free_mon_controller_test.cpp
@@ -364,8 +364,8 @@ public:
private:
- AtomicInt32 _registers;
- AtomicInt32 _metrics;
+ AtomicWord<int> _registers;
+ AtomicWord<int> _metrics;
executor::ThreadPoolTaskExecutor* _threadPool;
diff --git a/src/mongo/db/ftdc/ftdc_server.h b/src/mongo/db/ftdc/ftdc_server.h
index 265c47dfd54..1d121e0c705 100644
--- a/src/mongo/db/ftdc/ftdc_server.h
+++ b/src/mongo/db/ftdc/ftdc_server.h
@@ -105,13 +105,13 @@ private:
* Used to provide default values from FTDCConfig to the FTDC set parameters.
*/
struct FTDCStartupParams {
- AtomicBool enabled;
- AtomicInt32 periodMillis;
+ AtomicWord<bool> enabled;
+ AtomicWord<int> periodMillis;
- AtomicInt32 maxDirectorySizeMB;
- AtomicInt32 maxFileSizeMB;
- AtomicInt32 maxSamplesPerArchiveMetricChunk;
- AtomicInt32 maxSamplesPerInterimMetricChunk;
+ AtomicWord<int> maxDirectorySizeMB;
+ AtomicWord<int> maxFileSizeMB;
+ AtomicWord<int> maxSamplesPerArchiveMetricChunk;
+ AtomicWord<int> maxSamplesPerInterimMetricChunk;
FTDCStartupParams()
: enabled(FTDCConfig::kEnabledDefault),
diff --git a/src/mongo/db/index/duplicate_key_tracker.h b/src/mongo/db/index/duplicate_key_tracker.h
index e72b1595f86..d8047a7001d 100644
--- a/src/mongo/db/index/duplicate_key_tracker.h
+++ b/src/mongo/db/index/duplicate_key_tracker.h
@@ -75,7 +75,7 @@ public:
private:
const IndexCatalogEntry* _indexCatalogEntry;
- AtomicInt64 _duplicateCounter{0};
+ AtomicWord<long long> _duplicateCounter{0};
// This temporary record store is owned by the duplicate key tracker and dropped along with it.
std::unique_ptr<TemporaryRecordStore> _keyConstraintsTable;
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index 6a9c4a52d58..081bb8a2ed2 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -821,7 +821,7 @@ SortedDataInterface* AbstractIndexAccessMethod::getSortedDataInterface() const {
* places, rather than compiled in one place and linked, and so cannot provide a globally unique ID.
*/
std::string nextFileName() {
- static AtomicUInt32 indexAccessMethodFileCounter;
+ static AtomicWord<unsigned> indexAccessMethodFileCounter;
return "extsort-index." + std::to_string(indexAccessMethodFileCounter.fetchAndAdd(1));
}
diff --git a/src/mongo/db/index/index_build_interceptor.h b/src/mongo/db/index/index_build_interceptor.h
index 4dccc8d698c..fbfb8c298d2 100644
--- a/src/mongo/db/index/index_build_interceptor.h
+++ b/src/mongo/db/index/index_build_interceptor.h
@@ -127,7 +127,7 @@ private:
int64_t _numApplied{0};
- AtomicInt64 _sideWritesCounter{0};
+ AtomicWord<long long> _sideWritesCounter{0};
mutable stdx::mutex _multikeyPathMutex;
boost::optional<MultikeyPaths> _multikeyPaths;
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp
index a3b6fcfe019..75ada6a3b5f 100644
--- a/src/mongo/db/index_builder.cpp
+++ b/src/mongo/db/index_builder.cpp
@@ -55,7 +55,7 @@ namespace mongo {
using std::endl;
-AtomicUInt32 IndexBuilder::_indexBuildCount;
+AtomicWord<unsigned> IndexBuilder::_indexBuildCount;
namespace {
diff --git a/src/mongo/db/index_builder.h b/src/mongo/db/index_builder.h
index 4e11c2ad9ca..0f41d2af579 100644
--- a/src/mongo/db/index_builder.h
+++ b/src/mongo/db/index_builder.h
@@ -112,6 +112,6 @@ private:
const ReplicatedWrites _replicatedWrites;
const Timestamp _initIndexTs;
std::string _name; // name of this builder, not related to the index
- static AtomicUInt32 _indexBuildCount;
+ static AtomicWord<unsigned> _indexBuildCount;
};
}
diff --git a/src/mongo/db/logical_session_cache.cpp b/src/mongo/db/logical_session_cache.cpp
index 00c82fc936a..25d52406aa2 100644
--- a/src/mongo/db/logical_session_cache.cpp
+++ b/src/mongo/db/logical_session_cache.cpp
@@ -41,7 +41,8 @@ namespace {
const auto getLogicalSessionCache =
ServiceContext::declareDecoration<std::unique_ptr<LogicalSessionCache>>();
-const auto getLogicalSessionCacheIsRegistered = ServiceContext::declareDecoration<AtomicBool>();
+const auto getLogicalSessionCacheIsRegistered =
+ ServiceContext::declareDecoration<AtomicWord<bool>>();
} // namespace
LogicalSessionCache::~LogicalSessionCache() = default;
diff --git a/src/mongo/db/pipeline/document_source_bucket_auto.cpp b/src/mongo/db/pipeline/document_source_bucket_auto.cpp
index 7251d3cc2ef..ae724be941c 100644
--- a/src/mongo/db/pipeline/document_source_bucket_auto.cpp
+++ b/src/mongo/db/pipeline/document_source_bucket_auto.cpp
@@ -77,7 +77,7 @@ boost::intrusive_ptr<Expression> parseGroupByExpression(
* places, rather than compiled in one place and linked, and so cannot provide a globally unique ID.
*/
std::string nextFileName() {
- static AtomicUInt32 documentSourceBucketAutoFileCounter;
+ static AtomicWord<unsigned> documentSourceBucketAutoFileCounter;
return "extsort-doc-bucket." +
std::to_string(documentSourceBucketAutoFileCounter.fetchAndAdd(1));
}
diff --git a/src/mongo/db/pipeline/document_source_group.cpp b/src/mongo/db/pipeline/document_source_group.cpp
index 440c6c10ee9..318a67df1ff 100644
--- a/src/mongo/db/pipeline/document_source_group.cpp
+++ b/src/mongo/db/pipeline/document_source_group.cpp
@@ -59,7 +59,7 @@ namespace {
* places, rather than compiled in one place and linked, and so cannot provide a globally unique ID.
*/
std::string nextFileName() {
- static AtomicUInt32 documentSourceGroupFileCounter;
+ static AtomicWord<unsigned> documentSourceGroupFileCounter;
return "extsort-doc-group." + std::to_string(documentSourceGroupFileCounter.fetchAndAdd(1));
}
diff --git a/src/mongo/db/pipeline/document_source_out_replace_coll.cpp b/src/mongo/db/pipeline/document_source_out_replace_coll.cpp
index d112672f5ea..5f4be9cbfb8 100644
--- a/src/mongo/db/pipeline/document_source_out_replace_coll.cpp
+++ b/src/mongo/db/pipeline/document_source_out_replace_coll.cpp
@@ -35,7 +35,7 @@
namespace mongo {
-static AtomicUInt32 aggOutCounter;
+static AtomicWord<unsigned> aggOutCounter;
void DocumentSourceOutReplaceColl::initializeWriteNs() {
LocalReadConcernBlock readLocal(pExpCtx->opCtx);
diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp
index 6ba8c9e8e78..475897471ed 100644
--- a/src/mongo/db/pipeline/document_source_sort.cpp
+++ b/src/mongo/db/pipeline/document_source_sort.cpp
@@ -107,7 +107,7 @@ Value deserializeSortKey(size_t sortPatternSize, BSONObj bsonSortKey) {
* places, rather than compiled in one place and linked, and so cannot provide a globally unique ID.
*/
std::string nextFileName() {
- static AtomicUInt32 documentSourceSortFileCounter;
+ static AtomicWord<unsigned> documentSourceSortFileCounter;
return "extsort-doc-source-sort." +
std::to_string(documentSourceSortFileCounter.fetchAndAdd(1));
}
diff --git a/src/mongo/db/query/expression_index_knobs.h b/src/mongo/db/query/expression_index_knobs.h
index 15ad7117da8..4245e97c0d4 100644
--- a/src/mongo/db/query/expression_index_knobs.h
+++ b/src/mongo/db/query/expression_index_knobs.h
@@ -41,24 +41,24 @@ namespace mongo {
/**
* The maximum number of cells to use for 2D geo query covering for predicate queries
*/
-extern AtomicInt32 internalGeoPredicateQuery2DMaxCoveringCells;
+extern AtomicWord<int> internalGeoPredicateQuery2DMaxCoveringCells;
/**
* The maximum number of cells to use for 2D geo query covering for predicate queries
*/
-extern AtomicInt32 internalGeoNearQuery2DMaxCoveringCells;
+extern AtomicWord<int> internalGeoNearQuery2DMaxCoveringCells;
//
// Geo query.
//
// What is the finest level we will cover a queried region or geoNear annulus?
-extern AtomicInt32 internalQueryS2GeoFinestLevel;
+extern AtomicWord<int> internalQueryS2GeoFinestLevel;
// What is the coarsest level we will cover a queried region or geoNear annulus?
-extern AtomicInt32 internalQueryS2GeoCoarsestLevel;
+extern AtomicWord<int> internalQueryS2GeoCoarsestLevel;
// What is the maximum cell count that we want? (advisory, not a hard threshold)
-extern AtomicInt32 internalQueryS2GeoMaxCells;
+extern AtomicWord<int> internalQueryS2GeoMaxCells;
} // namespace mongo
diff --git a/src/mongo/db/query/query_knobs.h b/src/mongo/db/query/query_knobs.h
index 3d050f804b1..976bb1a4ec3 100644
--- a/src/mongo/db/query/query_knobs.h
+++ b/src/mongo/db/query/query_knobs.h
@@ -41,34 +41,34 @@ namespace mongo {
// Max number of times we call work() on plans before comparing them,
// for small collections.
-extern AtomicInt32 internalQueryPlanEvaluationWorks;
+extern AtomicWord<int> internalQueryPlanEvaluationWorks;
// For large collections, the number times we work() candidate plans is
// taken as this fraction of the collection size.
extern AtomicDouble internalQueryPlanEvaluationCollFraction;
// Stop working plans once a plan returns this many results.
-extern AtomicInt32 internalQueryPlanEvaluationMaxResults;
+extern AtomicWord<int> internalQueryPlanEvaluationMaxResults;
// Do we give a big ranking bonus to intersection plans?
-extern AtomicBool internalQueryForceIntersectionPlans;
+extern AtomicWord<bool> internalQueryForceIntersectionPlans;
// Do we have ixisect on at all?
-extern AtomicBool internalQueryPlannerEnableIndexIntersection;
+extern AtomicWord<bool> internalQueryPlannerEnableIndexIntersection;
// Do we use hash-based intersection for rooted $and queries?
-extern AtomicBool internalQueryPlannerEnableHashIntersection;
+extern AtomicWord<bool> internalQueryPlannerEnableHashIntersection;
//
// plan cache
//
// How many entries in the cache?
-extern AtomicInt32 internalQueryCacheSize;
+extern AtomicWord<int> internalQueryCacheSize;
// How many feedback entries do we collect before possibly evicting from the cache based on bad
// performance?
-extern AtomicInt32 internalQueryCacheFeedbacksStored;
+extern AtomicWord<int> internalQueryCacheFeedbacksStored;
// How many times more works must we perform in order to justify plan cache eviction
// and replanning?
@@ -79,66 +79,66 @@ extern AtomicDouble internalQueryCacheEvictionRatio;
extern AtomicDouble internalQueryCacheWorksGrowthCoefficient;
// Whether or not cache entries can be marked as "inactive."
-extern AtomicBool internalQueryCacheDisableInactiveEntries;
+extern AtomicWord<bool> internalQueryCacheDisableInactiveEntries;
// Whether or not planCacheListPlans uses the new output format.
-extern AtomicBool internalQueryCacheListPlansNewOutput;
+extern AtomicWord<bool> internalQueryCacheListPlansNewOutput;
//
// Planning and enumeration.
//
// How many indexed solutions will QueryPlanner::plan output?
-extern AtomicInt32 internalQueryPlannerMaxIndexedSolutions;
+extern AtomicWord<int> internalQueryPlannerMaxIndexedSolutions;
// How many solutions will the enumerator consider at each OR?
-extern AtomicInt32 internalQueryEnumerationMaxOrSolutions;
+extern AtomicWord<int> internalQueryEnumerationMaxOrSolutions;
// How many intersections will the enumerator consider at each AND?
-extern AtomicInt32 internalQueryEnumerationMaxIntersectPerAnd;
+extern AtomicWord<int> internalQueryEnumerationMaxIntersectPerAnd;
// Do we want to plan each child of the OR independently?
-extern AtomicBool internalQueryPlanOrChildrenIndependently;
+extern AtomicWord<bool> internalQueryPlanOrChildrenIndependently;
// How many index scans are we willing to produce in order to obtain a sort order
// during explodeForSort?
-extern AtomicInt32 internalQueryMaxScansToExplode;
+extern AtomicWord<int> internalQueryMaxScansToExplode;
// Allow the planner to generate covered whole index scans, rather than falling back to a COLLSCAN.
-extern AtomicBool internalQueryPlannerGenerateCoveredWholeIndexScans;
+extern AtomicWord<bool> internalQueryPlannerGenerateCoveredWholeIndexScans;
// Ignore unknown JSON Schema keywords.
-extern AtomicBool internalQueryIgnoreUnknownJSONSchemaKeywords;
+extern AtomicWord<bool> internalQueryIgnoreUnknownJSONSchemaKeywords;
//
// Query execution.
//
-extern AtomicInt32 internalQueryExecMaxBlockingSortBytes;
+extern AtomicWord<int> internalQueryExecMaxBlockingSortBytes;
// Yield after this many "should yield?" checks.
-extern AtomicInt32 internalQueryExecYieldIterations;
+extern AtomicWord<int> internalQueryExecYieldIterations;
// Yield if it's been at least this many milliseconds since we last yielded.
-extern AtomicInt32 internalQueryExecYieldPeriodMS;
+extern AtomicWord<int> internalQueryExecYieldPeriodMS;
// Limit the size that we write without yielding to 16MB / 64 (max expected number of indexes)
const int64_t insertVectorMaxBytes = 256 * 1024;
// The number of bytes to buffer at once during a $facet stage.
-extern AtomicInt32 internalQueryFacetBufferSizeBytes;
+extern AtomicWord<int> internalQueryFacetBufferSizeBytes;
-extern AtomicInt64 internalDocumentSourceSortMaxBlockingSortBytes;
+extern AtomicWord<long long> internalDocumentSourceSortMaxBlockingSortBytes;
-extern AtomicInt64 internalLookupStageIntermediateDocumentMaxSizeBytes;
+extern AtomicWord<long long> internalLookupStageIntermediateDocumentMaxSizeBytes;
-extern AtomicInt64 internalDocumentSourceGroupMaxMemoryBytes;
+extern AtomicWord<long long> internalDocumentSourceGroupMaxMemoryBytes;
-extern AtomicInt32 internalInsertMaxBatchSize;
+extern AtomicWord<int> internalInsertMaxBatchSize;
-extern AtomicInt32 internalDocumentSourceCursorBatchSizeBytes;
+extern AtomicWord<int> internalDocumentSourceCursorBatchSizeBytes;
-extern AtomicInt32 internalDocumentSourceLookupCacheSizeBytes;
+extern AtomicWord<int> internalDocumentSourceLookupCacheSizeBytes;
-extern AtomicBool internalQueryProhibitBlockingMergeOnMongoS;
+extern AtomicWord<bool> internalQueryProhibitBlockingMergeOnMongoS;
} // namespace mongo
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp
index 28d3266ca82..07173344dee 100644
--- a/src/mongo/db/repl/initial_syncer.cpp
+++ b/src/mongo/db/repl/initial_syncer.cpp
@@ -174,7 +174,7 @@ StatusWith<OpTimeWithHash> parseOpTimeWithHash(const QueryResponseStatus& fetchR
*/
class InitialSyncApplyObserver : public OplogApplier::Observer {
public:
- explicit InitialSyncApplyObserver(AtomicUInt32* fetchCount) : _fetchCount(fetchCount) {}
+ explicit InitialSyncApplyObserver(AtomicWord<unsigned>* fetchCount) : _fetchCount(fetchCount) {}
// OplogApplier::Observer functions
void onBatchBegin(const OplogApplier::Operations&) final {}
@@ -184,7 +184,7 @@ public:
}
private:
- AtomicUInt32* const _fetchCount;
+ AtomicWord<unsigned>* const _fetchCount;
};
} // namespace
diff --git a/src/mongo/db/repl/initial_syncer.h b/src/mongo/db/repl/initial_syncer.h
index 929643116c5..308fdb6adaf 100644
--- a/src/mongo/db/repl/initial_syncer.h
+++ b/src/mongo/db/repl/initial_syncer.h
@@ -568,7 +568,7 @@ private:
void _shutdownComponent_inlock(Component& component);
// Counts how many documents have been refetched from the source in the current batch.
- AtomicUInt32 _fetchCount;
+ AtomicWord<unsigned> _fetchCount;
//
// All member variables are labeled with one of the following codes indicating the
diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h
index 4e29959f1df..765e4559c13 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.h
+++ b/src/mongo/db/repl/replication_coordinator_impl.h
@@ -594,7 +594,7 @@ private:
// during rollback. In order to read it, must have the RSTL. To set it when transitioning
// into RS_ROLLBACK, must have the RSTL in mode X. Otherwise, no lock or mutex is necessary
// to set it.
- AtomicUInt32 _canServeNonLocalReads;
+ AtomicWord<unsigned> _canServeNonLocalReads;
};
void _resetMyLastOpTimes(WithLock lk);
@@ -1256,7 +1256,7 @@ private:
_initialSyncer; // (I) pointer set under mutex, copied by callers.
// Hands out the next snapshot name.
- AtomicUInt64 _snapshotNameGenerator; // (S)
+ AtomicWord<unsigned long long> _snapshotNameGenerator; // (S)
// The OpTimes and SnapshotNames for all snapshots newer than the current commit point, kept in
// sorted order. Any time this is changed, you must also update _uncommitedSnapshotsSize.
@@ -1264,7 +1264,7 @@ private:
// A cache of the size of _uncommittedSnaphots that can be read without any locking.
// May only be written to while holding _mutex.
- AtomicUInt64 _uncommittedSnapshotsSize; // (I)
+ AtomicWord<unsigned long long> _uncommittedSnapshotsSize; // (I)
// The non-null OpTime and SnapshotName of the current snapshot used for committed reads, if
// there is one.
@@ -1317,7 +1317,7 @@ private:
int _earliestMemberId = -1; // (M)
// Cached copy of the current config protocol version.
- AtomicInt64 _protVersion{1}; // (S)
+ AtomicWord<long long> _protVersion{1}; // (S)
// Source of random numbers used in setting election timeouts, etc.
PseudoRandom _random; // (M)
@@ -1330,7 +1330,7 @@ private:
// function.
// This variable must be written immediately after _term, and thus its value can lag.
// Reading this value does not require the replication coordinator mutex to be locked.
- AtomicInt64 _termShadow; // (S)
+ AtomicWord<long long> _termShadow; // (S)
// When we decide to step down due to hearing about a higher term, we remember the term we heard
// here so we can update our term to match as part of finishing stepdown.
diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h
index a17da59ead1..72d2508ce36 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_mock.h
@@ -289,7 +289,7 @@ public:
virtual bool setContainsArbiter() const override;
private:
- AtomicUInt64 _snapshotNameGenerator;
+ AtomicWord<unsigned long long> _snapshotNameGenerator;
ServiceContext* const _service;
ReplSettings _settings;
StorageInterface* _storage = nullptr;
diff --git a/src/mongo/db/retryable_writes_stats.h b/src/mongo/db/retryable_writes_stats.h
index 9bd027f7444..cece6da39ae 100644
--- a/src/mongo/db/retryable_writes_stats.h
+++ b/src/mongo/db/retryable_writes_stats.h
@@ -63,14 +63,14 @@ public:
private:
// The number of received commands that contained a statement that had already been executed.
- AtomicUInt64 _retriedCommandsCount{0};
+ AtomicWord<unsigned long long> _retriedCommandsCount{0};
// The number of received statements found to have been previously executed.
- AtomicUInt64 _retriedStatementsCount{0};
+ AtomicWord<unsigned long long> _retriedStatementsCount{0};
// The number of writes to the config.transactions collection. Includes writes initiated by a
// migration.
- AtomicUInt64 _transactionsCollectionWriteCount{0};
+ AtomicWord<unsigned long long> _transactionsCollectionWriteCount{0};
};
} // namespace mongo
diff --git a/src/mongo/db/s/collection_range_deleter.h b/src/mongo/db/s/collection_range_deleter.h
index f6b9f161a47..88f157338a6 100644
--- a/src/mongo/db/s/collection_range_deleter.h
+++ b/src/mongo/db/s/collection_range_deleter.h
@@ -49,11 +49,11 @@ class OperationContext;
// secondaryThrottle and rangeDeleterBatchDelayMS apply between each batch.
// Must be positive or 0 (the default), which means to use the value of
// internalQueryExecYieldIterations (or 1 if that's negative or zero).
-extern AtomicInt32 rangeDeleterBatchSize;
+extern AtomicWord<int> rangeDeleterBatchSize;
// After completing a batch of document deletions, the time in millis to wait before commencing the
// next batch of deletions.
-extern AtomicInt32 rangeDeleterBatchDelayMS;
+extern AtomicWord<int> rangeDeleterBatchDelayMS;
class CollectionRangeDeleter {
MONGO_DISALLOW_COPYING(CollectionRangeDeleter);
diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp
index 038c2447c06..38a55e6f195 100644
--- a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp
+++ b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp
@@ -56,7 +56,7 @@ using CollectionAndChangedChunks = CatalogCacheLoader::CollectionAndChangedChunk
namespace {
-AtomicUInt64 taskIdGenerator{0};
+AtomicWord<unsigned long long> taskIdGenerator{0};
/**
* Constructs the options for the loader thread pool.
diff --git a/src/mongo/db/s/sharding_logging.h b/src/mongo/db/s/sharding_logging.h
index 3407809d9a4..30c60d5b8bd 100644
--- a/src/mongo/db/s/sharding_logging.h
+++ b/src/mongo/db/s/sharding_logging.h
@@ -101,10 +101,10 @@ private:
// (S) Self-synchronizing; access in any way from any context.
// Whether the logAction call should attempt to create the actionlog collection
- AtomicInt32 _actionLogCollectionCreated{0}; // (S)
+ AtomicWord<int> _actionLogCollectionCreated{0}; // (S)
// Whether the logChange call should attempt to create the changelog collection
- AtomicInt32 _changeLogCollectionCreated{0}; // (S)
+ AtomicWord<int> _changeLogCollectionCreated{0}; // (S)
};
} // namespace mongo
diff --git a/src/mongo/db/s/sharding_state.h b/src/mongo/db/s/sharding_state.h
index fb220c9aaea..11b042a2cc9 100644
--- a/src/mongo/db/s/sharding_state.h
+++ b/src/mongo/db/s/sharding_state.h
@@ -146,7 +146,7 @@ private:
stdx::mutex _mutex;
// State of the initialization of the sharding state along with any potential errors
- AtomicUInt32 _initializationState{static_cast<uint32_t>(InitializationState::kNew)};
+ AtomicWord<unsigned> _initializationState{static_cast<uint32_t>(InitializationState::kNew)};
// Sets the shard name for this host (comes through setShardVersion)
ShardId _shardId;
diff --git a/src/mongo/db/s/sharding_statistics.h b/src/mongo/db/s/sharding_statistics.h
index d6dee68c607..8154a67d7a8 100644
--- a/src/mongo/db/s/sharding_statistics.h
+++ b/src/mongo/db/s/sharding_statistics.h
@@ -44,40 +44,40 @@ class ServiceContext;
struct ShardingStatistics {
// Counts how many times threads hit stale config exception (which is what triggers metadata
// refreshes).
- AtomicInt64 countStaleConfigErrors{0};
+ AtomicWord<long long> countStaleConfigErrors{0};
// Cumulative, always-increasing counter of how many chunks this node has started to donate
// (whether they succeeded or not).
- AtomicInt64 countDonorMoveChunkStarted{0};
+ AtomicWord<long long> countDonorMoveChunkStarted{0};
// Cumulative, always-increasing counter of how much time the entire move chunk operation took
// (excluding range deletion).
- AtomicInt64 totalDonorMoveChunkTimeMillis{0};
+ AtomicWord<long long> totalDonorMoveChunkTimeMillis{0};
// Cumulative, always-increasing counter of how much time the clone phase took on the donor
// node, before it was appropriate to enter the critical section.
- AtomicInt64 totalDonorChunkCloneTimeMillis{0};
+ AtomicWord<long long> totalDonorChunkCloneTimeMillis{0};
// Cumulative, always-increasing counter of how many documents have been cloned on the
// recipient node.
- AtomicInt64 countDocsClonedOnRecipient{0};
+ AtomicWord<long long> countDocsClonedOnRecipient{0};
// Cumulative, always-increasing counter of how many documents have been cloned on the donor
// node.
- AtomicInt64 countDocsClonedOnDonor{0};
+ AtomicWord<long long> countDocsClonedOnDonor{0};
// Cumulative, always-increasing counter of how many documents have been deleted on the donor
// node by the rangeDeleter.
- AtomicInt64 countDocsDeletedOnDonor{0};
+ AtomicWord<long long> countDocsDeletedOnDonor{0};
// Cumulative, always-increasing counter of how many chunks this node started to receive
// (whether the receiving succeeded or not)
- AtomicInt64 countRecipientMoveChunkStarted{0};
+ AtomicWord<long long> countRecipientMoveChunkStarted{0};
// Cumulative, always-increasing counter of how much time the critical section's commit phase
// took (this is the period of time when all operations on the collection are blocked, not just
// the reads)
- AtomicInt64 totalCriticalSectionCommitTimeMillis{0};
+ AtomicWord<long long> totalCriticalSectionCommitTimeMillis{0};
// Cumulative, always-increasing counter of how much time the entire critical section took. It
// includes the time the recipient took to fetch the latest modifications from the donor and
@@ -86,7 +86,7 @@ struct ShardingStatistics {
// The value of totalCriticalSectionTimeMillis - totalCriticalSectionCommitTimeMillis gives the
// duration of the catch-up phase of the critical section (where the last mods are transferred
// from the donor to the recipient).
- AtomicInt64 totalCriticalSectionTimeMillis{0};
+ AtomicWord<long long> totalCriticalSectionTimeMillis{0};
/**
* Obtains the per-process instance of the sharding statistics object.
diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h
index 5a0d7ce18c0..de76672f6e0 100644
--- a/src/mongo/db/server_options.h
+++ b/src/mongo/db/server_options.h
@@ -61,7 +61,7 @@ struct ServerGlobalParams {
bool indexBuildRetry = true; // --noIndexBuildRetry
- AtomicBool quiet{false}; // --quiet
+ AtomicWord<bool> quiet{false}; // --quiet
ClusterRole clusterRole = ClusterRole::None; // --configsvr/--shardsvr
@@ -121,8 +121,8 @@ struct ServerGlobalParams {
AuthState authState = AuthState::kUndefined;
- bool transitionToAuth = false; // --transitionToAuth, mixed mode for rolling auth upgrade
- AtomicInt32 clusterAuthMode; // --clusterAuthMode, the internal cluster auth mode
+ bool transitionToAuth = false; // --transitionToAuth, mixed mode for rolling auth upgrade
+ AtomicWord<int> clusterAuthMode; // --clusterAuthMode, the internal cluster auth mode
enum ClusterAuthModes {
ClusterAuthMode_undefined,
diff --git a/src/mongo/db/server_parameters_test.cpp b/src/mongo/db/server_parameters_test.cpp
index 88fc191ab90..34d0d8e8b36 100644
--- a/src/mongo/db/server_parameters_test.cpp
+++ b/src/mongo/db/server_parameters_test.cpp
@@ -202,7 +202,7 @@ TEST(ServerParameters, boundIntLock) {
}
TEST(ServerParameters, Simple1) {
- AtomicInt32 f(5);
+ AtomicWord<int> f(5);
ExportedServerParameter<int, ServerParameterType::kStartupAndRuntime> ff(NULL, "ff", &f);
ASSERT_EQUALS("ff", ff.name());
@@ -247,7 +247,7 @@ TEST(ServerParameters, Vector1) {
}
TEST(ServerParameters, Validators) {
- AtomicInt32 myVal(0);
+ AtomicWord<int> myVal(0);
ExportedServerParameter<int, ServerParameterType::kRuntimeOnly> myParam(
nullptr, "myVal", &myVal);
myParam.withValidator([](const int& newVal) {
diff --git a/src/mongo/db/server_transactions_metrics.h b/src/mongo/db/server_transactions_metrics.h
index 4f46e9ff03b..e0979dd6d67 100644
--- a/src/mongo/db/server_transactions_metrics.h
+++ b/src/mongo/db/server_transactions_metrics.h
@@ -174,34 +174,34 @@ private:
mutable stdx::mutex _mutex;
// The number of multi-document transactions currently active.
- AtomicUInt64 _currentActive{0};
+ AtomicWord<unsigned long long> _currentActive{0};
// The number of multi-document transactions currently inactive.
- AtomicUInt64 _currentInactive{0};
+ AtomicWord<unsigned long long> _currentInactive{0};
// The total number of open transactions.
- AtomicUInt64 _currentOpen{0};
+ AtomicWord<unsigned long long> _currentOpen{0};
// The total number of multi-document transactions started since the last server startup.
- AtomicUInt64 _totalStarted{0};
+ AtomicWord<unsigned long long> _totalStarted{0};
// The total number of multi-document transaction aborts.
- AtomicUInt64 _totalAborted{0};
+ AtomicWord<unsigned long long> _totalAborted{0};
// The total number of multi-document transaction commits.
- AtomicUInt64 _totalCommitted{0};
+ AtomicWord<unsigned long long> _totalCommitted{0};
// The total number of prepared transactions since the last server startup.
- AtomicUInt64 _totalPrepared{0};
+ AtomicWord<unsigned long long> _totalPrepared{0};
// The total number of prepared transaction commits.
- AtomicUInt64 _totalPreparedThenCommitted{0};
+ AtomicWord<unsigned long long> _totalPreparedThenCommitted{0};
// The total number of prepared transaction aborts.
- AtomicUInt64 _totalPreparedThenAborted{0};
+ AtomicWord<unsigned long long> _totalPreparedThenAborted{0};
// The current number of transactions in the prepared state.
- AtomicUInt64 _currentPrepared{0};
+ AtomicWord<unsigned long long> _currentPrepared{0};
// The optime of the oldest oplog entry for any active transaction.
boost::optional<repl::OpTime> _oldestActiveOplogEntryOpTime; // (M)
diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h
index 97b4de476c1..32f2351444c 100644
--- a/src/mongo/db/service_context.h
+++ b/src/mongo/db/service_context.h
@@ -583,7 +583,7 @@ private:
std::vector<KillOpListenerInterface*> _killOpListeners;
// Counter for assigning operation ids.
- AtomicUInt32 _nextOpId{1};
+ AtomicWord<unsigned> _nextOpId{1};
bool _startupComplete = false;
stdx::condition_variable _startupCompleteCondVar;
diff --git a/src/mongo/db/snapshot_window_options.h b/src/mongo/db/snapshot_window_options.h
index 6944e78e18f..5ede44532ee 100644
--- a/src/mongo/db/snapshot_window_options.h
+++ b/src/mongo/db/snapshot_window_options.h
@@ -49,7 +49,7 @@ struct SnapshotWindowParams {
//
// Note that the window size can become greater than this if an ongoing operation is holding an
// older snapshot open.
- AtomicInt32 maxTargetSnapshotHistoryWindowInSeconds{5};
+ AtomicWord<int> maxTargetSnapshotHistoryWindowInSeconds{5};
// targetSnapshotHistoryWindowInSeconds (not a server parameter, range 0+).
//
@@ -60,7 +60,7 @@ struct SnapshotWindowParams {
// not always reflect it: the window can only change as more writes come in, so it can take time
// for the actual window size to catch up with a change. This value guides actions whenever the
// system goes to update the oldest_timestamp value.
- AtomicInt32 targetSnapshotHistoryWindowInSeconds{
+ AtomicWord<int> targetSnapshotHistoryWindowInSeconds{
maxTargetSnapshotHistoryWindowInSeconds.load()};
// cachePressureThreshold (startup & runtime server paramter, range [0, 100]).
@@ -70,7 +70,7 @@ struct SnapshotWindowParams {
// targetSnapshotHistoryWindowInSeconds will be ignored when the cache pressure reaches this
// threshold. Additionally, a periodic task will decrease targetSnapshotHistoryWindowInSeconds
// when cache pressure exceeds the threshold.
- AtomicInt32 cachePressureThreshold{50};
+ AtomicWord<int> cachePressureThreshold{50};
// snapshotWindowMultiplicativeDecrease (startup & runtime server paramter, range (0,1)).
//
@@ -83,7 +83,7 @@ struct SnapshotWindowParams {
// Controls by how much the target snapshot history window setting is increased when cache
// pressure is OK, per cachePressureThreshold, and we need to service older snapshots for global
// point-in-time reads.
- AtomicInt32 snapshotWindowAdditiveIncreaseSeconds{2};
+ AtomicWord<int> snapshotWindowAdditiveIncreaseSeconds{2};
// minMillisBetweenSnapshotWindowInc (startup & runtime server paramter, range 0+).
// minMillisBetweenSnapshotWindowDec (startup & runtime server paramter, range 0+).
@@ -93,8 +93,8 @@ struct SnapshotWindowParams {
// as one. This protects the system because it takes time for the target snapshot window to
// affect the actual storage engine snapshot window. The stable timestamp must move forward for
// the window between it and oldest timestamp to grow or shrink.
- AtomicInt32 minMillisBetweenSnapshotWindowInc{500};
- AtomicInt32 minMillisBetweenSnapshotWindowDec{500};
+ AtomicWord<int> minMillisBetweenSnapshotWindowInc{500};
+ AtomicWord<int> minMillisBetweenSnapshotWindowDec{500};
// checkCachePressurePeriodSeconds (startup & runtime server paramter, range 1+)
//
@@ -102,7 +102,7 @@ struct SnapshotWindowParams {
// targetSnapshotHistoryWindowInSeconds if the pressure is above cachePressureThreshold. The
// target window size setting must not be decreased too fast because time must be allowed for
// the storage engine to attempt to act on the new setting.
- AtomicInt32 checkCachePressurePeriodSeconds{5};
+ AtomicWord<int> checkCachePressurePeriodSeconds{5};
};
extern SnapshotWindowParams snapshotWindowParams;
diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp
index a154912ecce..b11a8abf637 100644
--- a/src/mongo/db/sorter/sorter_test.cpp
+++ b/src/mongo/db/sorter/sorter_test.cpp
@@ -59,7 +59,7 @@ namespace mongo {
* places, rather than compiled in one place and linked, and so cannot provide a globally unique ID.
*/
std::string nextFileName() {
- static AtomicUInt32 sorterTestFileCounter;
+ static AtomicWord<unsigned> sorterTestFileCounter;
return "extsort-sorter-test." + std::to_string(sorterTestFileCounter.fetchAndAdd(1));
}
diff --git a/src/mongo/db/stats/counters.cpp b/src/mongo/db/stats/counters.cpp
index 0355fa8787b..406385b28c9 100644
--- a/src/mongo/db/stats/counters.cpp
+++ b/src/mongo/db/stats/counters.cpp
@@ -68,8 +68,8 @@ void OpCounters::gotOp(int op, bool isCommand) {
}
}
-void OpCounters::_checkWrap(CacheAligned<AtomicInt64> OpCounters::*counter, int n) {
- static constexpr auto maxCount = AtomicInt64::WordType{1} << 60;
+void OpCounters::_checkWrap(CacheAligned<AtomicWord<long long>> OpCounters::*counter, int n) {
+ static constexpr auto maxCount = 1LL << 60;
auto oldValue = (this->*counter).fetchAndAddRelaxed(n);
if (oldValue > maxCount) {
_insert.store(0);
diff --git a/src/mongo/db/stats/counters.h b/src/mongo/db/stats/counters.h
index 4d6a057e427..699dbb43b12 100644
--- a/src/mongo/db/stats/counters.h
+++ b/src/mongo/db/stats/counters.h
@@ -76,35 +76,35 @@ public:
BSONObj getObj() const;
// thse are used by snmp, and other things, do not remove
- const AtomicInt64* getInsert() const {
+ const AtomicWord<long long>* getInsert() const {
return &_insert;
}
- const AtomicInt64* getQuery() const {
+ const AtomicWord<long long>* getQuery() const {
return &_query;
}
- const AtomicInt64* getUpdate() const {
+ const AtomicWord<long long>* getUpdate() const {
return &_update;
}
- const AtomicInt64* getDelete() const {
+ const AtomicWord<long long>* getDelete() const {
return &_delete;
}
- const AtomicInt64* getGetMore() const {
+ const AtomicWord<long long>* getGetMore() const {
return &_getmore;
}
- const AtomicInt64* getCommand() const {
+ const AtomicWord<long long>* getCommand() const {
return &_command;
}
private:
// Increment member `counter` by `n`, resetting all counters if it was > 2^60.
- void _checkWrap(CacheAligned<AtomicInt64> OpCounters::*counter, int n);
-
- CacheAligned<AtomicInt64> _insert;
- CacheAligned<AtomicInt64> _query;
- CacheAligned<AtomicInt64> _update;
- CacheAligned<AtomicInt64> _delete;
- CacheAligned<AtomicInt64> _getmore;
- CacheAligned<AtomicInt64> _command;
+ void _checkWrap(CacheAligned<AtomicWord<long long>> OpCounters::*counter, int n);
+
+ CacheAligned<AtomicWord<long long>> _insert;
+ CacheAligned<AtomicWord<long long>> _query;
+ CacheAligned<AtomicWord<long long>> _update;
+ CacheAligned<AtomicWord<long long>> _delete;
+ CacheAligned<AtomicWord<long long>> _getmore;
+ CacheAligned<AtomicWord<long long>> _command;
};
extern OpCounters globalOpCounters;
@@ -124,20 +124,20 @@ public:
void append(BSONObjBuilder& b);
private:
- CacheAligned<AtomicInt64> _physicalBytesIn{0};
- CacheAligned<AtomicInt64> _physicalBytesOut{0};
+ CacheAligned<AtomicWord<long long>> _physicalBytesIn{0};
+ CacheAligned<AtomicWord<long long>> _physicalBytesOut{0};
// These two counters are always incremented at the same time, so
// we place them on the same cache line.
struct Together {
- AtomicInt64 logicalBytesIn{0};
- AtomicInt64 requests{0};
+ AtomicWord<long long> logicalBytesIn{0};
+ AtomicWord<long long> requests{0};
};
CacheAligned<Together> _together{};
static_assert(sizeof(decltype(_together)) <= stdx::hardware_constructive_interference_size,
"cache line spill");
- CacheAligned<AtomicInt64> _logicalBytesOut{0};
+ CacheAligned<AtomicWord<long long>> _logicalBytesOut{0};
};
extern NetworkCounter networkCounter;
diff --git a/src/mongo/db/stats/timer_stats.h b/src/mongo/db/stats/timer_stats.h
index f1153f90ba5..31cbfeba9cb 100644
--- a/src/mongo/db/stats/timer_stats.h
+++ b/src/mongo/db/stats/timer_stats.h
@@ -58,8 +58,8 @@ public:
}
private:
- AtomicInt64 _num;
- AtomicInt64 _totalMillis;
+ AtomicWord<long long> _num;
+ AtomicWord<long long> _totalMillis;
};
/**
diff --git a/src/mongo/db/storage/biggie/biggie_record_store.h b/src/mongo/db/storage/biggie/biggie_record_store.h
index cfbaf67e8eb..ccdd5bc28b3 100644
--- a/src/mongo/db/storage/biggie/biggie_record_store.h
+++ b/src/mongo/db/storage/biggie/biggie_record_store.h
@@ -141,8 +141,8 @@ private:
mutable stdx::mutex _cappedDeleterMutex;
- AtomicInt64 _highest_record_id{1};
- AtomicInt64 _numRecords{0};
+ AtomicWord<long long> _highest_record_id{1};
+ AtomicWord<long long> _numRecords{0};
std::string generateKey(const uint8_t* key, size_t key_len) const;
bool _isOplog;
diff --git a/src/mongo/db/storage/kv/kv_catalog.h b/src/mongo/db/storage/kv/kv_catalog.h
index fe670d3795a..05eff5ed241 100644
--- a/src/mongo/db/storage/kv/kv_catalog.h
+++ b/src/mongo/db/storage/kv/kv_catalog.h
@@ -143,7 +143,7 @@ private:
// These two are only used for ident generation inside _newUniqueIdent.
std::string _rand; // effectively const after init() returns
- AtomicUInt64 _next;
+ AtomicWord<unsigned long long> _next;
struct Entry {
Entry() {}
diff --git a/src/mongo/db/storage/mobile/mobile_record_store.h b/src/mongo/db/storage/mobile/mobile_record_store.h
index 0c31e35cd13..efab31d1c6d 100644
--- a/src/mongo/db/storage/mobile/mobile_record_store.h
+++ b/src/mongo/db/storage/mobile/mobile_record_store.h
@@ -163,7 +163,7 @@ private:
const std::string _path;
const std::string _ident;
- AtomicInt64 _nextIdNum;
+ AtomicWord<long long> _nextIdNum;
/**
* Fetches the number of records from the database. _numRecsMutex should be locked before this
diff --git a/src/mongo/db/storage/mobile/mobile_recovery_unit.cpp b/src/mongo/db/storage/mobile/mobile_recovery_unit.cpp
index cc169d956d8..97f30ccbcb7 100644
--- a/src/mongo/db/storage/mobile/mobile_recovery_unit.cpp
+++ b/src/mongo/db/storage/mobile/mobile_recovery_unit.cpp
@@ -46,7 +46,7 @@
namespace mongo {
-AtomicInt64 MobileRecoveryUnit::_nextID(0);
+AtomicWord<long long> MobileRecoveryUnit::_nextID(0);
MobileRecoveryUnit::MobileRecoveryUnit(MobileSessionPool* sessionPool)
: _inUnitOfWork(false), _active(false), _isReadOnly(true), _sessionPool(sessionPool) {
diff --git a/src/mongo/db/storage/mobile/mobile_recovery_unit.h b/src/mongo/db/storage/mobile/mobile_recovery_unit.h
index 982c0c70139..93620fe876c 100644
--- a/src/mongo/db/storage/mobile/mobile_recovery_unit.h
+++ b/src/mongo/db/storage/mobile/mobile_recovery_unit.h
@@ -99,7 +99,7 @@ private:
bool _inUnitOfWork;
bool _active;
- static AtomicInt64 _nextID;
+ static AtomicWord<long long> _nextID;
uint64_t _id;
bool _isReadOnly;
diff --git a/src/mongo/db/storage/mobile/mobile_session_pool.h b/src/mongo/db/storage/mobile/mobile_session_pool.h
index 2c9b0595de9..1c57ee45f63 100644
--- a/src/mongo/db/storage/mobile/mobile_session_pool.h
+++ b/src/mongo/db/storage/mobile/mobile_session_pool.h
@@ -57,7 +57,7 @@ public:
bool isEmpty();
private:
- AtomicBool _isEmpty;
+ AtomicWord<bool> _isEmpty;
stdx::mutex _queueMutex;
std::queue<std::string> _opQueryQueue;
};
diff --git a/src/mongo/db/storage/mobile/mobile_sqlite_statement.cpp b/src/mongo/db/storage/mobile/mobile_sqlite_statement.cpp
index 0b26d25e1e7..c0ebcfa6f9f 100644
--- a/src/mongo/db/storage/mobile/mobile_sqlite_statement.cpp
+++ b/src/mongo/db/storage/mobile/mobile_sqlite_statement.cpp
@@ -46,7 +46,7 @@
namespace mongo {
-AtomicInt64 SqliteStatement::_nextID(0);
+AtomicWord<long long> SqliteStatement::_nextID(0);
SqliteStatement::SqliteStatement(const MobileSession& session, const std::string& sqlQuery) {
// Increment the global instance count and assign this instance an id.
diff --git a/src/mongo/db/storage/mobile/mobile_sqlite_statement.h b/src/mongo/db/storage/mobile/mobile_sqlite_statement.h
index 719bc49a895..87996927902 100644
--- a/src/mongo/db/storage/mobile/mobile_sqlite_statement.h
+++ b/src/mongo/db/storage/mobile/mobile_sqlite_statement.h
@@ -131,7 +131,7 @@ public:
uint64_t _id;
private:
- static AtomicInt64 _nextID;
+ static AtomicWord<long long> _nextID;
sqlite3_stmt* _stmt;
std::string _sqlQuery;
diff --git a/src/mongo/db/storage/storage_options.h b/src/mongo/db/storage/storage_options.h
index de4bac61aa5..d2486a66858 100644
--- a/src/mongo/db/storage/storage_options.h
+++ b/src/mongo/db/storage/storage_options.h
@@ -79,11 +79,11 @@ struct StorageGlobalParams {
// --journalCommitInterval
static const int kMaxJournalCommitIntervalMs;
- AtomicInt32 journalCommitIntervalMs;
+ AtomicWord<int> journalCommitIntervalMs;
// --notablescan
// no table scans allowed
- AtomicBool noTableScan;
+ AtomicWord<bool> noTableScan;
// --directoryperdb
// Stores each database’s files in its own folder in the data directory.
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index a3c62668e37..97b2f052ed3 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -209,7 +209,7 @@ public:
private:
WiredTigerSessionCache* _sessionCache;
- AtomicBool _shuttingDown{false};
+ AtomicWord<bool> _shuttingDown{false};
};
class WiredTigerKVEngine::WiredTigerCheckpointThread : public BackgroundJob {
@@ -373,7 +373,7 @@ private:
// taking checkpoints. It can be triggered early to expediate immediate checkpointing.
stdx::condition_variable _condvar;
- AtomicBool _shuttingDown{false};
+ AtomicWord<bool> _shuttingDown{false};
bool _hasTriggeredFirstStableCheckpoint = false;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h
index ef5980de8d1..3a84c939dfc 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_oplog_manager.h
@@ -104,6 +104,6 @@ private:
// journal flushing should not be delayed.
std::int64_t _opsWaitingForVisibility = 0; // Guarded by oplogVisibilityStateMutex.
- AtomicUInt64 _oplogReadTimestamp;
+ AtomicWord<unsigned long long> _oplogReadTimestamp;
};
} // namespace mongo
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
index 9cc17eb0b00..cc3ae0cefb9 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h
@@ -349,8 +349,8 @@ private:
const int64_t _cappedMaxSizeSlack; // when to start applying backpressure
const int64_t _cappedMaxDocs;
RecordId _cappedFirstRecord;
- AtomicInt64 _cappedSleep;
- AtomicInt64 _cappedSleepMS;
+ AtomicWord<long long> _cappedSleep;
+ AtomicWord<long long> _cappedSleepMS;
CappedCallback* _cappedCallback;
bool _shuttingDown;
mutable stdx::mutex _cappedCallbackMutex; // guards _cappedCallback and _shuttingDown
@@ -359,7 +359,7 @@ private:
int _cappedDeleteCheckCount;
mutable stdx::timed_mutex _cappedDeleterMutex;
- AtomicInt64 _nextIdNum;
+ AtomicWord<long long> _nextIdNum;
WiredTigerSizeStorer* _sizeStorer; // not owned, can be NULL
std::shared_ptr<WiredTigerSizeStorer::SizeInfo> _sizeInfo;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
index 600b92836ec..612b964240f 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
@@ -141,8 +141,8 @@ private:
// deque of oplog stones.
int64_t _minBytesPerStone;
- AtomicInt64 _currentRecords; // Number of records in the stone being filled.
- AtomicInt64 _currentBytes; // Number of bytes in the stone being filled.
+ AtomicWord<long long> _currentRecords; // Number of records in the stone being filled.
+ AtomicWord<long long> _currentBytes; // Number of bytes in the stone being filled.
mutable stdx::mutex _mutex; // Protects against concurrent access to the deque of oplog stones.
std::deque<OplogStones::Stone> _stones; // front = oldest, back = newest.
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
index b2a4949f5db..e65b027686e 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
@@ -58,7 +58,7 @@ MONGO_FAIL_POINT_DEFINE(WTAlwaysNotifyPrepareConflictWaiters);
// SnapshotIds need to be globally unique, as they are used in a WorkingSetMember to
// determine if documents changed, but a different recovery unit may be used across a getMore,
// so there is a chance the snapshot ID will be reused.
-AtomicUInt64 nextSnapshotId{1};
+AtomicWord<unsigned long long> nextSnapshotId{1};
logger::LogSeverity kSlowTransactionSeverity = logger::LogSeverity::Debug(1);
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
index 3cbdb0a075e..9c0fe8078ba 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp
@@ -76,7 +76,7 @@ namespace mongo {
// will be cached in WiredTiger. Exclusive operations should only be blocked
// for a short time, except if a cursor is held by a long running session. This
// is a good compromise for most workloads.
-AtomicInt32 kWiredTigerCursorCacheSize(-100);
+AtomicWord<int> kWiredTigerCursorCacheSize(-100);
const std::string kWTRepairMsg =
"Please read the documentation for starting MongoDB with --repair here: "
@@ -216,7 +216,7 @@ void WiredTigerSession::closeCursorsForQueuedDrops(WiredTigerKVEngine* engine) {
}
namespace {
-AtomicUInt64 nextTableId(1);
+AtomicWord<unsigned long long> nextTableId(1);
}
// static
uint64_t WiredTigerSession::genTableId() {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h
index 1d91d28f799..7a87cef036e 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.h
@@ -293,7 +293,7 @@ private:
// Used as follows:
// The low 31 bits are a count of active calls to releaseSession.
// The high bit is a flag that is set if and only if we're shutting down.
- AtomicUInt32 _shuttingDown;
+ AtomicWord<unsigned> _shuttingDown;
static const uint32_t kShuttingDownMask = 1 << 31;
stdx::mutex _cacheLock;
@@ -301,13 +301,13 @@ private:
SessionCache _sessions;
// Bumped when all open sessions need to be closed
- AtomicUInt64 _epoch; // atomic so we can check it outside of the lock
+ AtomicWord<unsigned long long> _epoch; // atomic so we can check it outside of the lock
// Bumped when all open cursors need to be closed
- AtomicUInt64 _cursorEpoch; // atomic so we can check it outside of the lock
+ AtomicWord<unsigned long long> _cursorEpoch; // atomic so we can check it outside of the lock
// Counter and critical section mutex for waitUntilDurable
- AtomicUInt32 _lastSyncTime;
+ AtomicWord<unsigned> _lastSyncTime;
stdx::mutex _lastSyncMutex;
// Mutex and cond var for waiting on prepare commit or abort.
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h
index f1ab4655ee4..3ded5e83c92 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.h
@@ -68,12 +68,12 @@ public:
~SizeInfo() {
invariant(!_dirty.load());
}
- AtomicInt64 numRecords;
- AtomicInt64 dataSize;
+ AtomicWord<long long> numRecords;
+ AtomicWord<long long> dataSize;
private:
friend WiredTigerSizeStorer;
- AtomicBool _dirty;
+ AtomicWord<bool> _dirty;
};
WiredTigerSizeStorer(WT_CONNECTION* conn,
diff --git a/src/mongo/db/transaction_coordinator_driver.h b/src/mongo/db/transaction_coordinator_driver.h
index fd6bfca2e8c..df08928efcd 100644
--- a/src/mongo/db/transaction_coordinator_driver.h
+++ b/src/mongo/db/transaction_coordinator_driver.h
@@ -244,7 +244,7 @@ private:
ThreadPool* const _pool;
// TODO (SERVER-38522): Remove once AsyncWorkScheduler is used for cancellation
- AtomicBool _cancelled{false};
+ AtomicWord<bool> _cancelled{false};
};
} // namespace mongo
diff --git a/src/mongo/db/transaction_participant.h b/src/mongo/db/transaction_participant.h
index b8ac97b7e5f..6334090f4a0 100644
--- a/src/mongo/db/transaction_participant.h
+++ b/src/mongo/db/transaction_participant.h
@@ -56,7 +56,7 @@ namespace mongo {
class OperationContext;
-extern AtomicInt32 transactionLifetimeLimitSeconds;
+extern AtomicWord<int> transactionLifetimeLimitSeconds;
/**
* Read timestamp to be used for a speculative transaction. For transactions with read
diff --git a/src/mongo/db/views/view_catalog.h b/src/mongo/db/views/view_catalog.h
index 5a01bda0943..ebede346dd4 100644
--- a/src/mongo/db/views/view_catalog.h
+++ b/src/mongo/db/views/view_catalog.h
@@ -178,7 +178,7 @@ private:
stdx::mutex _mutex; // Protects all members, except for _valid.
ViewMap _viewMap;
DurableViewCatalog* _durable;
- AtomicBool _valid;
+ AtomicWord<bool> _valid;
ViewGraph _viewGraph;
bool _viewGraphNeedsRefresh = true; // Defers initializing the graph until the first insert.
};
diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp
index dfc21c9c204..61b6671976a 100644
--- a/src/mongo/dbtests/plan_ranking.cpp
+++ b/src/mongo/dbtests/plan_ranking.cpp
@@ -57,9 +57,9 @@
namespace mongo {
// How we access the external setParameter testing bool.
-extern AtomicBool internalQueryForceIntersectionPlans;
+extern AtomicWord<bool> internalQueryForceIntersectionPlans;
-extern AtomicBool internalQueryPlannerEnableHashIntersection;
+extern AtomicWord<bool> internalQueryPlannerEnableHashIntersection;
} // namespace mongo
diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp
index 39086b0e082..db4c0de5a32 100644
--- a/src/mongo/dbtests/query_stage_multiplan.cpp
+++ b/src/mongo/dbtests/query_stage_multiplan.cpp
@@ -62,7 +62,7 @@ namespace mongo {
const std::unique_ptr<ClockSource> clockSource = stdx::make_unique<ClockSourceMock>();
// How we access the external setParameter testing bool.
-extern AtomicBool internalQueryForceIntersectionPlans;
+extern AtomicWord<bool> internalQueryForceIntersectionPlans;
namespace {
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index 31c7bf26bc9..d8bcde1486e 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -119,7 +119,7 @@ class ThreadPoolTest {
static const unsigned iterations = 10000;
static const unsigned nThreads = 8;
- AtomicUInt32 counter;
+ AtomicWord<unsigned> counter;
void increment(unsigned n) {
for (unsigned i = 0; i < n; i++) {
counter.fetchAndAdd(1);
@@ -177,7 +177,7 @@ private:
char pad2[128];
unsigned locks;
char pad3[128];
- AtomicInt32 k;
+ AtomicWord<int> k;
virtual void validate() {
if (once++ == 0) {
@@ -199,7 +199,7 @@ private:
break;
}
}
- AtomicBool done;
+ AtomicWord<bool> done;
virtual void subthread(int x) {
if (x == 1) {
watch();
@@ -300,8 +300,8 @@ public:
// would have very little slack.
add<Slack<SimpleMutex, stdx::lock_guard<SimpleMutex>>>();
- add<IsAtomicWordAtomic<AtomicUInt32>>();
- add<IsAtomicWordAtomic<AtomicUInt64>>();
+ add<IsAtomicWordAtomic<AtomicWord<unsigned>>>();
+ add<IsAtomicWordAtomic<AtomicWord<unsigned long long>>>();
add<ThreadPoolTest>();
add<TicketHolderWaits>();
diff --git a/src/mongo/executor/connection_pool_tl.cpp b/src/mongo/executor/connection_pool_tl.cpp
index 00d8aeb47ad..344fcac81cc 100644
--- a/src/mongo/executor/connection_pool_tl.cpp
+++ b/src/mongo/executor/connection_pool_tl.cpp
@@ -45,7 +45,7 @@ namespace {
const auto kMaxTimerDuration = Milliseconds::max();
struct TimeoutHandler {
- AtomicBool done;
+ AtomicWord<bool> done;
Promise<void> promise;
explicit TimeoutHandler(Promise<void> p) : promise(std::move(p)) {}
diff --git a/src/mongo/executor/connection_pool_tl.h b/src/mongo/executor/connection_pool_tl.h
index 50e63851dfe..e97dda4c44e 100644
--- a/src/mongo/executor/connection_pool_tl.h
+++ b/src/mongo/executor/connection_pool_tl.h
@@ -71,7 +71,7 @@ private:
std::unique_ptr<NetworkConnectionHook> _onConnectHook;
mutable stdx::mutex _mutex;
- AtomicBool _inShutdown{false};
+ AtomicWord<bool> _inShutdown{false};
stdx::unordered_set<Type*> _collars;
};
diff --git a/src/mongo/executor/network_interface_tl.h b/src/mongo/executor/network_interface_tl.h
index 1dbcc7a7678..0b0c99cd03e 100644
--- a/src/mongo/executor/network_interface_tl.h
+++ b/src/mongo/executor/network_interface_tl.h
@@ -108,7 +108,7 @@ private:
ConnHandle conn;
std::unique_ptr<transport::ReactorTimer> timer;
- AtomicBool done;
+ AtomicWord<bool> done;
Promise<RemoteCommandResponse> promise;
};
@@ -133,7 +133,7 @@ private:
Counters _counters;
std::unique_ptr<rpc::EgressMetadataHook> _metadataHook;
- AtomicBool _inShutdown;
+ AtomicWord<bool> _inShutdown;
stdx::thread _ioThread;
stdx::mutex _inProgressMutex;
diff --git a/src/mongo/executor/remote_command_request.cpp b/src/mongo/executor/remote_command_request.cpp
index fae5dcddcfe..c0fd380745e 100644
--- a/src/mongo/executor/remote_command_request.cpp
+++ b/src/mongo/executor/remote_command_request.cpp
@@ -44,7 +44,7 @@ namespace {
// Used to generate unique identifiers for requests so they can be traced throughout the
// asynchronous networking logs
-AtomicUInt64 requestIdCounter(0);
+AtomicWord<unsigned long long> requestIdCounter(0);
} // namespace
diff --git a/src/mongo/executor/task_executor_pool.h b/src/mongo/executor/task_executor_pool.h
index 4d841fb17c3..b99ff1793c4 100644
--- a/src/mongo/executor/task_executor_pool.h
+++ b/src/mongo/executor/task_executor_pool.h
@@ -114,7 +114,7 @@ public:
void appendConnectionStats(ConnectionPoolStats* stats) const;
private:
- AtomicUInt32 _counter;
+ AtomicWord<unsigned> _counter;
std::vector<std::unique_ptr<TaskExecutor>> _executors;
diff --git a/src/mongo/executor/thread_pool_task_executor.cpp b/src/mongo/executor/thread_pool_task_executor.cpp
index 94e547b87f3..e1732e32348 100644
--- a/src/mongo/executor/thread_pool_task_executor.cpp
+++ b/src/mongo/executor/thread_pool_task_executor.cpp
@@ -93,7 +93,7 @@ public:
// _mutex.
CallbackFn callback;
- AtomicUInt32 canceled{0U};
+ AtomicWord<unsigned> canceled{0U};
WorkQueue::iterator iter;
Date_t readyDate;
bool isNetworkOperation = false;
diff --git a/src/mongo/idl/server_parameter_with_storage.h b/src/mongo/idl/server_parameter_with_storage.h
index 962312e78b4..16fa7d82789 100644
--- a/src/mongo/idl/server_parameter_with_storage.h
+++ b/src/mongo/idl/server_parameter_with_storage.h
@@ -116,7 +116,7 @@ struct LTE {
};
// Wrapped type unwrappers.
-// e.g. Given AtomicInt32, get std::int32_t and normalized store/load methods.
+// e.g. Given AtomicWord<int>, get std::int32_t and normalized store/load methods.
template <typename U>
struct storage_wrapper;
diff --git a/src/mongo/idl/server_parameter_with_storage_test.cpp b/src/mongo/idl/server_parameter_with_storage_test.cpp
index eacbeeb94bd..c813832ef72 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.cpp
+++ b/src/mongo/idl/server_parameter_with_storage_test.cpp
@@ -34,8 +34,8 @@
#include "mongo/unittest/unittest.h"
namespace mongo {
-AtomicInt32 test::gStdIntPreallocated;
-AtomicInt32 test::gStdIntPreallocatedUpdateCount;
+AtomicWord<int> test::gStdIntPreallocated;
+AtomicWord<int> test::gStdIntPreallocatedUpdateCount;
namespace {
@@ -151,8 +151,8 @@ TEST(ServerParameterWithStorage, StorageTest) {
doStorageTestByType<double>("DoubleD", doubleVals, stringVals);
doStorageTestByType<std::string>("String", stringVals, {});
- doStorageTestByAtomic<AtomicBool>("AtomicBool", boolVals, stringVals);
- doStorageTestByAtomic<AtomicInt32>("AtomicInt32", numberVals, stringVals);
+ doStorageTestByAtomic<AtomicWord<bool>>("AtomicWord<bool>", boolVals, stringVals);
+ doStorageTestByAtomic<AtomicWord<int>>("AtomicWord<int>", numberVals, stringVals);
doStorageTestByAtomic<AtomicDouble>("AtomicDoubleI", numberVals, stringVals);
doStorageTestByAtomic<AtomicDouble>("AtomicDoubleD", doubleVals, stringVals);
}
diff --git a/src/mongo/idl/server_parameter_with_storage_test.h b/src/mongo/idl/server_parameter_with_storage_test.h
index 57f12e6aa15..f51547de377 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.h
+++ b/src/mongo/idl/server_parameter_with_storage_test.h
@@ -40,10 +40,10 @@ constexpr std::int32_t kStartupIntWithExpressionsMinimum = 10;
constexpr std::int32_t kStartupIntWithExpressionsMaximum = 1000;
// Storage for set parameter defined in server_parameter_with_storage.idl
-extern AtomicInt32 gStdIntPreallocated;
+extern AtomicWord<int> gStdIntPreallocated;
// Counter for how many times gStdIntPreallocated has been modified.
-extern AtomicInt32 gStdIntPreallocatedUpdateCount;
+extern AtomicWord<int> gStdIntPreallocatedUpdateCount;
/**
* Validates that the proposed new value is odd.
diff --git a/src/mongo/idl/server_parameter_with_storage_test.idl b/src/mongo/idl/server_parameter_with_storage_test.idl
index bc985613bac..f6724464fef 100644
--- a/src/mongo/idl/server_parameter_with_storage_test.idl
+++ b/src/mongo/idl/server_parameter_with_storage_test.idl
@@ -45,7 +45,7 @@ server_parameters:
stdIntDeclared:
set_at: [ startup, runtime ]
description: "Create a simple int value, and declare storage"
- cpp_vartype: AtomicInt32
+ cpp_vartype: AtomicWord<int>
cpp_varname: gStdIntDeclared
default: 42
validator:
diff --git a/src/mongo/logger/component_message_log_domain.h b/src/mongo/logger/component_message_log_domain.h
index e9bfcfd4a64..5aac7b0a412 100644
--- a/src/mongo/logger/component_message_log_domain.h
+++ b/src/mongo/logger/component_message_log_domain.h
@@ -96,7 +96,7 @@ public:
private:
LogComponentSettings _settings;
- AtomicBool _shouldRedact{false};
+ AtomicWord<bool> _shouldRedact{false};
};
} // namespace logger
diff --git a/src/mongo/logger/log_component_settings.h b/src/mongo/logger/log_component_settings.h
index a22f2cb607d..b8afdf18011 100644
--- a/src/mongo/logger/log_component_settings.h
+++ b/src/mongo/logger/log_component_settings.h
@@ -95,12 +95,12 @@ private:
// the same severity as kDefault.
// This is also used to update the severities of unconfigured components when the severity
// for kDefault is modified.
- AtomicBool _hasMinimumLoggedSeverity[LogComponent::kNumLogComponents];
+ AtomicWord<bool> _hasMinimumLoggedSeverity[LogComponent::kNumLogComponents];
// Log severities for components.
// Store numerical values of severities to be cache-line friendly.
// Set to kDefault minimum logged severity if _hasMinimumLoggedSeverity[i] is false.
- AtomicInt32 _minimumLoggedSeverity[LogComponent::kNumLogComponents];
+ AtomicWord<int> _minimumLoggedSeverity[LogComponent::kNumLogComponents];
};
} // namespace logger
diff --git a/src/mongo/logger/log_component_settings_test.cpp b/src/mongo/logger/log_component_settings_test.cpp
index fb1ae233f43..6633e09d5d5 100644
--- a/src/mongo/logger/log_component_settings_test.cpp
+++ b/src/mongo/logger/log_component_settings_test.cpp
@@ -48,7 +48,7 @@ using namespace mongo::logger;
// cause an invariant failure, i.e. that these methods are thread-safe.
TEST(SERVER25981Test, SetSeverityShouldLogAndClear) {
unittest::Barrier startupBarrier(4);
- AtomicBool running(true);
+ AtomicWord<bool> running(true);
stdx::thread shouldLogThread([&]() {
startupBarrier.countDownAndWait();
diff --git a/src/mongo/platform/atomic_word.h b/src/mongo/platform/atomic_word.h
index 5edbe2ae334..be65ae74ab6 100644
--- a/src/mongo/platform/atomic_word.h
+++ b/src/mongo/platform/atomic_word.h
@@ -183,7 +183,7 @@ public:
} // namespace atomic_word_detail
/**
- * Instantiations of AtomicWord must be scalar types.
+ * Instantiations of AtomicWord must be trivially copyable.
*/
template <typename T>
class AtomicWord : public atomic_word_detail::Base<T> {
@@ -193,10 +193,4 @@ public:
using atomic_word_detail::Base<T>::Base;
};
-using AtomicUInt32 = AtomicWord<unsigned>;
-using AtomicUInt64 = AtomicWord<unsigned long long>;
-using AtomicInt32 = AtomicWord<int>;
-using AtomicInt64 = AtomicWord<long long>;
-using AtomicBool = AtomicWord<bool>;
-
} // namespace mongo
diff --git a/src/mongo/platform/atomic_word_test.cpp b/src/mongo/platform/atomic_word_test.cpp
index ed00ec3c70c..f097b995576 100644
--- a/src/mongo/platform/atomic_word_test.cpp
+++ b/src/mongo/platform/atomic_word_test.cpp
@@ -78,10 +78,10 @@ TEST(AtomicWordTests, BasicOperationsEnum) {
}
TEST(AtomicWordTests, BasicOperationsUnsigned32Bit) {
- typedef AtomicUInt32::WordType WordType;
- testAtomicWordBasicOperations<AtomicUInt32>();
+ typedef unsigned WordType;
+ testAtomicWordBasicOperations<AtomicWord<unsigned>>();
- AtomicUInt32 w(0xdeadbeef);
+ AtomicWord<unsigned> w(0xdeadbeef);
ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0, 1));
ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0xdeadbeef, 0xcafe1234));
ASSERT_EQUALS(WordType(0xcafe1234), w.fetchAndAdd(0xf000));
@@ -90,10 +90,10 @@ TEST(AtomicWordTests, BasicOperationsUnsigned32Bit) {
}
TEST(AtomicWordTests, BasicOperationsUnsigned64Bit) {
- typedef AtomicUInt64::WordType WordType;
- testAtomicWordBasicOperations<AtomicUInt64>();
+ typedef unsigned long long WordType;
+ testAtomicWordBasicOperations<AtomicWord<unsigned long long>>();
- AtomicUInt64 w(0xdeadbeefcafe1234ULL);
+ AtomicWord<unsigned long long> w(0xdeadbeefcafe1234ULL);
ASSERT_EQUALS(WordType(0xdeadbeefcafe1234ULL), w.compareAndSwap(0, 1));
ASSERT_EQUALS(WordType(0xdeadbeefcafe1234ULL),
w.compareAndSwap(0xdeadbeefcafe1234ULL, 0xfedcba9876543210ULL));
@@ -103,10 +103,10 @@ TEST(AtomicWordTests, BasicOperationsUnsigned64Bit) {
}
TEST(AtomicWordTests, BasicOperationsSigned32Bit) {
- typedef AtomicInt32::WordType WordType;
- testAtomicWordBasicOperations<AtomicInt32>();
+ typedef int WordType;
+ testAtomicWordBasicOperations<AtomicWord<int>>();
- AtomicInt32 w(0xdeadbeef);
+ AtomicWord<int> w(0xdeadbeef);
ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0, 1));
ASSERT_EQUALS(WordType(0xdeadbeef), w.compareAndSwap(0xdeadbeef, 0xcafe1234));
ASSERT_EQUALS(WordType(0xcafe1234), w.fetchAndAdd(0xf000));
@@ -115,10 +115,10 @@ TEST(AtomicWordTests, BasicOperationsSigned32Bit) {
}
TEST(AtomicWordTests, BasicOperationsSigned64Bit) {
- typedef AtomicInt64::WordType WordType;
- testAtomicWordBasicOperations<AtomicInt64>();
+ typedef long long WordType;
+ testAtomicWordBasicOperations<AtomicWord<long long>>();
- AtomicInt64 w(0xdeadbeefcafe1234ULL);
+ AtomicWord<long long> w(0xdeadbeefcafe1234ULL);
ASSERT_EQUALS(WordType(0xdeadbeefcafe1234LL), w.compareAndSwap(0, 1));
ASSERT_EQUALS(WordType(0xdeadbeefcafe1234LL),
w.compareAndSwap(0xdeadbeefcafe1234LL, 0xfedcba9876543210LL));
diff --git a/src/mongo/rpc/op_msg.cpp b/src/mongo/rpc/op_msg.cpp
index ebb07db09b7..305b7ba2066 100644
--- a/src/mongo/rpc/op_msg.cpp
+++ b/src/mongo/rpc/op_msg.cpp
@@ -221,7 +221,7 @@ BSONObjBuilder OpMsgBuilder::resumeBody() {
return BSONObjBuilder(BSONObjBuilder::ResumeBuildingTag(), _buf, _bodyStart);
}
-AtomicBool OpMsgBuilder::disableDupeFieldCheck_forTest{false};
+AtomicWord<bool> OpMsgBuilder::disableDupeFieldCheck_forTest{false};
Message OpMsgBuilder::finish() {
if (kDebugBuild && !disableDupeFieldCheck_forTest.load()) {
diff --git a/src/mongo/rpc/op_msg.h b/src/mongo/rpc/op_msg.h
index fdafcb002c4..88799e56896 100644
--- a/src/mongo/rpc/op_msg.h
+++ b/src/mongo/rpc/op_msg.h
@@ -221,7 +221,7 @@ public:
* the server handles them. Is false by default, although the check only happens in debug
* builds.
*/
- static AtomicBool disableDupeFieldCheck_forTest;
+ static AtomicWord<bool> disableDupeFieldCheck_forTest;
/**
* Similar to finish, any calls on this object after are illegal.
diff --git a/src/mongo/s/balancer_configuration.h b/src/mongo/s/balancer_configuration.h
index cce8d35ea9a..4c069654b3f 100644
--- a/src/mongo/s/balancer_configuration.h
+++ b/src/mongo/s/balancer_configuration.h
@@ -284,8 +284,8 @@ private:
// Max chunk size after which a chunk would be considered jumbo and won't be moved. This value
// is read on the critical path after each write operation, that's why it is cached.
- AtomicUInt64 _maxChunkSizeBytes;
- AtomicBool _shouldAutoSplit;
+ AtomicWord<unsigned long long> _maxChunkSizeBytes;
+ AtomicWord<bool> _shouldAutoSplit;
};
} // namespace mongo
diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h
index c7f53a2ab27..7dd03763160 100644
--- a/src/mongo/s/catalog_cache.h
+++ b/src/mongo/s/catalog_cache.h
@@ -347,28 +347,28 @@ private:
struct Stats {
// Counts how many times threads hit stale config exception (which is what triggers metadata
// refreshes)
- AtomicInt64 countStaleConfigErrors{0};
+ AtomicWord<long long> countStaleConfigErrors{0};
// Cumulative, always-increasing counter of how much time threads waiting for refresh
// combined
- AtomicInt64 totalRefreshWaitTimeMicros{0};
+ AtomicWord<long long> totalRefreshWaitTimeMicros{0};
// Tracks how many incremental refreshes are waiting to complete currently
- AtomicInt64 numActiveIncrementalRefreshes{0};
+ AtomicWord<long long> numActiveIncrementalRefreshes{0};
// Cumulative, always-increasing counter of how many incremental refreshes have been kicked
// off
- AtomicInt64 countIncrementalRefreshesStarted{0};
+ AtomicWord<long long> countIncrementalRefreshesStarted{0};
// Tracks how many full refreshes are waiting to complete currently
- AtomicInt64 numActiveFullRefreshes{0};
+ AtomicWord<long long> numActiveFullRefreshes{0};
// Cumulative, always-increasing counter of how many full refreshes have been kicked off
- AtomicInt64 countFullRefreshesStarted{0};
+ AtomicWord<long long> countFullRefreshesStarted{0};
// Cumulative, always-increasing counter of how many full or incremental refreshes failed
// for whatever reason
- AtomicInt64 countFailedRefreshes{0};
+ AtomicWord<long long> countFailedRefreshes{0};
/**
* Reports the accumulated statistics for serverStatus.
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp
index ca5e9a61cad..f569c25d75e 100644
--- a/src/mongo/s/chunk_manager.cpp
+++ b/src/mongo/s/chunk_manager.cpp
@@ -49,7 +49,7 @@ namespace mongo {
namespace {
// Used to generate sequence numbers to assign to each newly created RoutingTableHistory
-AtomicUInt32 nextCMSequenceNumber(0);
+AtomicWord<unsigned> nextCMSequenceNumber(0);
void checkAllElementsAreOfType(BSONType type, const BSONObj& o) {
for (auto&& element : o) {
diff --git a/src/mongo/s/chunk_writes_tracker.h b/src/mongo/s/chunk_writes_tracker.h
index 4dfb379b4a8..17e421e144f 100644
--- a/src/mongo/s/chunk_writes_tracker.h
+++ b/src/mongo/s/chunk_writes_tracker.h
@@ -86,7 +86,7 @@ private:
* The number of bytes that have been written to this chunk. May be
* modified concurrently by several threads.
*/
- AtomicUInt64 _bytesWritten{0};
+ AtomicWord<unsigned long long> _bytesWritten{0};
/**
* Protects _splitState when starting a split.
diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp
index c2343f1bdae..79eaa10c92f 100644
--- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp
+++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp
@@ -62,7 +62,7 @@
namespace mongo {
namespace {
-AtomicUInt32 JOB_NUMBER;
+AtomicWord<unsigned> JOB_NUMBER;
const Milliseconds kNoDistLockTimeout(-1);
diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h
index f102da3c8de..7dbc69ab025 100644
--- a/src/mongo/s/grid.h
+++ b/src/mongo/s/grid.h
@@ -191,7 +191,7 @@ private:
CustomConnectionPoolStatsFn _customConnectionPoolStatsFn;
- AtomicBool _shardingInitialized{false};
+ AtomicWord<bool> _shardingInitialized{false};
// Protects _configOpTime.
mutable stdx::mutex _mutex;
diff --git a/src/mongo/s/query/cluster_query_knobs.h b/src/mongo/s/query/cluster_query_knobs.h
index 9277958b72a..8ba6093c75f 100644
--- a/src/mongo/s/query/cluster_query_knobs.h
+++ b/src/mongo/s/query/cluster_query_knobs.h
@@ -39,15 +39,15 @@ namespace mongo {
// will be selected randomly amongst the shards participating in the query. Pipelines capable of
// merging on mongoS are unaffected by this setting, unless internalQueryProhibitMergingOnMongoS is
// true.
-extern AtomicBool internalQueryAlwaysMergeOnPrimaryShard;
+extern AtomicWord<bool> internalQueryAlwaysMergeOnPrimaryShard;
// If set to true on mongos, all aggregations which could otherwise merge on the mongos will be
// obliged to merge on a shard instead. Pipelines which are redirected to the shards will obey the
// value of internalQueryAlwaysMergeOnPrimaryShard. False by default, meaning that pipelines capable
// of merging on mongoS will always do so.
-extern AtomicBool internalQueryProhibitMergingOnMongoS;
+extern AtomicWord<bool> internalQueryProhibitMergingOnMongoS;
// If set to true on mongos then the cluster query planner will not produce plans with the exchange.
// False by default, so the queries run with exchanges.
-extern AtomicBool internalQueryDisableExchange;
+extern AtomicWord<bool> internalQueryDisableExchange;
} // namespace mongo
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index f66b42579d5..203c6857e3e 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -54,7 +54,7 @@ using std::shared_ptr;
using std::string;
using std::unique_ptr;
-AtomicInt64 Scope::_lastVersion(1);
+AtomicWord<long long> Scope::_lastVersion(1);
namespace {
diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h
index 2aa7dd2f127..cfe130ec650 100644
--- a/src/mongo/scripting/engine.h
+++ b/src/mongo/scripting/engine.h
@@ -219,7 +219,7 @@ protected:
std::string _localDBName;
int64_t _loadedVersion;
std::set<std::string> _storedNames;
- static AtomicInt64 _lastVersion;
+ static AtomicWord<long long> _lastVersion;
FunctionCacheMap _cachedFunctions;
int _numTimesUsed;
bool _lastRetIsNativeCode; // v8 only: set to true if eval'd script returns a native func
diff --git a/src/mongo/shell/bench.h b/src/mongo/shell/bench.h
index 322494539d3..6f30a3b76fc 100644
--- a/src/mongo/shell/bench.h
+++ b/src/mongo/shell/bench.h
@@ -453,8 +453,8 @@ private:
unsigned _numUnstartedWorkers;
unsigned _numActiveWorkers;
- AtomicUInt32 _isShuttingDown;
- AtomicUInt32 _isCollectingStats;
+ AtomicWord<unsigned> _isShuttingDown;
+ AtomicWord<unsigned> _isCollectingStats;
};
/**
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index 4f49ca027cc..9306a719b6f 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -89,7 +89,7 @@ using namespace mongo;
string historyFile;
bool gotInterrupted = false;
bool inMultiLine = false;
-static AtomicBool atPrompt(false); // can eval before getting to prompt
+static AtomicWord<bool> atPrompt(false); // can eval before getting to prompt
namespace {
const std::string kDefaultMongoHost = "127.0.0.1"s;
diff --git a/src/mongo/stdx/condition_variable.h b/src/mongo/stdx/condition_variable.h
index 5a72a6443bf..7f1ed7ef5fa 100644
--- a/src/mongo/stdx/condition_variable.h
+++ b/src/mongo/stdx/condition_variable.h
@@ -170,7 +170,7 @@ private:
return true;
}
- AtomicUInt64 _notifyableCount;
+ AtomicWord<unsigned long long> _notifyableCount;
stdx::mutex _mutex;
std::list<Notifyable**> _notifyables;
diff --git a/src/mongo/transport/message_compressor_base.h b/src/mongo/transport/message_compressor_base.h
index b7db9b6707b..e83531b517d 100644
--- a/src/mongo/transport/message_compressor_base.h
+++ b/src/mongo/transport/message_compressor_base.h
@@ -146,10 +146,10 @@ private:
const MessageCompressorId _id;
const std::string _name;
- AtomicInt64 _compressBytesIn;
- AtomicInt64 _compressBytesOut;
+ AtomicWord<long long> _compressBytesIn;
+ AtomicWord<long long> _compressBytesOut;
- AtomicInt64 _decompressBytesIn;
- AtomicInt64 _decompressBytesOut;
+ AtomicWord<long long> _decompressBytesIn;
+ AtomicWord<long long> _decompressBytesOut;
};
} // namespace mongo
diff --git a/src/mongo/transport/service_executor_adaptive_test.cpp b/src/mongo/transport/service_executor_adaptive_test.cpp
index a95065e873b..66d00b1dfd9 100644
--- a/src/mongo/transport/service_executor_adaptive_test.cpp
+++ b/src/mongo/transport/service_executor_adaptive_test.cpp
@@ -311,7 +311,7 @@ TEST_F(ServiceExecutorAdaptiveFixture, TestStarvation) {
TEST_F(ServiceExecutorAdaptiveFixture, TestRecursion) {
auto exec = makeAndStartExecutor<RecursionOptions>();
- AtomicInt32 remainingTasks{config->recursionLimit() - 1};
+ AtomicWord<int> remainingTasks{config->recursionLimit() - 1};
stdx::mutex mutex;
stdx::condition_variable cv;
stdx::function<void()> task;
diff --git a/src/mongo/transport/service_executor_reserved.h b/src/mongo/transport/service_executor_reserved.h
index da5e07fc3e1..cdcdaa010e5 100644
--- a/src/mongo/transport/service_executor_reserved.h
+++ b/src/mongo/transport/service_executor_reserved.h
@@ -73,7 +73,7 @@ private:
static thread_local int _localRecursionDepth;
static thread_local int64_t _localThreadIdleCounter;
- AtomicBool _stillRunning{false};
+ AtomicWord<bool> _stillRunning{false};
mutable stdx::mutex _mutex;
stdx::condition_variable _threadWakeup;
@@ -81,7 +81,7 @@ private:
std::deque<Task> _readyTasks;
- AtomicUInt32 _numRunningWorkerThreads{0};
+ AtomicWord<unsigned> _numRunningWorkerThreads{0};
size_t _numReadyThreads{0};
size_t _numStartingThreads{0};
diff --git a/src/mongo/transport/service_executor_synchronous.h b/src/mongo/transport/service_executor_synchronous.h
index 319994efabe..d57783a1e17 100644
--- a/src/mongo/transport/service_executor_synchronous.h
+++ b/src/mongo/transport/service_executor_synchronous.h
@@ -65,7 +65,7 @@ private:
static thread_local int _localRecursionDepth;
static thread_local int64_t _localThreadIdleCounter;
- AtomicBool _stillRunning{false};
+ AtomicWord<bool> _stillRunning{false};
mutable stdx::mutex _shutdownMutex;
stdx::condition_variable _shutdownCondition;
diff --git a/src/mongo/transport/session.cpp b/src/mongo/transport/session.cpp
index c99262a0071..1e832454aaa 100644
--- a/src/mongo/transport/session.cpp
+++ b/src/mongo/transport/session.cpp
@@ -41,7 +41,7 @@ namespace transport {
namespace {
-AtomicUInt64 sessionIdCounter(0);
+AtomicWord<unsigned long long> sessionIdCounter(0);
} // namespace
diff --git a/src/mongo/transport/transport_layer_asio.cpp b/src/mongo/transport/transport_layer_asio.cpp
index 59659ba3378..64697fb10a3 100644
--- a/src/mongo/transport/transport_layer_asio.cpp
+++ b/src/mongo/transport/transport_layer_asio.cpp
@@ -524,7 +524,7 @@ Future<SessionHandle> TransportLayerASIO::asyncConnect(HostAndPort peer,
resolver(context),
peer(std::move(peer)) {}
- AtomicBool done{false};
+ AtomicWord<bool> done{false};
Promise<SessionHandle> promise;
stdx::mutex mutex;
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index e08cc30a5b1..5fcd57250c0 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -74,7 +74,7 @@ void AssertionCount::condrollover(int newvalue) {
rollover();
}
-AtomicBool DBException::traceExceptions(false);
+AtomicWord<bool> DBException::traceExceptions(false);
void DBException::traceIfNeeded(const DBException& e) {
if (traceExceptions.load()) {
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h
index c31fdce0d57..fd8b81ea272 100644
--- a/src/mongo/util/assert_util.h
+++ b/src/mongo/util/assert_util.h
@@ -52,11 +52,11 @@ public:
void rollover();
void condrollover(int newValue);
- AtomicInt32 regular;
- AtomicInt32 warning;
- AtomicInt32 msg;
- AtomicInt32 user;
- AtomicInt32 rollovers;
+ AtomicWord<int> regular;
+ AtomicWord<int> warning;
+ AtomicWord<int> msg;
+ AtomicWord<int> user;
+ AtomicWord<int> rollovers;
};
extern AssertionCount assertionCount;
@@ -123,7 +123,7 @@ public:
return _status.extraInfo<ErrorDetail>();
}
- static AtomicBool traceExceptions;
+ static AtomicWord<bool> traceExceptions;
protected:
DBException(const Status& status) : _status(status) {
diff --git a/src/mongo/util/background_thread_clock_source.h b/src/mongo/util/background_thread_clock_source.h
index 6bfb5fa8f92..2f8eac34ecf 100644
--- a/src/mongo/util/background_thread_clock_source.h
+++ b/src/mongo/util/background_thread_clock_source.h
@@ -75,8 +75,8 @@ private:
int64_t _updateCurrent_inlock();
const std::unique_ptr<ClockSource> _clockSource;
- AtomicInt64 _current{0}; // 0 if _timer is paused due to idleness.
- AtomicBool _timerWillPause{true}; // If true when _timer wakes up, it will pause.
+ AtomicWord<long long> _current{0}; // 0 if _timer is paused due to idleness.
+ AtomicWord<bool> _timerWillPause{true}; // If true when _timer wakes up, it will pause.
const Milliseconds _granularity;
diff --git a/src/mongo/util/concurrency/thread_name.cpp b/src/mongo/util/concurrency/thread_name.cpp
index b632052330c..c6d6f68617d 100644
--- a/src/mongo/util/concurrency/thread_name.cpp
+++ b/src/mongo/util/concurrency/thread_name.cpp
@@ -90,7 +90,7 @@ void setWindowsThreadName(DWORD dwThreadID, const char* threadName) {
}
#endif
-AtomicInt64 nextUnnamedThreadId{1};
+AtomicWord<long long> nextUnnamedThreadId{1};
// It is unsafe to access threadName before its dynamic initialization has completed. Use
// the execution of mongo initializers (which only happens once we have entered main, and
diff --git a/src/mongo/util/concurrency/thread_pool.cpp b/src/mongo/util/concurrency/thread_pool.cpp
index 83114e8bda2..158396e6a93 100644
--- a/src/mongo/util/concurrency/thread_pool.cpp
+++ b/src/mongo/util/concurrency/thread_pool.cpp
@@ -47,7 +47,7 @@ namespace mongo {
namespace {
// Counter used to assign unique names to otherwise-unnamed thread pools.
-AtomicInt32 nextUnnamedThreadPoolId{1};
+AtomicWord<int> nextUnnamedThreadPoolId{1};
/**
* Sets defaults and checks bounds limits on "options", and returns it.
diff --git a/src/mongo/util/concurrency/ticketholder.h b/src/mongo/util/concurrency/ticketholder.h
index 0865e36a430..4b1ffcb5ce0 100644
--- a/src/mongo/util/concurrency/ticketholder.h
+++ b/src/mongo/util/concurrency/ticketholder.h
@@ -87,12 +87,12 @@ private:
mutable sem_t _sem;
// You can read _outof without a lock, but have to hold _resizeMutex to change.
- AtomicInt32 _outof;
+ AtomicWord<int> _outof;
stdx::mutex _resizeMutex;
#else
bool _tryAcquire();
- AtomicInt32 _outof;
+ AtomicWord<int> _outof;
int _num;
stdx::mutex _mutex;
stdx::condition_variable _newTicket;
diff --git a/src/mongo/util/debug_util.h b/src/mongo/util/debug_util.h
index 84068f0e1aa..e2b487d84d4 100644
--- a/src/mongo/util/debug_util.h
+++ b/src/mongo/util/debug_util.h
@@ -55,7 +55,7 @@ public:
}
private:
- AtomicInt64 _count{0};
+ AtomicWord<long long> _count{0};
};
struct Occasionally : SampleEveryNth<16> {};
diff --git a/src/mongo/util/exit.cpp b/src/mongo/util/exit.cpp
index 3269cec3b39..2c2f9409e83 100644
--- a/src/mongo/util/exit.cpp
+++ b/src/mongo/util/exit.cpp
@@ -52,7 +52,7 @@ stdx::mutex shutdownMutex;
stdx::condition_variable shutdownTasksComplete;
boost::optional<ExitCode> shutdownExitCode;
bool shutdownTasksInProgress = false;
-AtomicUInt32 shutdownFlag;
+AtomicWord<unsigned> shutdownFlag;
std::stack<stdx::function<void()>> shutdownTasks;
stdx::thread::id shutdownTasksThreadId;
diff --git a/src/mongo/util/fail_point.cpp b/src/mongo/util/fail_point.cpp
index d8512c6985d..324a4056eb5 100644
--- a/src/mongo/util/fail_point.cpp
+++ b/src/mongo/util/fail_point.cpp
@@ -159,7 +159,7 @@ FailPoint::RetCode FailPoint::slowShouldFailOpenBlock(
case alwaysOn:
return slowOn;
case random: {
- const AtomicInt32::WordType maxActivationValue = _timesOrPeriod.load();
+ const int maxActivationValue = _timesOrPeriod.load();
if (FailPointPRNG::current()->nextPositiveInt32() < maxActivationValue)
return slowOn;
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h
index cbb7ab3bfe7..380fcbd5753 100644
--- a/src/mongo/util/fail_point.h
+++ b/src/mongo/util/fail_point.h
@@ -73,7 +73,7 @@ class FailPoint {
MONGO_DISALLOW_COPYING(FailPoint);
public:
- typedef AtomicUInt32::WordType ValType;
+ typedef unsigned ValType;
enum Mode { off, alwaysOn, random, nTimes, skip };
enum RetCode { fastOff = 0, slowOff, slowOn, userIgnored };
@@ -171,11 +171,11 @@ private:
// Bit layout:
// 31: tells whether this fail point is active.
// 0~30: unsigned ref counter for active dynamic instances.
- AtomicUInt32 _fpInfo{0};
+ AtomicWord<unsigned> _fpInfo{0};
// Invariant: These should be read only if ACTIVE_BIT of _fpInfo is set.
Mode _mode{off};
- AtomicInt32 _timesOrPeriod{0};
+ AtomicWord<int> _timesOrPeriod{0};
BSONObj _data;
// protects _mode, _timesOrPeriod, _data
diff --git a/src/mongo/util/intrusive_counter.h b/src/mongo/util/intrusive_counter.h
index 3b4cd6280eb..b78f83809df 100644
--- a/src/mongo/util/intrusive_counter.h
+++ b/src/mongo/util/intrusive_counter.h
@@ -66,7 +66,7 @@ protected:
virtual ~RefCountable() {}
private:
- mutable AtomicUInt32 _count; // default initialized to 0
+ mutable AtomicWord<unsigned> _count; // default initialized to 0
};
/// This is an immutable reference-counted string
diff --git a/src/mongo/util/invalidating_lru_cache_test.cpp b/src/mongo/util/invalidating_lru_cache_test.cpp
index d1a485c6043..4ef42056693 100644
--- a/src/mongo/util/invalidating_lru_cache_test.cpp
+++ b/src/mongo/util/invalidating_lru_cache_test.cpp
@@ -59,7 +59,7 @@ public:
}
private:
- AtomicBool _isValid{true};
+ AtomicWord<bool> _isValid{true};
boost::optional<stdx::function<bool()>> _isValidHook;
};
diff --git a/src/mongo/util/net/ssl_manager.h b/src/mongo/util/net/ssl_manager.h
index fa2abc656a5..b8360df1a96 100644
--- a/src/mongo/util/net/ssl_manager.h
+++ b/src/mongo/util/net/ssl_manager.h
@@ -143,11 +143,11 @@ const ASN1OID mongodbRolesOID("1.3.6.1.4.1.34601.2.1.1",
* Counts of negogtiated version used by TLS connections.
*/
struct TLSVersionCounts {
- AtomicInt64 tlsUnknown;
- AtomicInt64 tls10;
- AtomicInt64 tls11;
- AtomicInt64 tls12;
- AtomicInt64 tls13;
+ AtomicWord<long long> tlsUnknown;
+ AtomicWord<long long> tls10;
+ AtomicWord<long long> tls11;
+ AtomicWord<long long> tls12;
+ AtomicWord<long long> tls13;
static TLSVersionCounts& get(ServiceContext* serviceContext);
};
diff --git a/src/mongo/util/net/ssl_options.cpp b/src/mongo/util/net/ssl_options.cpp
index b86c4d0e130..fde6a4fa57f 100644
--- a/src/mongo/util/net/ssl_options.cpp
+++ b/src/mongo/util/net/ssl_options.cpp
@@ -201,7 +201,7 @@ StatusWith<SSLParams::SSLModes> SSLParams::tlsModeParse(StringData strMode) {
}
-std::string SSLParams::sslModeFormat(AtomicInt32::WordType mode) {
+std::string SSLParams::sslModeFormat(int mode) {
switch (mode) {
case SSLParams::SSLMode_disabled:
return "disabled";
@@ -212,12 +212,12 @@ std::string SSLParams::sslModeFormat(AtomicInt32::WordType mode) {
case SSLParams::SSLMode_requireSSL:
return "requireSSL";
default:
- // Default case because sslMode is an AtomicInt32 and not bound by enum rules.
+ // Default case because sslMode is an AtomicWord<int> and not bound by enum rules.
return "unknown";
}
}
-std::string SSLParams::tlsModeFormat(AtomicInt32::WordType mode) {
+std::string SSLParams::tlsModeFormat(int mode) {
switch (mode) {
case SSLParams::SSLMode_disabled:
return "disabled";
@@ -228,7 +228,7 @@ std::string SSLParams::tlsModeFormat(AtomicInt32::WordType mode) {
case SSLParams::SSLMode_requireSSL:
return "requireTLS";
default:
- // Default case because sslMode is an AtomicInt32 and not bound by enum rules.
+ // Default case because sslMode is an AtomicWord<int> and not bound by enum rules.
return "unknown";
}
}
diff --git a/src/mongo/util/net/ssl_options.h b/src/mongo/util/net/ssl_options.h
index acfcceea486..9bbb026ab08 100644
--- a/src/mongo/util/net/ssl_options.h
+++ b/src/mongo/util/net/ssl_options.h
@@ -51,7 +51,7 @@ class Environment;
struct SSLParams {
enum class Protocols { TLS1_0, TLS1_1, TLS1_2, TLS1_3 };
- AtomicInt32 sslMode; // --tlsMode - the TLS operation mode, see enum SSLModes
+ AtomicWord<int> sslMode; // --tlsMode - the TLS operation mode, see enum SSLModes
std::string sslPEMTempDHParam; // --setParameter OpenSSLDiffieHellmanParameters=file : PEM file
// with DH parameters.
std::string sslPEMKeyFile; // --tlsCertificateKeyFile
@@ -92,7 +92,7 @@ struct SSLParams {
sslMode.store(SSLMode_disabled);
}
- enum SSLModes : AtomicInt32::WordType {
+ enum SSLModes : int {
/**
* Make unencrypted outgoing connections and do not accept incoming SSL-connections.
*/
@@ -116,8 +116,8 @@ struct SSLParams {
static StatusWith<SSLModes> sslModeParse(StringData strMode);
static StatusWith<SSLModes> tlsModeParse(StringData strMode);
- static std::string sslModeFormat(AtomicInt32::WordType mode);
- static std::string tlsModeFormat(AtomicInt32::WordType mode);
+ static std::string sslModeFormat(int mode);
+ static std::string tlsModeFormat(int mode);
};
extern SSLParams sslGlobalParams;
diff --git a/src/mongo/util/net/ssl_parameters.cpp b/src/mongo/util/net/ssl_parameters.cpp
index 2fe9e66cb43..aafbb453268 100644
--- a/src/mongo/util/net/ssl_parameters.cpp
+++ b/src/mongo/util/net/ssl_parameters.cpp
@@ -54,7 +54,8 @@ std::string clusterAuthModeFormat() {
case ServerGlobalParams::ClusterAuthMode_x509:
return "x509";
default:
- // Default case because clusterAuthMode is an AtomicInt32 and not bound by enum rules.
+ // Default case because clusterAuthMode is an AtomicWord<int> and not bound by enum
+ // rules.
return "undefined";
}
}
diff --git a/src/mongo/util/shared_buffer.h b/src/mongo/util/shared_buffer.h
index add4a5c2325..5a583163d26 100644
--- a/src/mongo/util/shared_buffer.h
+++ b/src/mongo/util/shared_buffer.h
@@ -101,7 +101,7 @@ public:
private:
class Holder {
public:
- explicit Holder(AtomicUInt32::WordType initial, size_t capacity)
+ explicit Holder(unsigned initial, size_t capacity)
: _refCount(initial), _capacity(capacity) {
invariant(capacity == _capacity);
}
@@ -132,7 +132,7 @@ private:
return _refCount.load() > 1;
}
- AtomicUInt32 _refCount;
+ AtomicWord<unsigned> _refCount;
uint32_t _capacity;
};