Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-7730

Shifting the oldest and stable timestamps to match the commit timestamp format

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 4.4.8, 5.0.2, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • 3
    • Storage - Ra 2021-06-28

      In diagnosing the cache stuck issue encountered by Alex C I noticed our stable and oldest timestamps get set too far back in time, we should fix this and it will resolve any cache stuck issues.

      Patch:

      diff --git a/test/cppsuite/test_harness/timestamp_manager.h b/test/cppsuite/test_harness/timestamp_manager.h
      index 24f0e3e41..a000a5e0d 100644
      --- a/test/cppsuite/test_harness/timestamp_manager.h
      +++ b/test/cppsuite/test_harness/timestamp_manager.h
      @@ -53,8 +53,10 @@ class timestamp_manager : public component {
               _oldest_lag = _config->get_int(OLDEST_LAG);
               testutil_assert(_oldest_lag >= 0);
      +        _oldest_lag = _oldest_lag << 32;
               _stable_lag = _config->get_int(STABLE_LAG);
               testutil_assert(_stable_lag >= 0);
      +        _stable_lag = _stable_lag << 32;
           }
           void
      @@ -65,11 +67,12 @@ class timestamp_manager : public component {
               wt_timestamp_t latest_ts_s;
               /* Timestamps are checked periodically. */
      -        latest_ts_s = (get_next_ts() >> 32);
      +        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.
                */
      +        std::cout << std::hex << latest_ts_s << " " << _stable_ts << std::endl;
               testutil_assert(latest_ts_s >= _stable_ts);
               if ((latest_ts_s - _stable_ts) > _stable_lag) {
                   debug_print("Timestamp_manager: Stable timestamp expired.", DEBUG_INFO);
      @@ -107,7 +110,7 @@ class timestamp_manager : public component {
               uint64_t current_time = get_time_now_s();
               _increment_ts.fetch_add(1);
      -        current_time = (current_time << 32) | (_increment_ts & 0x00000000FFFFFFFF);
      +        current_time = (current_time) | (_increment_ts & 0x00000000FFFFFFFF);
               _latest_ts = current_time;
               return (_latest_ts);
      @@ -128,7 +131,7 @@ class timestamp_manager : public component {
           {
               auto now = std::chrono::system_clock::now().time_since_epoch();
               uint64_t current_time_s =
      -          static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(now).count());
      +          static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(now).count()) << 32;
               return (current_time_s);
           }
       

            Assignee:
            luke.pearson@mongodb.com Luke Pearson
            Reporter:
            luke.pearson@mongodb.com Luke Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: