[SERVER-65001] Update timestamp query API calls for WiredTiger change Created: 28/Mar/22  Updated: 29/Oct/23  Resolved: 20/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Keith Bostic (Inactive) Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-65719 Coverity analysis defect 122112: Stru... Closed
Gantt Dependency
has to be done before WT-8973 Define semantics of zero timestamp in... Closed
Problem/Incident
causes SERVER-65719 Coverity analysis defect 122112: Stru... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-04-18, Execution Team 2022-05-02
Participants:

 Description   

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



 Comments   
Comment by Githook User [ 20/Apr/22 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-65001 Remove support for the old WiredTiger timestamp query API
Branch: master
https://github.com/mongodb/mongo/commit/6386bf4bfab42becebc867061c2c80d9ac6e18b5

Comment by Githook User [ 15/Apr/22 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-65001 Update timestamp query API calls for WiredTiger change
Branch: master
https://github.com/mongodb/mongo/commit/4001c6ac5a464651174710e3cb38f269b27460ee

Comment by Keith Bostic (Inactive) [ 28/Mar/22 ]

geert.bosch, daniel.gottlieb, louis.williams:

I'll mark WT-8973 blocked on SERVER-65001, please let me know if you have concerns about this change or don't want to take it for any reason. I think the only way we can keep MDB builds green will be to change the src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp code to accept either a WT_NOTFOUND return or a timestamp of 0, then merge WT-8973, then update MDB to no longer accept a return of WT_NOTFOUND. If there's something I can do to make this simpler, please let me know.

Generated at Thu Feb 08 06:01:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.