From f5da0ae928daf0366aeba3391b2865147c83f4eb Mon Sep 17 00:00:00 2001 From: Etienne Petrel Date: Mon, 14 Mar 2022 04:17:27 +0000 Subject: Import wiredtiger: 23e5746ea948e3b1ac903f2cce3ea209e19329a1 from branch mongodb-master ref: 5e2e0e9d66..23e5746ea9 for: 6.0.0 WT-8879 Set the OOO flag when the selected tombstone is globally visible --- src/third_party/wiredtiger/import.data | 2 +- .../wiredtiger/src/reconcile/rec_visibility.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 4d057dd5fbb..86408a28926 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": "5e2e0e9d66e7c02b5643257871280e63be420ab5" + "commit": "23e5746ea948e3b1ac903f2cce3ea209e19329a1" } diff --git a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c index 3c3e3d4c575..155470afe28 100644 --- a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c +++ b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c @@ -679,16 +679,25 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, W * Set the flag if the selected tombstone is an out-of-order or mixed mode to an update. Based * on this flag, the caller functions perform the history store truncation for this key. */ - if (tombstone != NULL && + if (!is_hs_page && tombstone != NULL && !F_ISSET(tombstone, WT_UPDATE_RESTORED_FROM_DS | WT_UPDATE_RESTORED_FROM_HS)) { upd = upd_select->upd; - WT_ASSERT(session, upd != NULL); + /* + * The selected update can be the tombstone itself when the tombstone is globally visible. + * Compare the tombstone's timestamp with either the next update in the update list or the + * on-disk cell timestamp to determine if the tombstone is an out-of-order or mixed mode. + */ + if (tombstone == upd) { + upd = upd->next; - if (upd->start_ts > tombstone->start_ts) - upd_select->ooo_tombstone = true; + /* Loop until a valid update is found. */ + while (upd != NULL && upd->txnid == WT_TXN_ABORTED) + upd = upd->next; + } - if (vpack != NULL && vpack->tw.start_ts > upd->start_ts) + if ((upd != NULL && upd->start_ts > tombstone->start_ts) || + (vpack != NULL && vpack->tw.start_ts > tombstone->start_ts)) upd_select->ooo_tombstone = true; } -- cgit v1.2.1