Skip to content

Commit

Permalink
WT-8444 Fixing CppSuite stable timestamp calculation (#7256)
Browse files Browse the repository at this point in the history
* Fixing the stable timestamp to be behind the current timestamp by stable_lag amount
* Updating stress configuration for hs_cleanup test
  • Loading branch information
luke-pearson committed Dec 1, 2021
1 parent 7f96852 commit 165d9a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/cppsuite/configs/hs_cleanup_stress.txt
Expand Up @@ -27,8 +27,8 @@ runtime_monitor=
limit=1900000000,
),
# Seems to insert around 477K records. Give it +-20K margin.
# Seems to remove 180K records. Give it a similar margin.
postrun_statistics=[cache_hs_insert:457000:497000, cc_pages_removed:170000:200000]
# Seems to remove 160K records. Give it a similar margin.
postrun_statistics=[cache_hs_insert:457000:497000, cc_pages_removed:150000:170000]
),
timestamp_manager=
(
Expand Down
15 changes: 7 additions & 8 deletions test/cppsuite/test_harness/timestamp_manager.cxx
Expand Up @@ -71,20 +71,18 @@ timestamp_manager::do_work()
{
std::string config, log_msg;
/* latest_ts_s represents the time component of the latest timestamp provided. */
wt_timestamp_t latest_ts_s;

/* Timestamps are checked periodically. */
latest_ts_s = get_time_now_s();
wt_timestamp_t latest_ts_s = get_time_now_s();

/*
* Keep a time window between the latest and stable ts less than the max defined in the
* configuration.
*/
wt_timestamp_t new_stable_ts = _stable_ts;
testutil_assert(latest_ts_s >= _stable_ts);
if ((latest_ts_s - _stable_ts) > _stable_lag) {
log_msg = "Timestamp_manager: Stable timestamp expired.";
_stable_ts = latest_ts_s;
config += STABLE_TS + "=" + decimal_to_hex(_stable_ts);
new_stable_ts = latest_ts_s - _stable_lag;
config += STABLE_TS + "=" + decimal_to_hex(new_stable_ts);
}

/*
Expand All @@ -93,12 +91,12 @@ timestamp_manager::do_work()
*/
wt_timestamp_t new_oldest_ts = _oldest_ts;
testutil_assert(_stable_ts >= _oldest_ts);
if ((_stable_ts - _oldest_ts) > _oldest_lag) {
if ((new_stable_ts - _oldest_ts) > _oldest_lag) {
if (log_msg.empty())
log_msg = "Timestamp_manager: Oldest timestamp expired.";
else
log_msg += " Oldest timestamp expired.";
new_oldest_ts = _stable_ts - _oldest_lag;
new_oldest_ts = new_stable_ts - _oldest_lag;
if (!config.empty())
config += ",";
config += OLDEST_TS + "=" + decimal_to_hex(new_oldest_ts);
Expand All @@ -115,6 +113,7 @@ timestamp_manager::do_work()
if (!config.empty()) {
connection_manager::instance().set_timestamp(config);
_oldest_ts = new_oldest_ts;
_stable_ts = new_stable_ts;
}
}

Expand Down

0 comments on commit 165d9a7

Please sign in to comment.