diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/include/txn.i')
-rw-r--r-- | src/third_party/wiredtiger/src/include/txn.i | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/src/third_party/wiredtiger/src/include/txn.i b/src/third_party/wiredtiger/src/include/txn.i index 90858eb6950..ff307d84226 100644 --- a/src/third_party/wiredtiger/src/include/txn.i +++ b/src/third_party/wiredtiger/src/include/txn.i @@ -602,6 +602,50 @@ __wt_txn_upd_value_visible_all(WT_SESSION_IMPL *session, WT_UPDATE_VALUE *upd_va } /* + * __wt_txn_tw_stop_visible -- + * Is the given stop time window visible? + */ +static inline bool +__wt_txn_tw_stop_visible(WT_SESSION_IMPL *session, WT_TIME_WINDOW *tw) +{ + return (__wt_time_window_has_stop(tw) && !tw->prepare && + __wt_txn_visible(session, tw->stop_txn, tw->stop_ts)); +} + +/* + * __wt_txn_tw_start_visible -- + * Is the given start time window visible? + */ +static inline bool +__wt_txn_tw_start_visible(WT_SESSION_IMPL *session, WT_TIME_WINDOW *tw) +{ + return ((__wt_time_window_has_stop(tw) || !tw->prepare) && + __wt_txn_visible(session, tw->start_txn, tw->start_ts)); +} + +/* + * __wt_txn_tw_start_visible_all -- + * Is the given start time window visible to all (possible) readers? + */ +static inline bool +__wt_txn_tw_start_visible_all(WT_SESSION_IMPL *session, WT_TIME_WINDOW *tw) +{ + return ((__wt_time_window_has_stop(tw) || !tw->prepare) && + __wt_txn_visible_all(session, tw->start_txn, tw->durable_start_ts)); +} + +/* + * __wt_txn_tw_stop_visible_all -- + * Is the given stop time window visible to all (possible) readers? + */ +static inline bool +__wt_txn_tw_stop_visible_all(WT_SESSION_IMPL *session, WT_TIME_WINDOW *tw) +{ + return (__wt_time_window_has_stop(tw) && !tw->prepare && + __wt_txn_visible_all(session, tw->stop_txn, tw->durable_stop_ts)); +} + +/* * __txn_visible_id -- * Can the current transaction see the given ID? */ @@ -873,11 +917,10 @@ __wt_txn_read(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, uint * tombstone and should return "not found", except for history store scan during rollback to * stable and when we are told to ignore non-globally visible tombstones. */ - if (tw.stop_txn != WT_TXN_MAX && tw.stop_ts != WT_TS_MAX && !tw.prepare && - __wt_txn_visible(session, tw.stop_txn, tw.stop_ts) && + if (__wt_txn_tw_stop_visible(session, &tw) && ((!F_ISSET(&cbt->iface, WT_CURSTD_IGNORE_TOMBSTONE) && (!WT_IS_HS(S2BT(session)) || !F_ISSET(session, WT_SESSION_ROLLBACK_TO_STABLE))) || - __wt_txn_visible_all(session, tw.stop_txn, tw.durable_stop_ts))) { + __wt_txn_tw_stop_visible_all(session, &tw))) { cbt->upd_value->buf.data = NULL; cbt->upd_value->buf.size = 0; cbt->upd_value->durable_ts = tw.durable_stop_ts; @@ -887,14 +930,8 @@ __wt_txn_read(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, uint return (0); } - /* - * If the start time pair is visible and it is not a prepared value then we need to return the - * ondisk value. - */ - if ((!tw.prepare || (tw.stop_txn != WT_TXN_MAX && tw.stop_ts != WT_TS_MAX)) && - (__wt_txn_visible(session, tw.start_txn, tw.start_ts) || - F_ISSET(session, WT_SESSION_RESOLVING_MODIFY))) { - + /* If the start time pair is visible then we need to return the ondisk value. */ + if (__wt_txn_tw_start_visible(session, &tw) || F_ISSET(session, WT_SESSION_RESOLVING_MODIFY)) { /* If we are resolving a modify then the btree must be the history store. */ WT_ASSERT( session, (F_ISSET(session, WT_SESSION_RESOLVING_MODIFY) && WT_IS_HS(S2BT(session))) || @@ -1156,7 +1193,7 @@ __wt_txn_update_check(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_UPDATE * aborted updates. Otherwise, we would have either already detected a conflict if we saw an * uncommitted update or determined that it would be safe to write if we saw a committed update. */ - if (!rollback && upd == NULL && cbt != NULL && cbt->btree->type != BTREE_COL_FIX && + if (!rollback && upd == NULL && cbt != NULL && CUR2BT(cbt)->type != BTREE_COL_FIX && cbt->ins == NULL) { __wt_read_cell_time_window(cbt, cbt->ref, &tw); if (tw.stop_txn != WT_TXN_MAX && tw.stop_ts != WT_TS_MAX) |