mariadb/mysql-test/include
Marko Mäkelä ddd7d5d8e3 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 Leich
2024-12-12 18:02:00 +02:00
..
add_anonymous_users.inc
alter_table_mdev539.inc
analyze-format.inc
analyze-sync_with_master.test
analyze-timeout.test
assert.inc
assert_grep.inc
autoinc_mdev15353.inc
begin_include_file.inc
big_test.inc
big_test.require
binlog_inject_error.inc
binlog_parallel_replication_marks.test
binlog_start_pos.inc
bug38347.inc
bytes.inc
bytes2.inc
case_insensitive_file_system.require
case_insensitive_fs.require
case_sensitive_file_system.require
check-testcase.test
check-warnings.test
check_concurrent_insert.inc
check_events_off.inc
check_ftwrl_compatible.inc
check_ftwrl_incompatible.inc
check_ipv6.inc
check_key_reads.inc
check_key_req.inc
check_no_concurrent_insert.inc
check_no_row_lock.inc
check_shared_row_lock.inc
check_slave_is_running.inc
check_slave_no_error.inc
check_slave_param.inc
check_var_limit.inc
check_var_limit.require
cleanup_fake_relay_log.inc
column_compression_rpl.inc
column_compression_syntax_varbinary.inc
column_compression_syntax_varchar.inc
commit.inc
common-tests.inc
concurrent.inc
connect2.inc
count_sessions.inc
crash_mysqld.inc
ctype_8bit.inc
ctype_ascii_order.inc
ctype_casefolding.inc
ctype_common.inc
ctype_czech.inc
ctype_datetime.inc
ctype_E05C.inc
ctype_filesort.inc
ctype_filesort2.inc
ctype_german.inc
ctype_heap.inc
ctype_ident_sys.inc
ctype_innodb_like.inc
ctype_like.inc
ctype_like_cond_propagation.inc
ctype_like_cond_propagation_utf8_german.inc
ctype_like_escape.inc
ctype_like_ignorable.inc
ctype_like_range_f1f2.inc
ctype_like_range_mdev14350.inc
ctype_mdev13118.inc
ctype_myanmar.inc
ctype_nopad_prefix_unique.inc
ctype_numconv.inc
ctype_pad.inc
ctype_pad_all_engines.inc
ctype_pad_space.inc
ctype_regex.inc
ctype_regex_utf8.inc
ctype_str_to_date.inc
ctype_strtoll10.inc
ctype_thai.inc
ctype_uca_w2.inc
ctype_unescape.inc
ctype_unicode520.inc
ctype_unicode_latin.inc
ctype_utf8_ilseq.inc
ctype_utf8_table.inc
ctype_utf8mb3_uca_char.inc
ctype_utf8mb4.inc
daemon_example_bad_format.ini
daemon_example_bad_soname.ini
dbt3_s001.inc
ddl_i18n.check_events.inc
ddl_i18n.check_sp.inc
ddl_i18n.check_triggers.inc
ddl_i18n.check_views.inc
deadlock.inc
default_charset.inc
default_client.cnf
default_group_order.cnf
default_my.cnf
default_mysqld.cnf
default_optimizer_switch.inc
delete_anonymous_users.inc
diff_servers.inc
diff_tables.inc
empty_string_literal.inc
end_include_file.inc
endspace.inc
ensure_binlog_row_event_columns.inc
equal_fields_propagation_datetime.inc
expect_crash.inc
explain_non_select.inc
explain_utils.inc
file_does_not_exist.inc
filter_file.inc
force_restart.inc
func_hybrid_type.inc
func_str_ascii_checksum.inc
function_defaults.inc
function_defaults_notembedded.inc
galera_clear_sync_point.inc
galera_cluster.inc
galera_connect.inc
galera_diff.inc
galera_end.inc
galera_have_debug_sync.inc
galera_init.inc
galera_no_debug_sync.inc
galera_set_sync_point.inc
galera_signal_sync_point.inc
galera_sst_method.combinations
galera_sst_method.inc
galera_suspend.inc
galera_variables_ok.inc
galera_variables_ok_debug.inc
galera_wait_ready.inc
galera_wait_sync_point.inc
gap_lock_error_all.inc
gap_lock_error_cleanup.inc
gap_lock_error_init.inc
gap_lock_error_select.inc
gap_lock_error_update.inc
get_relay_log_pos.inc
gis_debug.inc
gis_generic.inc
gis_keys.inc
grant_cache.inc
grep.inc
have_32bit.inc
have_64bit.inc
have_archive.inc
have_archive.opt
have_aria.inc
have_aria_used_for_temp_tables.inc
have_auth_named_pipe.inc
have_big5.inc
have_binlog_checksum_off.inc
have_binlog_format_mixed.inc
have_binlog_format_mixed.opt
have_binlog_format_mixed_or_row.inc
have_binlog_format_mixed_or_statement.inc
have_binlog_format_row.inc
have_binlog_format_row.opt
have_binlog_format_row_or_statement.inc
have_binlog_format_statement.inc
have_binlog_format_statement.opt
have_blackhole.inc
have_blackhole.opt
have_case_insensitive_file_system.inc
have_case_insensitive_fs.inc
have_case_sensitive_file_system.inc
have_cet_timezone.require
have_collation.inc
have_compress.inc
have_compress.require
have_cp866.inc
have_cp932.inc
have_cp1250_ch.inc
have_cp1251.inc
have_crypt.inc
have_csv.inc
have_dbi_dbd-mariadb.inc
have_debug.inc
have_debug_sync.inc
have_des.inc
have_eucjpms.inc
have_euckr.inc
have_example_plugin.inc
have_file_key_management.inc
have_gb2312.inc
have_gbk.inc
have_geometry.inc
have_geometry.require
have_gzip.inc
have_hostname_cache.inc
have_innodb.inc
have_innodb.opt
have_innodb_4k.inc
have_innodb_4k.opt
have_innodb_8k.inc
have_innodb_8k.opt
have_innodb_16k.inc
have_innodb_16k.opt
have_innodb_32k.inc
have_innodb_32k.opt
have_innodb_64k.inc
have_innodb_64k.opt
have_innodb_max_16k.inc
have_ipv4_mapped.inc
have_koi8r.inc
have_latin2_ch.inc
have_local_infile.inc
have_local_infile.require
have_log_bin-master.opt
have_log_bin-slave.opt
have_log_bin.inc
have_lowercase0.inc
have_lowercase1.inc
have_lowercase2.inc
have_maria.inc
have_mariabackup.inc
have_max_indexes_64.inc
have_max_indexes_128.inc
have_metadata_lock_info.inc
have_metadata_lock_info.opt
have_moscow_leap_timezone.require
have_mutex_deadlock_detector.inc
have_normal_zlib.inc
have_numa.inc
have_openssl.inc
have_outfile.inc
have_outfile.require
have_partition.inc
have_partition.opt
have_perfschema.inc
have_perror.require
have_plugin_auth.inc
have_plugin_auth.opt
have_plugin_interface.inc
have_plugin_server.inc
have_pool_of_threads.inc
have_pool_of_threads.require
have_profiling.inc
have_profiling.require
have_query_cache.inc
have_query_cache.require
have_query_cache_disabled.inc
have_rocksdb.inc
have_rocksdb.opt
have_s3.inc
have_sequence.inc
have_sequence.opt
have_simple_parser.inc
have_sjis.inc
have_ssl_communication.inc
have_ssl_crypto_functs.inc
have_stat_tables.inc
have_stat_tables.opt
have_static_innodb.inc
have_symlink.inc
have_symlink.require
have_tis620.inc
have_tlsv13.inc
have_type_mysql_json.inc
have_type_mysql_json.opt
have_ucs2.inc
have_udf.inc
have_ujis.inc
have_unix_socket.inc
have_unix_socket.opt
have_utf8.inc
have_utf8mb4.inc
have_utf8mb4.require
have_utf16.inc
have_utf16.require
have_utf32.inc
have_utf32.require
have_view_protocol.inc
have_working_dns.inc
have_working_dns.require
have_wsrep.inc
have_wsrep_enabled.inc
have_wsrep_provider.inc
have_xtrabackup.inc
icp_debug_kill.inc
icp_tests.inc
implicit_commit_helper.inc
index_merge1.inc
index_merge2.inc
index_merge_2sweeps.inc
index_merge_ror.inc
index_merge_ror_cpk.inc
innodb-index.inc
innodb_checksum_algorithm.combinations
innodb_checksum_algorithm.inc
innodb_encrypt_log.combinations
innodb_encrypt_log.inc
innodb_encrypt_tables.combinations
innodb_encrypt_tables.inc
innodb_page_size.combinations
innodb_page_size.inc
innodb_page_size_small.combinations
innodb_page_size_small.inc
innodb_prefix_index_cluster_optimization.combinations
innodb_prefix_index_cluster_optimization.inc
innodb_rollback_on_timeout.inc
innodb_row_format.combinations
innodb_row_format.inc
innodb_stable_estimates.inc
innodb_stable_estimates.opt
innodb_trx_weight.inc
innodb_undo_tablespaces.combinations
innodb_undo_tablespaces.inc
install_plugin_if_exists.inc
io_thd_fault_injection.inc
ipv6.inc
ipv6_clients.inc
is_embedded.inc
is_embedded_no_privileges.inc
kill_and_restart_mysqld.inc
kill_binlog_dump_threads.inc
kill_galera.inc
kill_mysqld.inc
kill_query.inc
kill_query_and_diff_master_slave.inc
libdaemon_example.ini
linux.inc
linux_sys_vars.inc
load_dump_and_upgrade.inc
load_sysvars.inc
loaddata_autocom.inc
log_bin.combinations
log_bin.inc
log_grep.inc
log_slow_cleanup.inc
log_slow_debug_common.inc
log_slow_grep.inc
log_slow_prepare.inc
log_slow_start.inc
log_slow_stop.inc
long_test.inc
lowercase0.require
lowercase1.require
lowercase2.require
maria_empty_logs.inc
maria_make_snapshot.inc
maria_make_snapshot_for_comparison.inc
maria_make_snapshot_for_feeding_recovery.inc
maria_verify_recovery.inc
master-slave.inc
max_indexes.inc
maybe_debug.combinations
maybe_debug.inc
maybe_pool_of_threads.combinations
maybe_pool_of_threads.inc
maybe_versioning.combinations
maybe_versioning.inc
min_null_cond.inc
mix1.inc
mix2.inc
mix2_ucs2.inc
mrr_tests.inc
mtr_check.sql
mtr_warnings.sql
mysql_upgrade_preparation.inc
mysqladmin_shutdown.inc
mysqlbinlog_have_debug.inc
mysqldump.inc
mysqlhotcopy.inc
mysqltest-x.inc
no_protocol.inc
no_running_event_scheduler.inc
no_running_events.inc
no_valgrind_without_big.inc
no_view_protocol.inc
not_aix.inc
not_as_root.inc
not_asan.inc
not_binlog_format_row.inc
not_blackhole.inc
not_crashrep.inc
not_debug.inc
not_embedded.inc
not_encrypted.inc
not_msan.inc
not_parallel.inc
not_ssl.inc
not_staging.inc
not_staging.require
not_threadpool.inc
not_ubsan.inc
not_valgrind.inc
not_valgrind.require
not_valgrind_build.inc
not_var_link.inc
not_windows.inc
not_windows_embedded.inc
one_thread_per_connection.inc
one_thread_per_connection.require
optimizer_trace_no_costs.inc
parser_bug21114.inc
partition_date_range.inc
partition_mrr.inc
percona_nonflushing_analyze_debug.inc
platform.combinations
platform.inc
plugin.defs
print_ddl_log.inc
protocol.combinations
protocol.inc
ps_conv.inc
ps_create.inc
ps_ddl_1.inc
ps_modify.inc
ps_modify1.inc
ps_query.inc
ps_renew.inc
query_cache.inc
query_cache_partitions.inc
query_cache_sql_prepare.inc
read_head.inc
read_many_rows.inc
relocate_binlogs.inc
require_openssl_client.inc
reset_master_slave.inc
restart_mysqld.inc
restart_slave_sql.inc
restore_charset.inc
rowid_filter_debug_kill.inc
rowid_order.inc
rpl_assert.inc
rpl_change_topology.inc
rpl_clone_slave_using_mariadb-backup.inc
rpl_connect.inc
rpl_connection.inc
rpl_diff.inc
rpl_end.inc
rpl_for_each_slave.inc
rpl_generate_sync_chain.inc
rpl_init.combinations
rpl_init.inc
rpl_ip_mix.inc
rpl_ip_mix2.inc
rpl_ipv6.inc
rpl_loaddata_charset.inc
rpl_multi_engine.inc
rpl_multi_engine2.inc
rpl_multi_engine3.inc
rpl_reconnect.inc
rpl_reset.inc
rpl_restart_server.inc
rpl_row_img_general_loop.inc
rpl_row_img_set.inc
rpl_start_server.inc
rpl_start_slaves.inc
rpl_stmt_seq.inc
rpl_stop_server.inc
rpl_stop_slaves.inc
rpl_sync.inc
rpl_udf.inc
running_event_scheduler.inc
save_master_gtid.inc
save_master_pos.inc
search_condition.inc
search_pattern_in_file.inc
set_binlog_format_mixed.sql
set_binlog_format_row.sql
set_binlog_format_statement.sql
setup_fake_relay_log.inc
show_all_slaves_status.inc
show_binary_logs.inc
show_binlog_events.inc
show_binlog_events2.inc
show_binlog_using_logname.inc
show_delayed_slave_state.inc
show_events.inc
show_gtid_list.inc
show_master_logs.inc
show_master_status.inc
show_msg.inc
show_msg80.inc
show_relaylog_events.inc
show_rpl_debug_info.inc
show_slave_hosts.inc
show_slave_status.inc
shutdown_mysqld.inc
slow_environ.inc
sp-vars.inc
sql_mode_pad_char_to_full_length.inc
start_mysqld.inc
start_slave.inc
stop_dump_threads.inc
stop_slave.inc
stop_slave_io.inc
stop_slave_sql.inc
strict_autoinc.inc
subselect_mat_cost.inc
support_long_file_names.inc
switch_to_mysql_global_priv.inc
switch_to_mysql_user.inc
sync_io_with_master.inc
sync_slave_io_with_master.inc
sync_slave_sql_with_io.inc
sync_slave_sql_with_master.inc
sync_with_master.inc
sync_with_master_gtid.inc
system_db_struct.inc
test_fieldsize.inc
test_outfile.inc
testdb_only.inc
tpcb.inc
tpcb_disk_data.inc
true.require
truncate_file.inc
type_hrtime.inc
type_temporal_zero_default.inc
unsafe_binlog.inc
update_use_source.inc
uses_vardir.inc
varchar.inc
view_alias.inc
wait_condition.inc
wait_condition_sp.inc
wait_condition_with_debug.inc
wait_for_binlog_checkpoint.inc
wait_for_binlog_event.inc
wait_for_line_count_in_file.inc
wait_for_purge.inc
wait_for_query_to_fail.inc
wait_for_query_to_succeed.inc
wait_for_slave_io_error.inc
wait_for_slave_io_to_start.inc
wait_for_slave_io_to_stop.inc
wait_for_slave_param.inc
wait_for_slave_sql_error.inc
wait_for_slave_sql_error_and_skip.inc
wait_for_slave_sql_to_start.inc
wait_for_slave_sql_to_stop.inc
wait_for_slave_to_start.inc
wait_for_slave_to_stop.inc
wait_for_sql_thread_read_all.inc
wait_for_status_var.inc
wait_show_condition.inc
wait_until_connected_again.inc
wait_until_count_sessions.inc
wait_until_disconnected.inc
wait_until_no_pidfile.inc
wait_until_ready.inc
wait_until_rows_count.inc
wait_wsrep_ready.inc
weight_string.inc
weight_string_8EA1.inc
weight_string_8FA2C3.inc
weight_string_8140.inc
weight_string_A1A1.inc
weight_string_chde.inc
weight_string_euro.inc
weight_string_l1.inc
weight_string_l2.inc
weight_string_l3.inc
weight_string_l4.inc
weight_string_l12.inc
weight_string_l14.inc
windows.inc
windows_sys_vars.inc
word_size.combinations
word_size.inc
world.inc
world_schema.inc
world_schema1.inc
world_schema_utf8.inc
write_result_to_file.inc
write_var_to_file.inc
wsrep_wait_condition.inc
wsrep_wait_disconnect.inc
wsrep_wait_membership.inc