summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-05-09 16:27:06 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-05-17 11:11:57 -0400
commit76de5323b88080f852ca4c2f42593502d26c5620 (patch)
treeed2757f12d12670a25f29529c78b327bb308263d /src/mongo/db
parent73a042328a539b51b3bf35efc16ec3245381dc40 (diff)
downloadmongo-76de5323b88080f852ca4c2f42593502d26c5620.tar.gz
SERVER-24104 Replace stdx::duration with mongo::Duration.
The mongo::Duration type does overflow checking on casts and arithmetic. This patch also moves DESTRUCTOR_GUARD out of assert_util.h into destructor_guard.h in order to break an include cycle with duration.h.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_local.h1
-rw-r--r--src/mongo/db/auth/impersonation_session.cpp1
-rw-r--r--src/mongo/db/auth/role_name.h1
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.cpp7
-rw-r--r--src/mongo/db/background.cpp1
-rw-r--r--src/mongo/db/catalog/collection.cpp2
-rw-r--r--src/mongo/db/catalog/database_holder.h1
-rw-r--r--src/mongo/db/client.cpp2
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp2
-rw-r--r--src/mongo/db/commands/parameters.cpp1
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp4
-rw-r--r--src/mongo/db/exec/and_hash.h1
-rw-r--r--src/mongo/db/ftdc/config.h2
-rw-r--r--src/mongo/db/ftdc/ftdc_mongod.cpp2
-rw-r--r--src/mongo/db/ftdc/util.cpp2
-rw-r--r--src/mongo/db/hasher.h3
-rw-r--r--src/mongo/db/pipeline/document_source_out.cpp1
-rw-r--r--src/mongo/db/pipeline/field_path.h5
-rw-r--r--src/mongo/db/query/plan_enumerator.h1
-rw-r--r--src/mongo/db/query/plan_yield_policy.cpp7
-rw-r--r--src/mongo/db/range_deleter.cpp3
-rw-r--r--src/mongo/db/range_deleter_test.cpp6
-rw-r--r--src/mongo/db/repl/applier.cpp1
-rw-r--r--src/mongo/db/repl/collection_cloner.cpp1
-rw-r--r--src/mongo/db/repl/data_replicator.cpp1
-rw-r--r--src/mongo/db/repl/database_cloner.cpp1
-rw-r--r--src/mongo/db/repl/multiapplier.cpp1
-rw-r--r--src/mongo/db/repl/oplog_fetcher.cpp6
-rw-r--r--src/mongo/db/repl/oplogreader.cpp3
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_mock.h1
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp24
-rw-r--r--src/mongo/db/repl/reporter.cpp1
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp3
-rw-r--r--src/mongo/db/repl/sync_source_resolver.h1
-rw-r--r--src/mongo/db/repl/sync_tail.cpp2
-rw-r--r--src/mongo/db/repl/task_runner.cpp1
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl.cpp12
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_test.cpp1
-rw-r--r--src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp1
-rw-r--r--src/mongo/db/s/collection_sharding_state.h1
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp6
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp5
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp5
-rw-r--r--src/mongo/db/s/operation_sharding_state.cpp5
-rw-r--r--src/mongo/db/s/sharding_state.cpp2
-rw-r--r--src/mongo/db/service_context.h1
-rw-r--r--src/mongo/db/sorter/sorter.cpp1
-rw-r--r--src/mongo/db/sorter/sorter.h1
-rw-r--r--src/mongo/db/stats/snapshots.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/dur.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journalimpl.h1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_recover.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_recover.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/file_allocator.h6
-rw-r--r--src/mongo/db/storage/mmap_v1/record_access_tracker.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/record_access_tracker.h2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp5
57 files changed, 110 insertions, 59 deletions
diff --git a/src/mongo/db/auth/authz_manager_external_state_local.h b/src/mongo/db/auth/authz_manager_external_state_local.h
index 883d9d261e7..c9646686b03 100644
--- a/src/mongo/db/auth/authz_manager_external_state_local.h
+++ b/src/mongo/db/auth/authz_manager_external_state_local.h
@@ -37,6 +37,7 @@
#include "mongo/db/auth/role_name.h"
#include "mongo/db/auth/user_name.h"
#include "mongo/stdx/functional.h"
+#include "mongo/stdx/mutex.h"
namespace mongo {
diff --git a/src/mongo/db/auth/impersonation_session.cpp b/src/mongo/db/auth/impersonation_session.cpp
index 228d5567807..791e3c56a0b 100644
--- a/src/mongo/db/auth/impersonation_session.cpp
+++ b/src/mongo/db/auth/impersonation_session.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/rpc/metadata/audit_metadata.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/destructor_guard.h"
namespace mongo {
diff --git a/src/mongo/db/auth/role_name.h b/src/mongo/db/auth/role_name.h
index 30ef4d50412..7606b216c02 100644
--- a/src/mongo/db/auth/role_name.h
+++ b/src/mongo/db/auth/role_name.h
@@ -29,6 +29,7 @@
#pragma once
#include <iosfwd>
+#include <memory>
#include <string>
#include <vector>
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp
index cda52569f1f..ef64311cbe6 100644
--- a/src/mongo/db/auth/user_cache_invalidator_job.cpp
+++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp
@@ -141,11 +141,12 @@ void UserCacheInvalidator::run() {
while (true) {
stdx::unique_lock<stdx::mutex> lock(invalidationIntervalMutex);
- Date_t sleepUntil = lastInvalidationTime + Seconds(userCacheInvalidationIntervalSecs);
+ Date_t sleepUntil =
+ lastInvalidationTime + Seconds(userCacheInvalidationIntervalSecs.load());
Date_t now = Date_t::now();
while (now < sleepUntil) {
- invalidationIntervalChangedCondition.wait_for(lock, sleepUntil - now);
- sleepUntil = lastInvalidationTime + Seconds(userCacheInvalidationIntervalSecs);
+ invalidationIntervalChangedCondition.wait_until(lock, sleepUntil.toSystemTimePoint());
+ sleepUntil = lastInvalidationTime + Seconds(userCacheInvalidationIntervalSecs.load());
now = Date_t::now();
}
lastInvalidationTime = now;
diff --git a/src/mongo/db/background.cpp b/src/mongo/db/background.cpp
index 306d966a01b..e3869b1bd6b 100644
--- a/src/mongo/db/background.cpp
+++ b/src/mongo/db/background.cpp
@@ -37,6 +37,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/stdx/condition_variable.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/map_util.h"
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 84c596c25ef..2805c3d3b05 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -152,7 +152,7 @@ void CappedInsertNotifier::_wait(stdx::unique_lock<stdx::mutex>& lk,
while (!_dead && prevVersion == _version) {
if (timeout == Microseconds::max()) {
_notifier.wait(lk);
- } else if (stdx::cv_status::timeout == _notifier.wait_for(lk, timeout)) {
+ } else if (stdx::cv_status::timeout == _notifier.wait_for(lk, timeout.toSystemDuration())) {
return;
}
}
diff --git a/src/mongo/db/catalog/database_holder.h b/src/mongo/db/catalog/database_holder.h
index ce99747937b..ba8b5c673fa 100644
--- a/src/mongo/db/catalog/database_holder.h
+++ b/src/mongo/db/catalog/database_holder.h
@@ -32,6 +32,7 @@
#include "mongo/base/string_data.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/string_map.h"
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index e72553d1fbe..807a7650aa5 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -50,8 +50,6 @@
namespace mongo {
-using logger::LogComponent;
-
TSP_DECLARE(ServiceContext::UniqueClient, currentClient)
TSP_DEFINE(ServiceContext::UniqueClient, currentClient)
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 577c53b2d13..341bc67b8ed 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -357,7 +357,7 @@ public:
ctx.reset();
// Block waiting for data.
- Microseconds timeout(curOp->getRemainingMaxTimeMicros());
+ Microseconds timeout(static_cast<int64_t>(curOp->getRemainingMaxTimeMicros()));
notifier->wait(notifierVersion, timeout);
notifier.reset();
diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp
index c9bc974e040..c2a5bf23d91 100644
--- a/src/mongo/db/commands/parameters.cpp
+++ b/src/mongo/db/commands/parameters.cpp
@@ -42,6 +42,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/storage/storage_options.h"
+#include "mongo/logger/logger.h"
#include "mongo/logger/parse_log_component_settings.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_manager.h"
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index a1da8b0075e..ff77d6021c3 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -228,7 +228,9 @@ void CondVarLockGrantNotification::clear() {
LockResult CondVarLockGrantNotification::wait(unsigned timeoutMs) {
stdx::unique_lock<stdx::mutex> lock(_mutex);
while (_result == LOCK_INVALID) {
- if (stdx::cv_status::timeout == _cond.wait_for(lock, Milliseconds(timeoutMs))) {
+ if (stdx::cv_status::timeout ==
+ _cond.wait_for(lock,
+ Milliseconds(static_cast<int64_t>(timeoutMs)).toSystemDuration())) {
// Timeout
return LOCK_TIMEOUT;
}
diff --git a/src/mongo/db/exec/and_hash.h b/src/mongo/db/exec/and_hash.h
index ba57866ac28..b984f390590 100644
--- a/src/mongo/db/exec/and_hash.h
+++ b/src/mongo/db/exec/and_hash.h
@@ -34,6 +34,7 @@
#include "mongo/db/exec/plan_stage.h"
#include "mongo/db/matcher/expression.h"
#include "mongo/db/record_id.h"
+#include "mongo/platform/unordered_map.h"
#include "mongo/platform/unordered_set.h"
namespace mongo {
diff --git a/src/mongo/db/ftdc/config.h b/src/mongo/db/ftdc/config.h
index ef7ee8b9143..08e9be0b6df 100644
--- a/src/mongo/db/ftdc/config.h
+++ b/src/mongo/db/ftdc/config.h
@@ -85,7 +85,7 @@ struct FTDCConfig {
static const bool kEnabledDefault = true;
- static const std::uint64_t kPeriodMillisDefault;
+ static const std::int64_t kPeriodMillisDefault;
static const std::uint64_t kMaxDirectorySizeBytesDefault = 100 * 1024 * 1024;
static const std::uint64_t kMaxFileSizeBytesDefault = 10 * 1024 * 1024;
diff --git a/src/mongo/db/ftdc/ftdc_mongod.cpp b/src/mongo/db/ftdc/ftdc_mongod.cpp
index e328dbd3dff..73813248b45 100644
--- a/src/mongo/db/ftdc/ftdc_mongod.cpp
+++ b/src/mongo/db/ftdc/ftdc_mongod.cpp
@@ -299,7 +299,7 @@ void startFTDC() {
FTDCConfig config;
- config.period = Milliseconds(localPeriodMillis);
+ config.period = Milliseconds(localPeriodMillis.load());
config.enabled = localEnabledFlag;
config.maxFileSizeBytes = localMaxFileSizeMB * 1024 * 1024;
config.maxDirectorySizeBytes = localMaxDirectorySizeMB * 1024 * 1024;
diff --git a/src/mongo/db/ftdc/util.cpp b/src/mongo/db/ftdc/util.cpp
index 0cc96d35a50..ea87e6b58e5 100644
--- a/src/mongo/db/ftdc/util.cpp
+++ b/src/mongo/db/ftdc/util.cpp
@@ -63,7 +63,7 @@ const char kFTDCDocsField[] = "docs";
const char kFTDCCollectStartField[] = "start";
const char kFTDCCollectEndField[] = "end";
-const std::uint64_t FTDCConfig::kPeriodMillisDefault = 1000;
+const std::int64_t FTDCConfig::kPeriodMillisDefault = 1000;
const std::size_t kMaxRecursion = 10;
diff --git a/src/mongo/db/hasher.h b/src/mongo/db/hasher.h
index fd634b69ba5..15fd27d2696 100644
--- a/src/mongo/db/hasher.h
+++ b/src/mongo/db/hasher.h
@@ -34,8 +34,7 @@
#pragma once
-#include "mongo/platform/basic.h"
-
+#include "mongo/base/disallow_copying.h"
#include "mongo/bson/bsonelement.h"
#include "mongo/util/md5.hpp"
diff --git a/src/mongo/db/pipeline/document_source_out.cpp b/src/mongo/db/pipeline/document_source_out.cpp
index 8a8863486a0..148f7f4fc7e 100644
--- a/src/mongo/db/pipeline/document_source_out.cpp
+++ b/src/mongo/db/pipeline/document_source_out.cpp
@@ -29,6 +29,7 @@
#include "mongo/platform/basic.h"
#include "mongo/db/pipeline/document_source.h"
+#include "mongo/util/destructor_guard.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/field_path.h b/src/mongo/db/pipeline/field_path.h
index 84dca905fdb..6cec754815c 100644
--- a/src/mongo/db/pipeline/field_path.h
+++ b/src/mongo/db/pipeline/field_path.h
@@ -28,7 +28,10 @@
#pragma once
-#include "mongo/platform/basic.h"
+#include <iosfwd>
+#include <string>
+#include <vector>
+
#include "mongo/util/assert_util.h"
namespace mongo {
diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h
index 20994eedba7..a74889fce64 100644
--- a/src/mongo/db/query/plan_enumerator.h
+++ b/src/mongo/db/query/plan_enumerator.h
@@ -36,6 +36,7 @@
#include "mongo/db/query/index_entry.h"
#include "mongo/db/query/index_tag.h"
#include "mongo/db/query/query_knobs.h"
+#include "mongo/platform/unordered_map.h"
namespace mongo {
diff --git a/src/mongo/db/query/plan_yield_policy.cpp b/src/mongo/db/query/plan_yield_policy.cpp
index 575ebf664b8..76705aafb93 100644
--- a/src/mongo/db/query/plan_yield_policy.cpp
+++ b/src/mongo/db/query/plan_yield_policy.cpp
@@ -46,15 +46,16 @@ PlanYieldPolicy::PlanYieldPolicy(PlanExecutor* exec, PlanExecutor::YieldPolicy p
_forceYield(false),
_elapsedTracker(exec->getOpCtx()->getServiceContext()->getFastClockSource(),
internalQueryExecYieldIterations,
- Milliseconds(internalQueryExecYieldPeriodMS)),
+ Milliseconds(internalQueryExecYieldPeriodMS.load())),
_planYielding(exec) {}
PlanYieldPolicy::PlanYieldPolicy(PlanExecutor::YieldPolicy policy, ClockSource* cs)
: _policy(policy),
_forceYield(false),
- _elapsedTracker(
- cs, internalQueryExecYieldIterations, Milliseconds(internalQueryExecYieldPeriodMS)),
+ _elapsedTracker(cs,
+ internalQueryExecYieldIterations,
+ Milliseconds(internalQueryExecYieldPeriodMS.load())),
_planYielding(nullptr) {}
bool PlanYieldPolicy::shouldYield() {
diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp
index 2d9e9c04bd5..8d05a926991 100644
--- a/src/mongo/db/range_deleter.cpp
+++ b/src/mongo/db/range_deleter.cpp
@@ -423,7 +423,8 @@ void RangeDeleter::doWork() {
{
stdx::unique_lock<stdx::mutex> sl(_queueMutex);
while (_taskQueue.empty()) {
- _taskQueueNotEmptyCV.wait_for(sl, Milliseconds(kNotEmptyTimeoutMillis));
+ _taskQueueNotEmptyCV.wait_for(
+ sl, Milliseconds(kNotEmptyTimeoutMillis).toSystemDuration());
if (stopRequested()) {
log() << "stopping range deleter worker" << endl;
diff --git a/src/mongo/db/range_deleter_test.cpp b/src/mongo/db/range_deleter_test.cpp
index 240925c1c2f..a2fc38dc6c6 100644
--- a/src/mongo/db/range_deleter_test.cpp
+++ b/src/mongo/db/range_deleter_test.cpp
@@ -199,7 +199,8 @@ TEST(ImmediateDelete, ShouldWaitCursor) {
env->addCursorId(ns, 200);
env->removeCursorId(ns, 345);
- ASSERT_TRUE(stdx::future_status::ready == deleterFuture.wait_for(MAX_IMMEDIATE_DELETE_WAIT));
+ ASSERT_TRUE(stdx::future_status::ready ==
+ deleterFuture.wait_for(MAX_IMMEDIATE_DELETE_WAIT.toSystemDuration()));
ASSERT_TRUE(deleterFuture.get());
ASSERT_TRUE(env->deleteOccured());
@@ -250,7 +251,8 @@ TEST(ImmediateDelete, StopWhileWaitingCursor) {
stop_deleter_guard.Execute();
- ASSERT_TRUE(stdx::future_status::ready == deleterFuture.wait_for(MAX_IMMEDIATE_DELETE_WAIT));
+ ASSERT_TRUE(stdx::future_status::ready ==
+ deleterFuture.wait_for(MAX_IMMEDIATE_DELETE_WAIT.toSystemDuration()));
ASSERT_FALSE(deleterFuture.get());
ASSERT_FALSE(env->deleteOccured());
}
diff --git a/src/mongo/db/repl/applier.cpp b/src/mongo/db/repl/applier.cpp
index ef7e37debde..4eda40c6ab1 100644
--- a/src/mongo/db/repl/applier.cpp
+++ b/src/mongo/db/repl/applier.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_executor.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp
index 1f71fe762e7..95c2fd66baf 100644
--- a/src/mongo/db/repl/collection_cloner.cpp
+++ b/src/mongo/db/repl/collection_cloner.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/repl/collection_cloner.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/data_replicator.cpp b/src/mongo/db/repl/data_replicator.cpp
index b8f2d7f3a3a..c72427f3d40 100644
--- a/src/mongo/db/repl/data_replicator.cpp
+++ b/src/mongo/db/repl/data_replicator.cpp
@@ -52,6 +52,7 @@
#include "mongo/stdx/memory.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/database_cloner.cpp b/src/mongo/db/repl/database_cloner.cpp
index b0c0bddcd01..da4d3c33887 100644
--- a/src/mongo/db/repl/database_cloner.cpp
+++ b/src/mongo/db/repl/database_cloner.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/catalog/collection_options.h"
#include "mongo/stdx/functional.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/multiapplier.cpp b/src/mongo/db/repl/multiapplier.cpp
index 8db87b5e1f5..0fe05fa48bb 100644
--- a/src/mongo/db/repl/multiapplier.cpp
+++ b/src/mongo/db/repl/multiapplier.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/optime.h"
#include "mongo/db/repl/replication_executor.h"
+#include "mongo/util/destructor_guard.h"
namespace mongo {
namespace repl {
diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp
index fcb41bdca51..1655a717210 100644
--- a/src/mongo/db/repl/oplog_fetcher.cpp
+++ b/src/mongo/db/repl/oplog_fetcher.cpp
@@ -53,8 +53,10 @@ Milliseconds calculateAwaitDataTimeout(const ReplicaSetConfig& config) {
// Under protocol version 1, make the awaitData timeout (maxTimeMS) dependent on the election
// timeout. This enables the sync source to communicate liveness of the primary to secondaries.
// Under protocol version 0, use a default timeout of 2 seconds for awaitData.
- return config.getProtocolVersion() == 1LL ? config.getElectionTimeoutPeriod() / 2
- : OplogFetcher::kDefaultProtocolZeroAwaitDataTimeout;
+ if (config.getProtocolVersion() == 1LL) {
+ return config.getElectionTimeoutPeriod() / 2;
+ }
+ return OplogFetcher::kDefaultProtocolZeroAwaitDataTimeout;
}
/**
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index e1823bad682..e9e7b79c261 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -138,7 +138,8 @@ HostAndPort OplogReader::getHost() const {
void OplogReader::connectToSyncSource(OperationContext* txn,
const OpTime& lastOpTimeFetched,
ReplicationCoordinator* replCoord) {
- const Timestamp sentinelTimestamp(duration_cast<Seconds>(Milliseconds(curTimeMillis64())), 0);
+ const Timestamp sentinelTimestamp(duration_cast<Seconds>(Date_t::now().toDurationSinceEpoch()),
+ 0);
const OpTime sentinel(sentinelTimestamp, std::numeric_limits<long long>::max());
OpTime oldestOpTimeSeen = sentinel;
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h
index 311de9c5e58..77d883df480 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h
@@ -38,6 +38,7 @@
#include "mongo/db/repl/last_vote.h"
#include "mongo/db/repl/replication_coordinator_external_state.h"
#include "mongo/stdx/condition_variable.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/net/hostandport.h"
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 36e0ea67444..f086e293cfa 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -604,7 +604,7 @@ Status ReplicationCoordinatorImpl::waitForMemberState(MemberState expectedState,
stdx::unique_lock<stdx::mutex> lk(_mutex);
auto pred = [this, expectedState]() { return _memberState == expectedState; };
- if (!_memberStateChange.wait_for(lk, timeout, pred)) {
+ if (!_memberStateChange.wait_for(lk, timeout.toSystemDuration(), pred)) {
return Status(ErrorCodes::ExceededTimeLimit,
str::stream() << "Timed out waiting for state to become "
<< expectedState.toString() << ". Current state is "
@@ -779,7 +779,7 @@ Status ReplicationCoordinatorImpl::waitForDrainFinish(Milliseconds timeout) {
stdx::unique_lock<stdx::mutex> lk(_mutex);
auto pred = [this]() { return !_isWaitingForDrainToComplete; };
- if (!_drainFinishedCond.wait_for(lk, timeout, pred)) {
+ if (!_drainFinishedCond.wait_for(lk, timeout.toSystemDuration(), pred)) {
return Status(ErrorCodes::ExceededTimeLimit,
"Timed out waiting to finish draining applier buffer");
}
@@ -1096,13 +1096,13 @@ ReadConcernResponse ReplicationCoordinatorImpl::waitUntilOpTime(OperationContext
if (isMajorityReadConcern) {
// Wait for a snapshot that meets our needs (< targetOpTime).
const auto waitTime = CurOp::get(txn)->isMaxTimeSet()
- ? Microseconds(txn->getRemainingMaxTimeMicros())
+ ? Microseconds(static_cast<int64_t>(txn->getRemainingMaxTimeMicros()))
: Microseconds{0};
const auto waitForever = waitTime == Microseconds{0};
LOG(2) << "waitUntilOpTime: waiting for a new snapshot to occur for micros: "
<< waitTime;
if (!waitForever) {
- _currentCommittedSnapshotCond.wait_for(lock, waitTime);
+ _currentCommittedSnapshotCond.wait_for(lock, waitTime.toSystemDuration());
} else {
_currentCommittedSnapshotCond.wait(lock);
}
@@ -1117,7 +1117,9 @@ ReadConcernResponse ReplicationCoordinatorImpl::waitUntilOpTime(OperationContext
LOG(3) << "Waiting for OpTime: " << waitInfo;
if (CurOp::get(txn)->isMaxTimeSet()) {
- condVar.wait_for(lock, Microseconds(txn->getRemainingMaxTimeMicros()));
+ condVar.wait_for(lock,
+ Microseconds(static_cast<int64_t>(txn->getRemainingMaxTimeMicros()))
+ .toSystemDuration());
} else {
condVar.wait(lock);
}
@@ -1543,7 +1545,8 @@ ReplicationCoordinator::StatusAndDuration ReplicationCoordinatorImpl::_awaitRepl
Status(ErrorCodes::ShutdownInProgress, "Replication is being shut down"), elapsed);
}
- const Microseconds maxTimeMicrosRemaining{txn->getRemainingMaxTimeMicros()};
+ const Microseconds maxTimeMicrosRemaining{
+ static_cast<int64_t>(txn->getRemainingMaxTimeMicros())};
Microseconds waitTime = Microseconds::max();
if (maxTimeMicrosRemaining != Microseconds::zero()) {
waitTime = maxTimeMicrosRemaining;
@@ -1557,7 +1560,7 @@ ReplicationCoordinator::StatusAndDuration ReplicationCoordinatorImpl::_awaitRepl
if (waitForever) {
condVar.wait(*lock);
} else {
- condVar.wait_for(*lock, waitTime);
+ condVar.wait_for(*lock, waitTime.toSystemDuration());
}
}
@@ -2937,7 +2940,8 @@ bool ReplicationCoordinatorImpl::shouldChangeSyncSource(const HostAndPort& curre
SyncSourceResolverResponse ReplicationCoordinatorImpl::selectSyncSource(
OperationContext* txn, const OpTime& lastOpTimeFetched) {
- const Timestamp sentinelTimestamp(duration_cast<Seconds>(Milliseconds(curTimeMillis64())), 0);
+ const Timestamp sentinelTimestamp(duration_cast<Seconds>(Date_t::now().toDurationSinceEpoch()),
+ 0);
const OpTime sentinel(sentinelTimestamp, std::numeric_limits<long long>::max());
OpTime earliestOpTimeSeen = sentinel;
SyncSourceResolverResponse resp;
@@ -3336,11 +3340,11 @@ void ReplicationCoordinatorImpl::waitUntilSnapshotCommitted(OperationContext* tx
stdx::unique_lock<stdx::mutex> lock(_mutex);
while (!_currentCommittedSnapshot || _currentCommittedSnapshot->name < untilSnapshot) {
- Microseconds waitTime(txn->getRemainingMaxTimeMicros());
+ Microseconds waitTime(static_cast<int64_t>(txn->getRemainingMaxTimeMicros()));
if (waitTime == Microseconds(0)) {
_currentCommittedSnapshotCond.wait(lock);
} else {
- _currentCommittedSnapshotCond.wait_for(lock, waitTime);
+ _currentCommittedSnapshotCond.wait_for(lock, waitTime.toSystemDuration());
}
txn->checkForInterrupt();
}
diff --git a/src/mongo/db/repl/reporter.cpp b/src/mongo/db/repl/reporter.cpp
index b9e9d9cb8e8..f7f0dca3873 100644
--- a/src/mongo/db/repl/reporter.cpp
+++ b/src/mongo/db/repl/reporter.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/repl/update_position_args.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index 136978df15b..411b3fb0133 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -191,7 +191,8 @@ void SyncSourceFeedback::run() {
// this class.
stdx::unique_lock<stdx::mutex> lock(_mtx);
while (!_positionChanged && !_shutdownSignaled) {
- if (_cond.wait_for(lock, keepAliveInterval) == stdx::cv_status::timeout) {
+ if (_cond.wait_for(lock, keepAliveInterval.toSystemDuration()) ==
+ stdx::cv_status::timeout) {
MemberState state = ReplicationCoordinator::get(txn.get())->getMemberState();
if (!(state.primary() || state.startup())) {
break;
diff --git a/src/mongo/db/repl/sync_source_resolver.h b/src/mongo/db/repl/sync_source_resolver.h
index be46c78c3b1..fd098374882 100644
--- a/src/mongo/db/repl/sync_source_resolver.h
+++ b/src/mongo/db/repl/sync_source_resolver.h
@@ -30,6 +30,7 @@
#include "mongo/base/status_with.h"
#include "mongo/db/repl/optime.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/net/hostandport.h"
namespace mongo {
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index 1341b2c16e3..313da81150c 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -601,7 +601,7 @@ public:
if (_ops.empty()) {
// We intentionally don't care about whether this returns due to signaling or timeout
// since we do the same thing either way: return whatever is in _ops.
- (void)_cv.wait_for(lk, maxWaitTime);
+ (void)_cv.wait_for(lk, maxWaitTime.toSystemDuration());
}
OpQueue ops = std::move(_ops);
diff --git a/src/mongo/db/repl/task_runner.cpp b/src/mongo/db/repl/task_runner.cpp
index 37d05af51a6..1558e88929a 100644
--- a/src/mongo/db/repl/task_runner.cpp
+++ b/src/mongo/db/repl/task_runner.cpp
@@ -42,6 +42,7 @@
#include "mongo/util/assert_util.h"
#include "mongo/util/concurrency/old_thread_pool.h"
#include "mongo/util/concurrency/thread_name.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/topology_coordinator_impl.cpp b/src/mongo/db/repl/topology_coordinator_impl.cpp
index e2cf990a13f..45f8e6280ad 100644
--- a/src/mongo/db/repl/topology_coordinator_impl.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl.cpp
@@ -857,9 +857,9 @@ std::pair<ReplSetHeartbeatArgs, Milliseconds> TopologyCoordinatorImpl::prepareHe
hbArgs.setConfigVersion(-2);
}
- const Milliseconds timeoutPeriod(_rsConfig.isInitialized()
- ? _rsConfig.getHeartbeatTimeoutPeriodMillis()
- : ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod);
+ const Milliseconds timeoutPeriod(
+ _rsConfig.isInitialized() ? _rsConfig.getHeartbeatTimeoutPeriodMillis()
+ : Milliseconds{ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod});
const Milliseconds timeout = timeoutPeriod - alreadyElapsed;
return std::make_pair(hbArgs, timeout);
}
@@ -893,9 +893,9 @@ std::pair<ReplSetHeartbeatArgsV1, Milliseconds> TopologyCoordinatorImpl::prepare
hbArgs.setTerm(OpTime::kInitialTerm);
}
- const Milliseconds timeoutPeriod(_rsConfig.isInitialized()
- ? _rsConfig.getHeartbeatTimeoutPeriodMillis()
- : ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod);
+ const Milliseconds timeoutPeriod(
+ _rsConfig.isInitialized() ? _rsConfig.getHeartbeatTimeoutPeriodMillis()
+ : Milliseconds{ReplicaSetConfig::kDefaultHeartbeatTimeoutPeriod});
const Milliseconds timeout(timeoutPeriod - alreadyElapsed);
return std::make_pair(hbArgs, timeout);
}
diff --git a/src/mongo/db/repl/topology_coordinator_impl_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
index b1ff5db42cf..b0e41018c32 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_test.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/repl/topology_coordinator.h"
#include "mongo/db/repl/topology_coordinator_impl.h"
#include "mongo/db/server_options.h"
+#include "mongo/logger/logger.h"
#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
index e68d84e9d6d..79d6f7e6727 100644
--- a/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
+++ b/src/mongo/db/repl/topology_coordinator_impl_v1_test.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/repl/topology_coordinator.h"
#include "mongo/db/repl/topology_coordinator_impl.h"
#include "mongo/db/server_options.h"
+#include "mongo/logger/logger.h"
#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/s/collection_sharding_state.h b/src/mongo/db/s/collection_sharding_state.h
index 62d8358c998..449c8b4ba6b 100644
--- a/src/mongo/db/s/collection_sharding_state.h
+++ b/src/mongo/db/s/collection_sharding_state.h
@@ -28,6 +28,7 @@
#pragma once
+#include <memory>
#include <string>
#include "mongo/base/disallow_copying.h"
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
index 31af3138035..79517b5b193 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -231,10 +231,10 @@ Status MigrationChunkClonerSourceLegacy::awaitUntilCriticalSectionIsAppropriate(
invariant(!txn->lockState()->isLocked());
auto scopedGuard = MakeGuard([&] { cancelClone(txn); });
- const Milliseconds startTime(curTimeMillis64());
+ const auto startTime = Date_t::now();
int iteration = 0;
- while ((Milliseconds(curTimeMillis64()) - startTime) < maxTimeToWait) {
+ while ((Date_t::now() - startTime) < maxTimeToWait) {
// Exponential sleep backoff, up to 1024ms. Don't sleep much on the first few iterations,
// since we want empty chunk migrations to be fast.
sleepmillis(1 << std::min(iteration, 10));
@@ -400,7 +400,7 @@ Status MigrationChunkClonerSourceLegacy::nextCloneBatch(OperationContext* txn,
ElapsedTracker tracker(txn->getServiceContext()->getFastClockSource(),
internalQueryExecYieldIterations,
- Milliseconds(internalQueryExecYieldPeriodMS));
+ Milliseconds(internalQueryExecYieldPeriodMS.load()));
stdx::lock_guard<stdx::mutex> sl(_mutex);
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index 9d8153e7a53..36592d6bd2e 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -326,10 +326,11 @@ bool MigrationDestinationManager::startCommit(const MigrationSessionId& sessionI
_state = COMMIT_START;
- const auto deadline = stdx::chrono::system_clock::now() + Seconds(30);
+ const auto deadline = Date_t::now() + Seconds(30);
while (_sessionId) {
- if (stdx::cv_status::timeout == _isActiveCV.wait_until(lock, deadline)) {
+ if (stdx::cv_status::timeout ==
+ _isActiveCV.wait_until(lock, deadline.toSystemTimePoint())) {
_state = FAIL;
log() << "startCommit never finished!" << migrateLog;
return false;
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index 242201ed57d..6c097090960 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -453,11 +453,12 @@ MigrationSourceManager::CriticalSectionState::CriticalSectionState() = default;
bool MigrationSourceManager::CriticalSectionState::waitUntilOutOfCriticalSection(
Microseconds waitTimeout) {
- const auto waitDeadline = stdx::chrono::system_clock::now() + waitTimeout;
+ const auto waitDeadline = Date_t::now() + waitTimeout;
stdx::unique_lock<stdx::mutex> sl(_criticalSectionMutex);
while (_inCriticalSection) {
- if (stdx::cv_status::timeout == _criticalSectionCV.wait_until(sl, waitDeadline)) {
+ if (stdx::cv_status::timeout ==
+ _criticalSectionCV.wait_until(sl, waitDeadline.toSystemTimePoint())) {
return false;
}
}
diff --git a/src/mongo/db/s/operation_sharding_state.cpp b/src/mongo/db/s/operation_sharding_state.cpp
index 40617c08138..01a0132df07 100644
--- a/src/mongo/db/s/operation_sharding_state.cpp
+++ b/src/mongo/db/s/operation_sharding_state.cpp
@@ -101,11 +101,12 @@ bool OperationShardingState::waitForMigrationCriticalSection(OperationContext* t
invariant(!txn->lockState()->isLocked());
if (_migrationCriticalSection) {
- const Microseconds operationRemainingTime(Microseconds(txn->getRemainingMaxTimeMicros()));
+ const Microseconds operationRemainingTime(
+ Microseconds(static_cast<int64_t>(txn->getRemainingMaxTimeMicros())));
_migrationCriticalSection->waitUntilOutOfCriticalSection(
durationCount<Microseconds>(operationRemainingTime)
? operationRemainingTime
- : kMaxWaitForMigrationCriticalSection);
+ : Microseconds{kMaxWaitForMigrationCriticalSection});
_migrationCriticalSection = nullptr;
return true;
}
diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp
index 16061c2cf9b..85c8916b4d0 100644
--- a/src/mongo/db/s/sharding_state.cpp
+++ b/src/mongo/db/s/sharding_state.cpp
@@ -133,7 +133,7 @@ Date_t getDeadlineFromMaxTimeMS(OperationContext* txn) {
return Date_t::now();
}
- return Date_t::now() + Microseconds(remainingTime);
+ return Date_t::now() + Microseconds(static_cast<int64_t>(remainingTime));
}
/**
diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h
index cd9d0de93b8..1cba9bdb05d 100644
--- a/src/mongo/db/service_context.h
+++ b/src/mongo/db/service_context.h
@@ -35,6 +35,7 @@
#include "mongo/db/storage/storage_engine.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/stdx/functional.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/clock_source.h"
#include "mongo/util/decorable.h"
#include "mongo/util/tick_source.h"
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp
index 9193c64f8c9..fda8ee146ed 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -61,6 +61,7 @@
#include "mongo/s/mongos_options.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/bufreader.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/print.h"
#include "mongo/util/unowned_ptr.h"
diff --git a/src/mongo/db/sorter/sorter.h b/src/mongo/db/sorter/sorter.h
index 5d19aef8c2d..ba6f3e3192f 100644
--- a/src/mongo/db/sorter/sorter.h
+++ b/src/mongo/db/sorter/sorter.h
@@ -30,6 +30,7 @@
#include <deque>
#include <fstream>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
diff --git a/src/mongo/db/stats/snapshots.h b/src/mongo/db/stats/snapshots.h
index 32ac1c6efbb..5013275265b 100644
--- a/src/mongo/db/stats/snapshots.h
+++ b/src/mongo/db/stats/snapshots.h
@@ -33,7 +33,7 @@
#include "mongo/base/status_with.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/stats/top.h"
-#include "mongo/platform/basic.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/background.h"
/**
diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp
index d7037b87b19..db74bd99ea8 100644
--- a/src/mongo/db/storage/mmap_v1/dur.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur.cpp
@@ -687,7 +687,7 @@ static void durThread(ClockSource* cs, int64_t serverStartMs) {
}
// +1 so it never goes down to zero
- const unsigned oneThird = (ms / 3) + 1;
+ const int64_t oneThird = (ms / 3) + 1;
// Reset the stats based on the reset interval
if (stats.curr()->getCurrentDurationMillis() > DurStatsResetIntervalMillis) {
@@ -699,7 +699,7 @@ static void durThread(ClockSource* cs, int64_t serverStartMs) {
for (unsigned i = 0; i <= 2; i++) {
if (stdx::cv_status::no_timeout ==
- flushRequested.wait_for(lock, Milliseconds(oneThird))) {
+ flushRequested.wait_for(lock, Milliseconds(oneThird).toSystemDuration())) {
// Someone forced a flush
break;
}
diff --git a/src/mongo/db/storage/mmap_v1/dur_journalimpl.h b/src/mongo/db/storage/mmap_v1/dur_journalimpl.h
index 5a7a6a63e7f..9a4d22fa826 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journalimpl.h
+++ b/src/mongo/db/storage/mmap_v1/dur_journalimpl.h
@@ -36,6 +36,7 @@
#include "mongo/db/storage/mmap_v1/dur_journalformat.h"
#include "mongo/db/storage/mmap_v1/logfile.h"
#include "mongo/platform/atomic_word.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/concurrency/mutex.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
index 69e700bc187..dfd429d0713 100644
--- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
@@ -53,6 +53,7 @@
#include "mongo/platform/strnlen.h"
#include "mongo/util/bufreader.h"
#include "mongo/util/checksum.h"
+#include "mongo/util/destructor_guard.h"
#include "mongo/util/exit.h"
#include "mongo/util/hex.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.h b/src/mongo/db/storage/mmap_v1/dur_recover.h
index 39925f9063f..b9b7c5ddfdb 100644
--- a/src/mongo/db/storage/mmap_v1/dur_recover.h
+++ b/src/mongo/db/storage/mmap_v1/dur_recover.h
@@ -32,8 +32,10 @@
#include <boost/filesystem/operations.hpp>
#include <list>
+#include <memory>
#include "mongo/db/storage/mmap_v1/dur_journalformat.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/concurrency/mutex.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/file_allocator.h b/src/mongo/db/storage/mmap_v1/file_allocator.h
index e3e4ad55881..988277dfe6d 100644
--- a/src/mongo/db/storage/mmap_v1/file_allocator.h
+++ b/src/mongo/db/storage/mmap_v1/file_allocator.h
@@ -27,12 +27,12 @@
* then also delete it in the license file.
*/
-#include "mongo/platform/basic.h"
-
-#include <list>
#include <boost/filesystem/path.hpp>
+#include <list>
+#include <map>
#include "mongo/stdx/condition_variable.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/concurrency/mutex.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp b/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp
index 22fa4cb2bce..535bc3fc447 100644
--- a/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_access_tracker.cpp
@@ -231,7 +231,7 @@ bool RecordAccessTracker::Rolling::access(size_t region,
if (rarelyCount++ % (2048 / BigHashSize) == 0) {
Date_t now = cs->now();
- if (now - _lastRotate > Seconds(RotateTimeSecs)) {
+ if (now - _lastRotate > Seconds(static_cast<int64_t>(RotateTimeSecs))) {
_rotate(cs);
}
}
diff --git a/src/mongo/db/storage/mmap_v1/record_access_tracker.h b/src/mongo/db/storage/mmap_v1/record_access_tracker.h
index e88a6b280ae..c4ec579c720 100644
--- a/src/mongo/db/storage/mmap_v1/record_access_tracker.h
+++ b/src/mongo/db/storage/mmap_v1/record_access_tracker.h
@@ -28,8 +28,10 @@
#pragma once
+#include <memory>
#include "mongo/util/concurrency/mutex.h"
+#include "mongo/util/time_support.h"
namespace mongo {
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp
index 589706daed4..2ad2b519ec2 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_options_init.cpp
@@ -28,12 +28,15 @@
* it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/util/options_parser/startup_option_init.h"
#include <iostream>
-#include "mongo/util/options_parser/startup_options.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_global_options.h"
+#include "mongo/util/exit_code.h"
+#include "mongo/util/options_parser/startup_options.h"
namespace mongo {