diff options
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.c | 29 |
1 files changed, 13 insertions, 16 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 de53843e3c9..2c97ddf48c7 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 @@ -169,7 +169,7 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW uint8_t type; int cmp; char ts_string[4][WT_TS_INT_STRING_SIZE]; - bool is_owner, valid_update_found; + bool valid_update_found; #ifdef HAVE_DIAGNOSTIC bool first_record; #endif @@ -180,7 +180,7 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW hs_btree_id = S2BT(session)->id; session_flags = 0; WT_CLEAR(full_value); - is_owner = valid_update_found = false; + valid_update_found = false; #ifdef HAVE_DIAGNOSTIC first_record = true; #endif @@ -200,7 +200,7 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW newer_hs_durable_ts = unpack->tw.durable_start_ts; /* Open a history store table cursor. */ - WT_ERR(__wt_hs_cursor(session, &session_flags, &is_owner)); + WT_ERR(__wt_hs_cursor_open(session, &session_flags)); hs_cursor = session->hs_cursor; cbt = (WT_CURSOR_BTREE *)hs_cursor; @@ -317,6 +317,7 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW WT_ERR(__wt_upd_alloc_tombstone(session, &hs_upd, NULL)); WT_ERR(__wt_hs_modify(cbt, hs_upd)); WT_STAT_CONN_INCR(session, txn_rts_hs_removed); + WT_STAT_CONN_INCR(session, cache_hs_key_truncate_rts_unstable); } if (replace) { @@ -381,6 +382,7 @@ __rollback_row_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW WT_ERR(__wt_upd_alloc_tombstone(session, &hs_upd, NULL)); WT_ERR(__wt_hs_modify(cbt, hs_upd)); WT_STAT_CONN_INCR(session, txn_rts_hs_removed); + WT_STAT_CONN_INCR(session, cache_hs_key_truncate_rts); } if (0) { @@ -393,7 +395,7 @@ err: __wt_scr_free(session, &hs_value); __wt_scr_free(session, &key); __wt_buf_free(session, &full_value); - WT_TRET(__wt_hs_cursor_close(session, session_flags, is_owner)); + WT_TRET(__wt_hs_cursor_close(session, session_flags)); return (ret); } @@ -433,7 +435,7 @@ __rollback_abort_row_ondisk_kv( } else return (0); } else if (vpack->tw.durable_start_ts > rollback_timestamp || - (vpack->tw.durable_stop_ts == WT_TS_NONE && prepared)) { + (!WT_TIME_WINDOW_HAS_STOP(&vpack->tw) && prepared)) { __wt_verbose(session, WT_VERB_RTS, "on-disk update aborted with start durable timestamp: %s, commit timestamp: %s, " "prepared: %s and stable timestamp: %s", @@ -450,23 +452,19 @@ __rollback_abort_row_ondisk_kv( WT_RET(__wt_upd_alloc_tombstone(session, &upd, NULL)); WT_STAT_CONN_INCR(session, txn_rts_keys_removed); } - } else if (vpack->tw.durable_stop_ts != WT_TS_NONE && + } else if (WT_TIME_WINDOW_HAS_STOP(&vpack->tw) && (vpack->tw.durable_stop_ts > rollback_timestamp || prepared)) { /* * Clear the remove operation from the key by inserting the original on-disk value as a * standard update. - * - * Take the value from the original page cell. If a value is simple(no compression), and is - * globally visible at the time of reading a page into cache, we encode its location into - * the WT_ROW. Otherwise, read it from the page. */ - if (!__wt_row_leaf_value(page, rip, &buf)) - WT_RET(__wt_page_cell_data_ref(session, page, vpack, &buf)); + WT_RET(__wt_page_cell_data_ref(session, page, vpack, &buf)); WT_ERR(__wt_upd_alloc(session, &buf, WT_UPDATE_STANDARD, &upd, NULL)); upd->txnid = vpack->tw.start_txn; upd->durable_ts = vpack->tw.durable_start_ts; upd->start_ts = vpack->tw.start_ts; + F_SET(upd, WT_UPDATE_RESTORED_FROM_DS); WT_STAT_CONN_INCR(session, txn_rts_keys_restored); __wt_verbose(session, WT_VERB_RTS, "key restored with commit timestamp: %s, durable timestamp: %s txnid: %" PRIu64 @@ -992,18 +990,16 @@ __rollback_to_stable_btree_hs_truncate(WT_SESSION_IMPL *session, uint32_t btree_ uint32_t hs_btree_id, session_flags; int exact; char ts_string[WT_TS_INT_STRING_SIZE]; - bool is_owner; hs_cursor = NULL; WT_CLEAR(key); hs_upd = NULL; session_flags = 0; - is_owner = false; WT_RET(__wt_scr_alloc(session, 0, &hs_key)); /* Open a history store table cursor. */ - WT_ERR(__wt_hs_cursor(session, &session_flags, &is_owner)); + WT_ERR(__wt_hs_cursor_open(session, &session_flags)); hs_cursor = session->hs_cursor; cbt = (WT_CURSOR_BTREE *)hs_cursor; @@ -1044,6 +1040,7 @@ __rollback_to_stable_btree_hs_truncate(WT_SESSION_IMPL *session, uint32_t btree_ WT_ERR(__wt_upd_alloc_tombstone(session, &hs_upd, NULL)); WT_ERR(__wt_hs_modify(cbt, hs_upd)); WT_STAT_CONN_INCR(session, txn_rts_hs_removed); + WT_STAT_CONN_INCR(session, cache_hs_key_truncate_rts); hs_upd = NULL; } WT_ERR_NOTFOUND_OK(ret, false); @@ -1051,7 +1048,7 @@ __rollback_to_stable_btree_hs_truncate(WT_SESSION_IMPL *session, uint32_t btree_ err: __wt_scr_free(session, &hs_key); __wt_free(session, hs_upd); - WT_TRET(__wt_hs_cursor_close(session, session_flags, is_owner)); + WT_TRET(__wt_hs_cursor_close(session, session_flags)); return (ret); } |