Details
Description
The statistic "transaction failures due to history store" is misleading. It says transaction has failed because of history store, whereas it is counting the number of transactions that we rollback because of the cache pressure:
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);
|
We increment the stat if the cache is stuck and we decide to rollback transaction because it is this transaction that is pinning the cache:
*/
|
int
|
__wt_txn_is_blocking(WT_SESSION_IMPL *session)
|
{
|
....
|
|
/*
|
* Check if either the transaction's ID or its pinned ID is equal to the oldest transaction ID.
|
*/
|
return (txn_shared->id == global_oldest || txn_shared->pinned_id == global_oldest ?
|
__wt_txn_rollback_required(
|
session, "oldest pinned transaction ID rolled back for eviction") :
|
0);
|
}
|
It appears to me the statistic actually corresponds 1 - 1 to the rollback for the reason "oldest pinned transaction ID rolled back for eviction".
Acceptance Criterion for the ticket:
A change of description to something which makes more sense and correlates to the error we return to MongoDB "oldest pinned transaction ID rolled back for eviction"