Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-65001

Update timestamp query API calls for WiredTiger change

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Execution Team 2022-04-18, Execution Team 2022-05-02

      In WT-8973, WiredTiger made its timestamp APIs consistent including requiring a timestamp of 0 act as an out-of-band timestamp value.

      In summary, it is now an error to set a timestamp of 0, and retrieving a timestamp that WiredTiger does not have will return a timestamp of 0 (previously, some cases returned a timestamp of 0 and some cases returned a WT_NOTFOUND error).

      This change breaks the MDB patch build.

      Here is a patch build (including the suggested changes below): https://spruce.mongodb.com/version/6241e82857e85a7c4f4a27d6/tasks

      Here are some suggested changes:

      diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
      index 8a313d5c2d8..2aedf61444d 100644
      --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
      +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
      @@ -484,12 +484,10 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName,
       
           {
               char buf[(2 * 8 /*bytes in hex*/) + 1 /*nul terminator*/];
      -        int ret = _conn->query_timestamp(_conn, buf, "get=oldest");
      -        if (ret != WT_NOTFOUND) {
      -            invariantWTOK(ret, nullptr);
      -
      -            std::uint64_t tmp;
      -            fassert(5380107, NumberParser().base(16)(buf, &tmp));
      +        invariantWTOK(_conn->query_timestamp(_conn, buf, "get=oldest"), nullptr);
      +        std::uint64_t tmp;
      +        fassert(5380107, NumberParser().base(16)(buf, &tmp));
      +        if (tmp != 0) {
                   LOGV2_FOR_RECOVERY(
                       5380106, 0, "WiredTiger oldestTimestamp", "oldestTimestamp"_attr = Timestamp(tmp));
                   // The oldest timestamp is set in WT. Only set the in-memory variable.
      @@ -2092,17 +2090,14 @@ uint64_t _fetchAllDurableValue(WT_CONNECTION* conn) {
           // Fetch the latest all_durable value from the storage engine. This value will be a timestamp
           // that has no holes (uncommitted transactions with lower timestamps) behind it.
           char buf[(2 * 8 /*bytes in hex*/) + 1 /*nul terminator*/];
      -    auto wtStatus = conn->query_timestamp(conn, buf, "get=all_durable");
      -    if (wtStatus == WT_NOTFOUND) {
      +    invariantWTOK(conn->query_timestamp(conn, buf, "get=all_durable"), nullptr);
      +    uint64_t tmp;
      +    fassert(38002, NumberParser().base(16)(buf, &tmp));
      +    if (tmp == 0) {
               // Treat this as lowest possible timestamp; we need to see all preexisting data but no new
               // (timestamped) data.
               return StorageEngine::kMinimumTimestamp;
      -    } else {
      -        invariantWTOK(wtStatus, nullptr);
           }
      -
      -    uint64_t tmp;
      -    fassert(38002, NumberParser().base(16)(buf, &tmp));
           return tmp;
       }
       }  // namespace
      

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: