diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index 23c0a3777..638c8adc8 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -415,6 +415,7 @@ __curfile_remove(WT_CURSOR *cursor) if (positioned && !F_ISSET(cursor, WT_CURSTD_KEY_INT)) { WT_IGNORE_RET(__wt_msg( session, "WT_ROLLBACK: rolling back cursor remove as initial position was lost")); + __wt_verbose_debug(session, WT_VERB_TRANSACTION, "%s", "__curfile_remove position"); WT_ERR(WT_ROLLBACK); } diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index 0bfaf1c9f..d50e63782 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -2383,6 +2383,8 @@ __wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, bool readonly, d if (!F_ISSET(conn, WT_CONN_RECOVERING) && __wt_cache_stuck(session)) { ret = __wt_txn_is_blocking(session); if (ret == WT_ROLLBACK) { + __wt_verbose_debug( + session, WT_VERB_TRANSACTION, "Rollback reason: %s", "Cache full"); --cache->evict_aggressive_score; WT_STAT_CONN_INCR(session, txn_fail_cache); if (app_thread) diff --git a/src/include/txn_inline.h b/src/include/txn_inline.h index f1d0a9f5d..d22e10795 100644 --- a/src/include/txn_inline.h +++ b/src/include/txn_inline.h @@ -389,6 +389,8 @@ __wt_txn_modify(WT_SESSION_IMPL *session, WT_UPDATE *upd) if (F_ISSET(txn, WT_TXN_IGNORE_PREPARE)) WT_RET_MSG( session, ENOTSUP, "Transactions with ignore_prepare=true cannot perform updates"); + __wt_verbose_debug( + session, WT_VERB_TRANSACTION, "Rollback reason: %s", "Write in read-only txn"); WT_RET_MSG(session, WT_ROLLBACK, "Attempt to update in a read-only transaction"); } @@ -1316,6 +1318,7 @@ __wt_txn_modify_check( WT_TIME_WINDOW tw; WT_TXN *txn; WT_TXN_GLOBAL *txn_global; + char ts_string[WT_TS_INT_STRING_SIZE]; bool ignore_prepare_set, rollback, tw_found; rollback = tw_found = false; @@ -1337,6 +1340,9 @@ __wt_txn_modify_check( F_CLR(txn, WT_TXN_IGNORE_PREPARE); for (; upd != NULL && !__wt_txn_upd_visible(session, upd); upd = upd->next) { if (upd->txnid != WT_TXN_ABORTED) { + __wt_verbose_debug(session, WT_VERB_TRANSACTION, + "conflict with update at timestamp: %s", + __wt_timestamp_to_string(upd->start_ts, ts_string)); rollback = true; break; } @@ -1352,15 +1358,26 @@ __wt_txn_modify_check( if (!rollback && upd == NULL) { __wt_read_cell_time_window(cbt, &tw, &tw_found); if (tw_found) { - if (WT_TIME_WINDOW_HAS_STOP(&tw)) + if (WT_TIME_WINDOW_HAS_STOP(&tw)) { rollback = !__wt_txn_tw_stop_visible(session, &tw); - else + if (rollback) + __wt_verbose_debug(session, WT_VERB_TRANSACTION, + "conflict with update at stop timestamp: %s", + __wt_timestamp_to_string(tw.stop_ts, ts_string)); + } else { rollback = !__wt_txn_tw_start_visible(session, &tw); + if (rollback) + __wt_verbose_debug(session, WT_VERB_TRANSACTION, + "conflict with update at start timestamp: %s", + __wt_timestamp_to_string(tw.start_ts, ts_string)); + } } } if (rollback) { WT_STAT_CONN_DATA_INCR(session, txn_update_conflict); + __wt_verbose_debug( + session, WT_VERB_TRANSACTION, "%s", "conflict between concurrent operations"); ret = __wt_txn_rollback_required(session, "conflict between concurrent operations"); } diff --git a/src/txn/txn.c b/src/txn/txn.c index f113463a1..02dfcee97 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -2205,6 +2205,7 @@ int __wt_txn_rollback_required(WT_SESSION_IMPL *session, const char *reason) { session->txn->rollback_reason = reason; + __wt_verbose_debug(session, WT_VERB_TRANSACTION, "Rollback reason: %s", reason); return (WT_ROLLBACK); } diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index 86ba92740..2bda311ef 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -287,6 +287,8 @@ __wt_checkpoint_get_handles(WT_SESSION_IMPL *session, const char *cfg[]) * rollback error. We will ignore this dhandle as part of this checkpoint by returning * from here. */ + __wt_verbose_debug(session, WT_VERB_TRANSACTION, "Rollback reason: %s", + "checkpoint raced with transaction operating on dhandle"); WT_IGNORE_RET(__wt_msg( session, "WT_ROLLBACK: checkpoint raced with transaction operating on dhandle")); WT_TRET(__wt_metadata_cursor_release(session, &meta_cursor));