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.c24
1 files changed, 21 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 1238681fd57..444374bda1f 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
@@ -55,12 +55,22 @@ __rollback_delete_hs(WT_SESSION_IMPL *session, WT_ITEM *key, wt_timestamp_t ts)
for (; ret == 0; ret = hs_cursor->prev(hs_cursor)) {
/* Retrieve the time window from the history cursor. */
__wt_hs_upd_time_window(hs_cursor, &hs_tw);
- if (hs_tw->start_ts < ts)
+
+ /*
+ * Remove all history store versions with a stop timestamp greater than the start/stop
+ * timestamp of a stable update in the data store.
+ */
+ if (hs_tw->stop_ts <= ts)
break;
WT_ERR(hs_cursor->remove(hs_cursor));
WT_STAT_CONN_DATA_INCR(session, txn_rts_hs_removed);
- if (hs_tw->start_ts == ts)
+
+ /*
+ * The globally visible start time window's are cleared during history store reconciliation.
+ * Treat them also as a stable entry removal from the history store.
+ */
+ if (hs_tw->start_ts == ts || hs_tw->start_ts == WT_TS_NONE)
WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_rts);
else
WT_STAT_CONN_DATA_INCR(session, cache_hs_key_truncate_rts_unstable);
@@ -1865,7 +1875,15 @@ __rollback_to_stable_btree_apply_all(WT_SESSION_IMPL *session, wt_timestamp_t ro
}
WT_ERR_NOTFOUND_OK(ret, false);
- if (F_ISSET(S2C(session), WT_CONN_RECOVERING))
+ /*
+ * Performing eviction in parallel to a checkpoint can lead to situation where the history store
+ * have more updates than its corresponding data store. Performing history store cleanup at the
+ * end can able to remove any such unstable updates that are written to the history store.
+ *
+ * Do not perform the final pass on the history store in an in-memory configuration as it
+ * doesn't exist.
+ */
+ if (!F_ISSET(S2C(session), WT_CONN_IN_MEMORY))
WT_ERR(__rollback_to_stable_hs_final_pass(session, rollback_timestamp));
err: