summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-05-08 07:01:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-05-08 07:01:20 +0300
commite0271a7b43c6df652c6a074858853a6d0da20c1e (patch)
treefeba2fb4298b8793f8f54a10d236fbb808e75974
parent49ef1c75e3b644f164ceefc1b90753a2faccab99 (diff)
downloadmariadb-git-e0271a7b43c6df652c6a074858853a6d0da20c1e.tar.gz
MDEV-19408 Assertion on trx->state failed in ReadView::copy_trx_idsmariadb-10.2.24
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.
-rw-r--r--storage/innobase/read/read0read.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/storage/innobase/read/read0read.cc b/storage/innobase/read/read0read.cc
index 2fb7083b0b2..c6444b8c9c4 100644
--- a/storage/innobase/read/read0read.cc
+++ b/storage/innobase/read/read0read.cc
@@ -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 */
}