Skip to content

Commit

Permalink
Add DBUG "trx" instrumentation that was used for catching MDEV-13470
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Aug 8, 2017
1 parent 2152fbd commit c3f9fde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,18 @@ row_mysql_handle_errors(
{
dberr_t err;

DBUG_ENTER("row_mysql_handle_errors");

handle_new_error:
err = trx->error_state;

ut_a(err != DB_SUCCESS);

trx->error_state = DB_SUCCESS;

DBUG_LOG("trx", "handle error: " << ut_strerr(err)
<< ";id=" << ib::hex(trx->id) << ", " << trx);

switch (err) {
case DB_LOCK_WAIT_TIMEOUT:
if (row_rollback_on_timeout) {
Expand Down Expand Up @@ -795,7 +800,7 @@ row_mysql_handle_errors(

*new_err = err;

return(true);
DBUG_RETURN(true);

case DB_DEADLOCK:
case DB_LOCK_TABLE_FULL:
Expand Down Expand Up @@ -840,7 +845,7 @@ row_mysql_handle_errors(

trx->error_state = DB_SUCCESS;

return(false);
DBUG_RETURN(false);
}

/********************************************************************//**
Expand Down
7 changes: 7 additions & 0 deletions storage/innobase/trx/trx0trx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ struct TrxFactory {

trx_init(trx);

DBUG_LOG("trx", "Init: " << trx);
trx->state = TRX_STATE_NOT_STARTED;

trx->dict_operation_lock_mode = 0;
Expand Down Expand Up @@ -452,6 +453,7 @@ trx_create_low()

/* Trx state can be TRX_STATE_FORCED_ROLLBACK if
the trx was forced to rollback before it's reused.*/
DBUG_LOG("trx", "Create: " << trx);
trx->state = TRX_STATE_NOT_STARTED;

heap = mem_heap_create(sizeof(ib_vector_t) + sizeof(void*) * 8);
Expand Down Expand Up @@ -630,6 +632,7 @@ trx_free_prepared(

ut_d(trx->in_rw_trx_list = FALSE);

DBUG_LOG("trx", "Free prepared: " << trx);
trx->state = TRX_STATE_NOT_STARTED;

/* Undo trx_resurrect_table_locks(). */
Expand Down Expand Up @@ -1753,6 +1756,7 @@ trx_commit_in_memory(
ut_ad(!(trx->in_innodb
& (TRX_FORCE_ROLLBACK | TRX_FORCE_ROLLBACK_ASYNC)));

DBUG_LOG("trx", "Autocommit in memory: " << trx);
trx->state = TRX_STATE_NOT_STARTED;

} else {
Expand Down Expand Up @@ -1888,8 +1892,10 @@ trx_commit_in_memory(
if (trx->abort) {

trx->abort = false;
DBUG_LOG("trx", "Abort: " << trx);
trx->state = TRX_STATE_FORCED_ROLLBACK;
} else {
DBUG_LOG("trx", "Commit in memory: " << trx);
trx->state = TRX_STATE_NOT_STARTED;
}

Expand Down Expand Up @@ -2061,6 +2067,7 @@ trx_cleanup_at_db_startup(
ut_ad(trx->is_recovered);
ut_ad(!trx->in_rw_trx_list);
ut_ad(!trx->in_mysql_trx_list);
DBUG_LOG("trx", "Cleanup at startup: " << trx);
trx->state = TRX_STATE_NOT_STARTED;
}

Expand Down

0 comments on commit c3f9fde

Please sign in to comment.