Browse Source
MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure
MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure
Under unknown circumstances, the SQL layer may wrongly disregard an invocation of thd_mark_transaction_to_rollback() when an InnoDB transaction had been aborted (rolled back) due to one of the following errors: * HA_ERR_LOCK_DEADLOCK * HA_ERR_RECORD_CHANGED (if innodb_snapshot_isolation=ON) * HA_ERR_LOCK_WAIT_TIMEOUT (if innodb_rollback_on_timeout=ON) Such an error used to cause a crash of InnoDB during transaction commit. These changes aim to catch and report the error earlier, so that not only this crash can be avoided but also the original root cause be found and fixed more easily later. The idea of this fix is from Michael 'Monty' Widenius. HA_ERR_ROLLBACK: A new error code that will be translated into ER_ROLLBACK_ONLY, signalling that the current transaction has been aborted and the only allowed action is ROLLBACK. trx_t::state: Add TRX_STATE_ABORTED that is like TRX_STATE_NOT_STARTED, but noting that the transaction had been rolled back and aborted. trx_t::is_started(): Replaces trx_is_started(). ha_innobase: Check the transaction state in various places. Simplify the logic around SAVEPOINT. ha_innobase::is_valid_trx(): Replaces ha_innobase::is_read_only(). The InnoDB logic around transaction savepoints, commit, and rollback was unnecessarily complex and might have contributed to this inconsistency. So, we are simplifying that logic as well. trx_savept_t: Replace with const undo_no_t*. When we rollback to a savepoint, all we need to know is the number of undo log records that must survive. trx_named_savept_t, DB_NO_SAVEPOINT: Remove. We can store undo_no_t directly in the space allocated at innobase_hton->savepoint_offset. fts_trx_create(): Do not copy previous savepoints. fts_savepoint_rollback(): If a savepoint was not found, roll back everything after the default savepoint of fts_trx_create(). The test innodb_fts.savepoint is extended to cover this code. Reviewed by: Vladislav Lesin Tested by: Matthias Leichpull/3676/head
70 changed files with 880 additions and 1163 deletions
-
4include/handler_ername.h
-
3include/my_base.h
-
3include/my_handler_errors.h
-
4mysql-test/include/innodb_rollback_on_timeout.inc
-
4mysql-test/main/bug39022.test
-
4mysql-test/main/innodb_mysql_lock.test
-
4mysql-test/main/long_unique_bugs.test
-
3mysql-test/main/partition_innodb_plugin.test
-
4mysql-test/main/rowid_filter_innodb.test
-
5mysql-test/main/xa.test
-
2mysql-test/suite/galera/r/galera_bf_kill.result
-
2mysql-test/suite/galera/r/galera_bf_lock_wait.result
-
2mysql-test/suite/galera/t/galera_bf_kill.test
-
2mysql-test/suite/galera/t/galera_bf_lock_wait.test
-
2mysql-test/suite/innodb/r/innodb-wl5522-debug.result
-
4mysql-test/suite/innodb/t/autoinc_debug.test
-
4mysql-test/suite/innodb/t/deadlock_detect.test
-
4mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test
-
4mysql-test/suite/innodb/t/deadlock_victim_race.test
-
4mysql-test/suite/innodb/t/deadlock_wait_lock_race.test
-
4mysql-test/suite/innodb/t/deadlock_wait_thr_race.test
-
4mysql-test/suite/innodb/t/foreign_key.test
-
4mysql-test/suite/innodb/t/innodb-lock.test
-
4mysql-test/suite/innodb/t/innodb_bug42419.test
-
4mysql-test/suite/innodb/t/innodb_mysql_rbk.test
-
4mysql-test/suite/innodb/t/innodb_trx_weight.test
-
4mysql-test/suite/innodb/t/insert-before-delete.test
-
4mysql-test/suite/innodb/t/lock_delete_updated.test
-
4mysql-test/suite/innodb/t/lock_isolation.test
-
3mysql-test/suite/innodb/t/lock_memory_debug.test
-
4mysql-test/suite/innodb/t/mdev-14846.test
-
4mysql-test/suite/innodb/t/row_lock.test
-
4mysql-test/suite/innodb/t/stat_tables.test
-
24mysql-test/suite/innodb_fts/r/savepoint.result
-
16mysql-test/suite/innodb_fts/t/savepoint.test
-
2mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
-
3mysql-test/suite/multi_source/gtid_ignore_duplicates.test
-
4mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result
-
4mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test
-
3mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test
-
4mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test
-
4mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test
-
3mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
-
4mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test
-
4mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test
-
3mysql-test/suite/rpl/t/rpl_temporary_error2.test
-
4mysql-test/suite/versioning/t/update.test
-
8sql/handler.cc
-
6storage/innobase/buf/buf0buf.cc
-
74storage/innobase/fts/fts0fts.cc
-
930storage/innobase/handler/ha_innodb.cc
-
18storage/innobase/handler/ha_innodb.h
-
8storage/innobase/handler/handler0alter.cc
-
2storage/innobase/include/db0err.h
-
12storage/innobase/include/fts0fts.h
-
2storage/innobase/include/row0mysql.h
-
76storage/innobase/include/trx0roll.h
-
14storage/innobase/include/trx0sys.h
-
88storage/innobase/include/trx0trx.h
-
2storage/innobase/include/trx0trx.inl
-
10storage/innobase/include/trx0types.h
-
26storage/innobase/lock/lock0lock.cc
-
3storage/innobase/que/que0que.cc
-
16storage/innobase/row/row0mysql.cc
-
5storage/innobase/row/row0sel.cc
-
2storage/innobase/trx/trx0i_s.cc
-
391storage/innobase/trx/trx0roll.cc
-
26storage/innobase/trx/trx0sys.cc
-
121storage/innobase/trx/trx0trx.cc
-
2storage/innobase/ut/ut0ut.cc
930
storage/innobase/handler/ha_innodb.cc
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue