summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <andrew.morton@mongodb.com>2023-05-15 21:40:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-16 02:14:04 +0000
commit264f4073992026689b5ade083d80111852b3ee18 (patch)
treecc2783181b9c94eba6fa05719fa5f2b63fc46fa3
parentc258ce452318f389dd5c2d971e3cebfc974b2caf (diff)
downloadmongo-264f4073992026689b5ade083d80111852b3ee18.tar.gz
Import wiredtiger: 2a63f4a39c3a74467005c2c7423823f22f5af394 from branch mongodb-master
ref: 13fbda20ff..2a63f4a39c for: 7.1.0-rc0 WT-11051 Fix newest start durable timestamp comparison in aggregate timestamp validation
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/support/timestamp.c59
2 files changed, 57 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 1512570cc5e..cef97e34740 100644
--- a/src/third_party/wiredtiger/import.data
+++ b/src/third_party/wiredtiger/import.data
@@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
- "commit": "13fbda20ff0f2383c13dd9669273f393f12c4ecb"
+ "commit": "2a63f4a39c3a74467005c2c7423823f22f5af394"
}
diff --git a/src/third_party/wiredtiger/src/support/timestamp.c b/src/third_party/wiredtiger/src/support/timestamp.c
index 715d340309c..4a7bbcda4d8 100644
--- a/src/third_party/wiredtiger/src/support/timestamp.c
+++ b/src/third_party/wiredtiger/src/support/timestamp.c
@@ -245,6 +245,57 @@ __wt_time_aggregate_validate(
{
char time_string[2][WT_TIME_STRING_SIZE];
+ /*
+ * The aggregated time window values that are tracked at the page level.
+ * newest_start_durable_ts - The default value is WT_TS_NONE. It tracks the maximum durable
+ timestamp of all the inserts, updates, or modify operations performed on a page.
+ * newest_stop_durable_ts - The default value is WT_TS_NONE. It tracks the maximum durable
+ timestamp of all the the delete operations performed on a page.
+ * oldest_start_ts - The default value is WT_TS_NONE. It tracks the minimum commit timestamp
+ of any inserts performed on a page.
+ * newest_txn - The default value is WT_TXN_NONE. It tracks the maximum transaction id of any
+ modification (insert/delete) performed on a page.
+ * newest_stop_ts - The default value is WT_TS_MAX. It tracks the maximum commit timestamp of
+ a delete operation on a page. If there is no removal for a key, this value will be WT_TS_MAX.
+ * newest_stop_txn - The default value is WT_TXN_MAX. It tracks the maximum commit
+ transaction id of a delete operation on a page. If there is no removal for a key, this value
+ will be WT_TXN_MAX.
+ *
+ *
+ * Three scenarios might happen at any point of time.
+ * Scenario 1 - No deletes on the page, only inserts and updates.
+ * newest_start_durable_ts will be some valid value (not WT_TS_MAX or WT_TS_NONE)
+ * oldest_start_ts will be the minimum commit timestamp of any inserts performed on a page.
+ * newest_stop_durable_ts will be WT_TS_NONE
+ * newest_stop_ts will be WT_TS_MAX since there is no removal of any key.
+ * newest_txn will be the maximum transaction id of any modification (insert/delete)
+ performed on a page.
+ * newest_stop_txn will be WT_TXN_MAX.
+
+ * Scenario 2 - All the entries on the page are deleted.
+ * newest_start_durable_ts will be some valid value (not WT_TS_MAX or WT_TS_NONE)
+ * oldest_start_ts will be the minimum commit timestamp of any inserts performed on a page.
+ * newest_stop_durable_ts will be some valid value (not WT_TS_MAX or WT_TS_NONE)
+ * newest_stop_ts will be maximum commit timestamp of any delete operation on a page but not
+ WT_TS_MAX.
+ * newest_txn will be the maximum transaction id of any modification (insert/delete)
+ performed on a page.
+ * newest_stop_txn will be the maximum commit transaction id of any delete operation on a
+ page but cannot be WT_TXN_MAX
+
+ * Scenario 3 - Some entries are deleted, but not all.
+ * newest_start_durable_ts will be some valid value (not WT_TS_MAX or WT_TS_NONE)
+ * oldest_start_ts will be the minimum commit timestamp of any inserts performed on a page.
+ * newest_stop_durable_ts will be the maximum durable timestamp of all the deletes performed
+ on a page.
+ * newest_stop_ts can be WT_TS_MAX or any valid value
+ * newest_txn will be the maximum transaction id of any modification (insert/delete)
+ performed on a page.
+ * newest_stop_txn will be the maximum commit transaction id of any delete operation on a
+ page but cannot be WT_TXN_MAX
+ *
+ */
+
if (ta->oldest_start_ts > ta->newest_stop_ts)
WT_TIME_VALIDATE_RET(session,
"aggregate time window has an oldest start time after its newest stop time; time "
@@ -272,12 +323,14 @@ __wt_time_aggregate_validate(
/*
* In the case of missing timestamps, we assign the start point to the stop point and newest
* start durable timestamp may be larger than newest stop timestamp. Check whether start and
- * stop are equal first.
+ * stop are equal first and then check the newest start durable timestamp against newest stop
+ * durable timestamp if all the data on the page are deleted.
*/
if (ta->newest_start_durable_ts != ta->newest_stop_durable_ts &&
- ta->newest_start_durable_ts > ta->newest_stop_ts)
+ ta->newest_stop_ts != WT_TS_MAX && ta->newest_start_durable_ts > ta->newest_stop_durable_ts)
WT_TIME_VALIDATE_RET(session,
- "aggregate time window has a newest stop durable time after its newest stop time; time "
+ "aggregate time window has a newest start durable time after its newest stop durable "
+ "time; time "
"aggregate %s",
__wt_time_aggregate_to_string(ta, time_string[0]));