diff options
author | ali-mir <ali.mir@mongodb.com> | 2021-10-08 15:15:55 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-08 16:36:10 +0000 |
commit | 05ce07113980c285bf6d8cbb707e4fb96f160239 (patch) | |
tree | 27f390ed863f9dadfa517b1aee3360e4e1978802 /src/mongo/db | |
parent | 292a5a011cf8d1aa32a8f33e44ea21f2b4609d84 (diff) | |
download | mongo-05ce07113980c285bf6d8cbb707e4fb96f160239.tar.gz |
SERVER-60544 Replace remaining references to slaveDelay in replication system
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/repl/member_config.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_batcher.cpp | 17 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_batcher.h | 14 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state_impl.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/topology_coordinator.cpp | 2 |
5 files changed, 18 insertions, 19 deletions
diff --git a/src/mongo/db/repl/member_config.cpp b/src/mongo/db/repl/member_config.cpp index c4eaddf4d20..8a8d954423b 100644 --- a/src/mongo/db/repl/member_config.cpp +++ b/src/mongo/db/repl/member_config.cpp @@ -92,7 +92,7 @@ MemberConfig::MemberConfig(const BSONObj& mcfg) { uasserted(ErrorCodes::BadValue, "priority must be 0 when non-voting (votes:0)"); } if (getSecondaryDelay() > Seconds(0)) { - uasserted(ErrorCodes::BadValue, "priority must be 0 when slaveDelay is used"); + uasserted(ErrorCodes::BadValue, "priority must be 0 when secondaryDelaySecs is used"); } if (isHidden()) { uasserted(ErrorCodes::BadValue, "priority must be 0 when hidden=true"); diff --git a/src/mongo/db/repl/oplog_batcher.cpp b/src/mongo/db/repl/oplog_batcher.cpp index 31071a90cb3..1fe68d71f3b 100644 --- a/src/mongo/db/repl/oplog_batcher.cpp +++ b/src/mongo/db/repl/oplog_batcher.cpp @@ -177,10 +177,10 @@ StatusWith<std::vector<OplogEntry>> OplogBatcher::getNextApplierBatch( << ", oplog entry: " << redact(entry.toBSONForLogging())}; } - if (batchLimits.slaveDelayLatestTimestamp) { + if (batchLimits.secondaryDelaySecsLatestTimestamp) { auto entryTime = Date_t::fromDurationSinceEpoch(Seconds(entry.getTimestamp().getSecs())); - if (entryTime > *batchLimits.slaveDelayLatestTimestamp) { + if (entryTime > *batchLimits.secondaryDelaySecsLatestTimestamp) { if (ops.empty()) { // Sleep if we've got nothing to do. Only sleep for 1 second at a time to allow // reconfigs and shutdown to occur. @@ -226,18 +226,18 @@ StatusWith<std::vector<OplogEntry>> OplogBatcher::getNextApplierBatch( } /** - * If slaveDelay is enabled, this function calculates the most recent timestamp of any oplog + * If secondaryDelaySecs is enabled, this function calculates the most recent timestamp of any oplog * entries that can be be returned in a batch. */ -boost::optional<Date_t> OplogBatcher::_calculateSlaveDelayLatestTimestamp() { +boost::optional<Date_t> OplogBatcher::_calculateSecondaryDelaySecsLatestTimestamp() { auto service = cc().getServiceContext(); auto replCoord = ReplicationCoordinator::get(service); - auto slaveDelay = replCoord->getSecondaryDelaySecs(); - if (slaveDelay <= Seconds(0)) { + auto secondaryDelaySecs = replCoord->getSecondaryDelaySecs(); + if (secondaryDelaySecs <= Seconds(0)) { return {}; } auto fastClockSource = service->getFastClockSource(); - return fastClockSource->now() - slaveDelay; + return fastClockSource->now() - secondaryDelaySecs; } void OplogBatcher::_consume(OperationContext* opCtx, OplogBuffer* oplogBuffer) { @@ -259,7 +259,8 @@ void OplogBatcher::_run(StorageInterface* storageInterface) { while (true) { globalFailPointRegistry().find("rsSyncApplyStop")->pauseWhileSet(); - batchLimits.slaveDelayLatestTimestamp = _calculateSlaveDelayLatestTimestamp(); + batchLimits.secondaryDelaySecsLatestTimestamp = + _calculateSecondaryDelaySecsLatestTimestamp(); // Check the limits once per batch since users can change them at runtime. batchLimits.ops = getBatchLimitOplogEntries(); diff --git a/src/mongo/db/repl/oplog_batcher.h b/src/mongo/db/repl/oplog_batcher.h index 1449af45ed8..21ce5010d80 100644 --- a/src/mongo/db/repl/oplog_batcher.h +++ b/src/mongo/db/repl/oplog_batcher.h @@ -130,9 +130,9 @@ public: size_t ops = 0; // If provided, the batch will not include any operations with timestamps after this point. - // This is intended for implementing slaveDelay, so it should be some number of seconds - // before now. - boost::optional<Date_t> slaveDelayLatestTimestamp = {}; + // This is intended for implementing secondaryDelaySecs, so it should be some number of + // seconds before now. + boost::optional<Date_t> secondaryDelaySecsLatestTimestamp = {}; // If non-null, the batch will include operations with timestamps either // before-and-including this point or after it, not both. @@ -167,7 +167,7 @@ public: * A batch may consist of: * at most "BatchLimits::ops" OplogEntries * at most "BatchLimits::bytes" worth of OplogEntries - * only OplogEntries from before the "BatchLimits::slaveDelayLatestTimestamp" point + * only OplogEntries from before the "BatchLimits::secondaryDelaySecsLatestTimestamp" point * a single command OplogEntry (excluding applyOps, which are grouped with CRUD ops) */ StatusWith<std::vector<OplogEntry>> getNextApplierBatch(OperationContext* opCtx, @@ -187,10 +187,10 @@ public: private: /** - * If slaveDelay is enabled, this function calculates the most recent timestamp of any oplog - * entries that can be be returned in a batch. + * If secondaryDelaySecs is enabled, this function calculates the most recent timestamp of any + * oplog entries that can be be returned in a batch. */ - boost::optional<Date_t> _calculateSlaveDelayLatestTimestamp(); + boost::optional<Date_t> _calculateSecondaryDelaySecsLatestTimestamp(); /** * Pops the operation at the front of the OplogBuffer. diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp index 605593200b0..09edf7eac04 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp @@ -295,7 +295,7 @@ void ReplicationCoordinatorExternalStateImpl::_stopDataReplication_inlock( // Clear the buffer. This unblocks the OplogFetcher if it is blocked with a full queue, but // ensures that it won't add anything. It will also unblock the OplogApplier pipeline if it - // is waiting for an operation to be past the slaveDelay point. + // is waiting for an operation to be past the secondaryDelaySecs point. if (oldOplogBuffer) { oldOplogBuffer->clear(opCtx); } diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp index b45d6cad5e8..a3df552f4df 100644 --- a/src/mongo/db/repl/topology_coordinator.cpp +++ b/src/mongo/db/repl/topology_coordinator.cpp @@ -3007,8 +3007,6 @@ long long TopologyCoordinator::getTerm() const { return _term; } -// TODO(siyuan): Merge _hddata into _slaveInfo, so that we have a single view of the -// replset. Passing metadata is unnecessary. bool TopologyCoordinator::shouldChangeSyncSource(const HostAndPort& currentSource, const rpc::ReplSetMetadata& replMetadata, const rpc::OplogQueryMetadata& oqMetadata, |