Skip to content
Permalink
Browse files
MDEV-19408 Assertion on trx->state failed in ReadView::copy_trx_ids
ReadView::copy_trx_ids(): Relax a debug check. It failed to account for
TRX_STATE_PREPARED_RECOVERED, which was introduced in MDEV-15772.
It was also reading trx->state twice and failed to tolerate
TRX_STATE_COMMITTED_IN_MEMORY, which could be concurrently assigned
in lock_trx_release_locks(), which is not holding trx_sys->mutex.

This bug is specific to the MariaDB 10.2 series. The ReadView was
introduced in MariaDB 10.2.2 by merging the code that had been
introduced in MySQL 5.7.2. In MariaDB 10.3, ReadView::snapshot()
would use the lock-free trx_sys.rw_trx_hash. MDEV-14638 moved the
corresponding assertion to trx_sys_t::find(), where it was duly
protected by trx->mutex, and later MDEV-14756 moved the check to
rw_trx_hash_t::validate_element(). This check was correctly adjusted
when MDEV-15772 was merged to 10.3.
  • Loading branch information
dr-m committed May 8, 2019
1 parent 49ef1c7 commit e0271a7
Showing 1 changed file with 11 additions and 2 deletions.
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -430,8 +431,16 @@ ReadView::copy_trx_ids(const trx_ids_t& trx_ids)

trx_t* trx = trx_get_rw_trx_by_id(*it);
ut_ad(trx != NULL);
ut_ad(trx->state == TRX_STATE_ACTIVE
|| trx->state == TRX_STATE_PREPARED);
switch (trx->state) {
case TRX_STATE_ACTIVE:
case TRX_STATE_PREPARED:
case TRX_STATE_PREPARED_RECOVERED:
case TRX_STATE_COMMITTED_IN_MEMORY:
continue;
case TRX_STATE_NOT_STARTED:
break;
}
ut_ad(!"invalid state");
}
#endif /* UNIV_DEBUG */
}

0 comments on commit e0271a7

Please sign in to comment.