summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c')
-rw-r--r--src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
index 0a17f020b05..1238681fd57 100644
--- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
+++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c
@@ -18,6 +18,8 @@
WT_DECL_VERBOSE_MULTI_CATEGORY(((WT_VERBOSE_CATEGORY[]){WT_VERB_RECOVERY, WT_VERB_RTS})) : \
WT_DECL_VERBOSE_MULTI_CATEGORY(((WT_VERBOSE_CATEGORY[]){WT_VERB_RTS})))
+static bool __rollback_txn_visible_id(WT_SESSION_IMPL *session, uint64_t id);
+
/*
* __rollback_delete_hs --
* Delete the updates for a key in the history store until the first update (including) that is
@@ -91,7 +93,19 @@ __rollback_abort_update(WT_SESSION_IMPL *session, WT_ITEM *key, WT_UPDATE *first
if (upd->txnid == WT_TXN_ABORTED)
continue;
- if (rollback_timestamp < upd->durable_ts || upd->prepare_state == WT_PREPARE_INPROGRESS) {
+ /*
+ * An unstable update needs to be aborted if any of the following are true:
+ * 1. An update is invisible based on the checkpoint snapshot during recovery.
+ * 2. The update durable timestamp is greater than the stable timestamp.
+ * 3. The update is a prepared update.
+ *
+ * Usually during recovery, there are no in memory updates present on the page. But
+ * whenever an unstable fast truncate operation is written to the disk, as part
+ * of the rollback to stable page read, it instantiates the tombstones on the page.
+ * The transaction id validation is ignored in all scenarios except recovery.
+ */
+ if (!__rollback_txn_visible_id(session, upd->txnid) ||
+ rollback_timestamp < upd->durable_ts || upd->prepare_state == WT_PREPARE_INPROGRESS) {
__wt_verbose_multi(session, WT_VERB_RECOVERY_RTS(session),
"rollback to stable update aborted with txnid: %" PRIu64
" durable timestamp: %s and stable timestamp: %s, prepared: %s",
@@ -1180,9 +1194,10 @@ __rollback_page_needs_abort(
}
__wt_verbose_multi(session, WT_VERB_RECOVERY_RTS(session),
- "%p: page with %s durable timestamp: %s, newest txn: %" PRIu64 " and prepared updates: %s",
+ "%p: page with %s durable timestamp: %s, newest txn: %" PRIu64
+ " and prepared updates: %s needs abort: %s",
(void *)ref, tag, __wt_timestamp_to_string(durable_ts, ts_string), newest_txn,
- prepared ? "true" : "false");
+ prepared ? "true" : "false", result ? "true" : "false");
return (result);
}
@@ -1276,6 +1291,10 @@ __rollback_to_stable_page_skip(
WT_ASSERT(session,
page_del == NULL || page_del->prepare_state == WT_PREPARE_INIT ||
page_del->prepare_state == WT_PREPARE_RESOLVED);
+
+ __wt_verbose_multi(
+ session, WT_VERB_RECOVERY_RTS(session), "%p: deleted page walk skipped", (void *)ref);
+ WT_STAT_CONN_INCR(session, txn_rts_tree_walk_skip_pages);
*skipp = true;
}
WT_REF_SET_STATE(ref, WT_REF_DELETED);