Skip to content

Commit

Permalink
Follow-up to MDEV-12288: Avoid mutex acquistion in trx_rw_is_active(0)
Browse files Browse the repository at this point in the history
Suggested-by: Sergey Vojtovich <svoj@mariadb.org>
  • Loading branch information
dr-m committed Dec 4, 2017
1 parent 751ad74 commit b213f57
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions storage/innobase/include/trx0sys.ic
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit b213f57

Please sign in to comment.