MDEV-25315 Crash in SHOW ENGINE INNODB STATUS

In commit 8ea923f55b (MDEV-24818)
when we optimized multi-statement INSERT into an empty table,
we would sometimes wrongly enable bulk insert into a table that
is actually already using row-level locking and undo logging.

trx_has_lock_x(): New predicate, to check if the transaction of
the current thread is holding an exclusive lock on a table.

trx_undo_report_row_operation(): Only invoke
trx_mod_table_time_t::start_bulk_insert() if
trx_has_lock_x() holds.
This commit is contained in:
Marko Mäkelä 2021-04-08 18:01:27 +03:00
commit 1fde581237
4 changed files with 60 additions and 2 deletions

View file

@ -2340,7 +2340,7 @@ public:
/* @} */
/** Number of granted or pending LOCK_S or LOCK_X on the table.
Protected by lock_mutex. */
Protected by lock_sys.assert_locked(*this). */
uint32_t n_lock_x_or_s;
/** FTS specific state variables. */