Commit 5c9229b9 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-24951 Assertion m.first->second.valid(trx->undo_no) failed

trx_t::commit_in_memory(): Invoke mod_tables.clear().

trx_free_at_shutdown(): Invoke mod_tables.clear() for transactions
that are discarded on shutdown.

Everywhere else, assert mod_tables.empty() on freed transaction objects.
parent 21987e59
......@@ -34,3 +34,19 @@ INSERT INTO t1 SELECT * FROM seq_1_to_500;
ROLLBACK;
DROP TABLE t1;
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;
#
# MDEV-24951 Assertion m.first->second.valid(trx->undo_no) failed
# in trx_undo_report_row_operation
#
CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB;
SET tx_read_only=1;
BEGIN;
INSERT INTO t2 VALUES(0);
INSERT INTO t VALUES(0);
COMMIT;
INSERT INTO t VALUES(0);
DROP TEMPORARY TABLE t,t2;
ERROR 25006: Cannot execute statement in a READ ONLY transaction
SET tx_read_only=0;
DROP TEMPORARY TABLE t,t2;
......@@ -33,3 +33,22 @@ INSERT INTO t1 SELECT * FROM seq_1_to_500;
ROLLBACK;
DROP TABLE t1;
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;
--echo #
--echo # MDEV-24951 Assertion m.first->second.valid(trx->undo_no) failed
--echo # in trx_undo_report_row_operation
--echo #
CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB;
SET tx_read_only=1;
BEGIN;
INSERT INTO t2 VALUES(0);
INSERT INTO t VALUES(0);
COMMIT;
INSERT INTO t VALUES(0);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
DROP TEMPORARY TABLE t,t2;
SET tx_read_only=0;
DROP TEMPORARY TABLE t,t2;
......@@ -1062,6 +1062,7 @@ struct trx_t : ilist_node<> {
ut_ad(!is_referenced());
ut_ad(!is_wsrep());
ut_ad(!lock.was_chosen_as_deadlock_victim);
ut_ad(mod_tables.empty());
ut_ad(!read_view.is_open());
ut_ad(!lock.wait_thr);
ut_ad(!lock.wait_lock);
......
......@@ -59,7 +59,6 @@ const trx_t* trx_roll_crash_recv_trx;
@retval false if the rollback was aborted by shutdown */
inline bool trx_t::rollback_finish()
{
mod_tables.clear();
if (UNIV_LIKELY(error_state == DB_SUCCESS))
{
commit();
......
......@@ -397,8 +397,6 @@ void trx_t::free()
autoinc_locks= NULL;
}
mod_tables.clear();
MEM_NOACCESS(&n_ref, sizeof n_ref);
/* do not poison mutex */
MEM_NOACCESS(&id, sizeof id);
......@@ -522,6 +520,7 @@ trx_free_at_shutdown(trx_t *trx)
trx->commit_state();
trx->release_locks();
trx->mod_tables.clear();
trx_undo_free_at_shutdown(trx);
ut_a(!trx->read_only);
......@@ -1270,8 +1269,6 @@ inline void trx_t::commit_tables()
#endif
}
}
mod_tables.clear();
}
/** Evict a table definition due to the rollback of ALTER TABLE.
......@@ -1474,6 +1471,7 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
DBUG_LOG("trx", "Commit in memory: " << this);
state= TRX_STATE_NOT_STARTED;
mod_tables.clear();
assert_freed();
trx_init(this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment