diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-12-04 11:29:00 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-12-04 11:29:00 +0200 |
commit | b213f57dc3f9da93ce444805f7581d982bde9f75 (patch) | |
tree | b8de643852f5b080d2eff176065f0e23aea9be3e | |
parent | 751ad74491eaeedf46fc4270ef3335e6b02b9d45 (diff) | |
download | mariadb-git-b213f57dc3f9da93ce444805f7581d982bde9f75.tar.gz |
Follow-up to MDEV-12288: Avoid mutex acquistion in trx_rw_is_active(0)
Suggested-by: Sergey Vojtovich <svoj@mariadb.org>
-rw-r--r-- | storage/innobase/include/trx0sys.ic | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic index e8efc1525c4..5271601b4ea 100644 --- a/storage/innobase/include/trx0sys.ic +++ b/storage/innobase/include/trx0sys.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 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 @@ -343,6 +344,15 @@ trx_rw_is_active( bool do_ref_count) /*!< in: if true then increment the trx_t::n_ref_count */ { + if (!trx_id) { + /* In MariaDB 10.3, purge will reset DB_TRX_ID to 0 + when the history is lost. Read/write transactions will + always have a nonzero trx_t::id; there the value 0 is + reserved for transactions that did not write or lock + anything yet. */ + return NULL; + } + trx_t* trx; trx_sys_mutex_enter(); |