diff options
Diffstat (limited to 'storage/innobase/trx/trx0rec.cc')
-rw-r--r-- | storage/innobase/trx/trx0rec.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 08e05edb896..45bd36d9669 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1948,16 +1948,30 @@ dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table) return err; } -ATTRIBUTE_COLD ATTRIBUTE_NOINLINE +TRANSACTIONAL_TARGET ATTRIBUTE_COLD ATTRIBUTE_NOINLINE /** @return whether the transaction holds an exclusive lock on a table */ static bool trx_has_lock_x(const trx_t &trx, dict_table_t& table) { if (table.is_temporary()) return true; - table.lock_mutex_lock(); - const auto n= table.n_lock_x_or_s; - table.lock_mutex_unlock(); + uint32_t n; + +#if !defined NO_ELISION && !defined SUX_LOCK_GENERIC + if (xbegin()) + { + if (table.lock_mutex_is_locked()) + xabort(); + n= table.n_lock_x_or_s; + xend(); + } + else +#endif + { + table.lock_mutex_lock(); + n= table.n_lock_x_or_s; + table.lock_mutex_unlock(); + } /* This thread is executing trx. No other thread can modify our table locks (only record locks might be created, in an implicit-to-explicit conversion). |