diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2017-03-15 12:13:35 -0400 |
---|---|---|
committer | Jack Mulrow <jack.mulrow@mongodb.com> | 2017-03-17 10:38:11 -0400 |
commit | 9c47a56c17f9c155f7794c09020893bfa80cb05d (patch) | |
tree | b24fc3fdc51ce9438897e7492682d5162797cc04 /src/mongo/db/logical_clock.h | |
parent | 9e7974e4b6e2b3fe5e7741dce6549624113af196 (diff) | |
download | mongo-9c47a56c17f9c155f7794c09020893bfa80cb05d.tar.gz |
SERVER-27721 Implement rate limiter check for advancing logical clocks
Diffstat (limited to 'src/mongo/db/logical_clock.h')
-rw-r--r-- | src/mongo/db/logical_clock.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/logical_clock.h b/src/mongo/db/logical_clock.h index 0369eb9a641..aabe9a07c89 100644 --- a/src/mongo/db/logical_clock.h +++ b/src/mongo/db/logical_clock.h @@ -50,6 +50,9 @@ public: static LogicalClock* get(OperationContext* ctx); static void set(ServiceContext* service, std::unique_ptr<LogicalClock> logicalClock); + static constexpr Seconds kMaxAcceptableLogicalClockDrift = + Seconds(365 * 24 * 60 * 60); // 1 year + /** * Creates an instance of LogicalClock. The TimeProofService must already be fully initialized. */ @@ -100,6 +103,12 @@ private: Status _advanceClusterTime_inlock(SignedLogicalTime newTime); + /** + * Rate limiter for advancing logical time. Rejects newTime if its seconds value is more than + * kMaxAcceptableLogicalClockDrift seconds ahead of this node's wall clock. + */ + Status _passesRateLimiter_inlock(LogicalTime newTime); + ServiceContext* const _service; std::unique_ptr<TimeProofService> _timeProofService; |