diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-05-18 14:01:04 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-05-18 14:01:04 +0000 |
commit | 39228644d50526eba3732e1deff193b17ad869a4 (patch) | |
tree | 798288e6cfbd21031dc0edab13b8b1c4dd5c3be1 /storage/src/tests/common/teststorageapp.cpp | |
parent | 8bf0c34f48471825ce15666893c1282ae6e5a1c0 (diff) |
Make distributor timestamp generation thread safe
New behavior:
- Only allow time to travel forwards within a given distributor process'
lifetime. This is a change from the old behavior, which would emit a
warning to the logs and happily continue from a previously used second,
possibly causing the distributor to reuse timestamps.
- Try to detect cases where the wall clock has been transiently set far
into the future--only to bounce back--by aborting the process if the
current observed time is more than 120 seconds older than the highest
observed wall clock time. This is an attempt to avoid generating _too_
many bogus future timestamps, as the distributor would otherwise continue
generating timestamps within the highest observed second.
Diffstat (limited to 'storage/src/tests/common/teststorageapp.cpp')
-rw-r--r-- | storage/src/tests/common/teststorageapp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp index e61050c21a3..7891f21a73d 100644 --- a/storage/src/tests/common/teststorageapp.cpp +++ b/storage/src/tests/common/teststorageapp.cpp @@ -226,7 +226,7 @@ TestDistributorApp::TestDistributorApp(NodeIndex index, vespalib::stringref conf TestDistributorApp::~TestDistributorApp() = default; api::Timestamp -TestDistributorApp::getUniqueTimestamp() +TestDistributorApp::generate_unique_timestamp() { std::lock_guard guard(_accessLock); uint64_t timeNow(getClock().getTimeInSeconds().getTime()); |