Skip to content

Commit

Permalink
Update version map unsync tolerance to 200ms
Browse files Browse the repository at this point in the history
Before this change version_map's reload_interval was equal to the
unsync_tolerance. This means that we would ~always miss the cache.

The check for outdated cache is as follows:
- When reading into cache set `last_reload_time = now -
  unsync_tolerance`
- When checking if cache is outdated we check whether `now -
  last_reload_time > reload_interval

This change updates the unsync tolerance to 200ms. This will mean the
cache is valid for 1.8s
  • Loading branch information
IvoDD committed Mar 26, 2024
1 parent bf97d88 commit 9a3b148
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cpp/arcticdb/util/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ constexpr auto string_nan = std::numeric_limits<position_t>::max() - 1;

constexpr auto NaT = std::numeric_limits<timestamp>::min();

static constexpr decltype(timestamp(0) - timestamp(0)) ONE_SECOND = 1'000'000'000;
static constexpr decltype(timestamp(0) - timestamp(0)) ONE_MILLISECOND = 1'000'000;

static constexpr decltype(timestamp(0) - timestamp(0)) ONE_SECOND = 1'000 * ONE_MILLISECOND;

static constexpr decltype(timestamp(0) - timestamp(0)) ONE_MINUTE = 60 * ONE_SECOND;

Expand Down
2 changes: 1 addition & 1 deletion cpp/arcticdb/version/version_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class VersionMapImpl {
*/
using MapType = std::map<StreamId, std::shared_ptr<VersionMapEntry>>;

static constexpr uint64_t DEFAULT_CLOCK_UNSYNC_TOLERANCE = ONE_SECOND * 2;
static constexpr uint64_t DEFAULT_CLOCK_UNSYNC_TOLERANCE = ONE_MILLISECOND * 200;
static constexpr uint64_t DEFAULT_RELOAD_INTERVAL = ONE_SECOND * 2;
MapType map_;
bool validate_ = false;
Expand Down

0 comments on commit 9a3b148

Please sign in to comment.