mariadb/mysql-test/main/mysqltest_tracking_info.test
Daniel Black fa2faf41e7 MDEV-31746 Problems with tx_isolation after MDEV-21921
With session tracking on the tx_isolation of importance to
connector frameworks, its important that tracking of tx_isolation
does get informed if a user `set session transaction_isolation=X`
as the alias for tx_isolation.

Rather than just implement this for one variable alias, it
is implemented for all aliases.

To assist with this the key hash of session_tracker is now made up of
the offset, not the sys_var pointer.

The impacts of aliases are:
- If track one variable, its alias changes, you get a tracking
  change on the variable you are monitoring.
- If you track two aliased variables of each other, changing
  a variable will have a tracking events for only one of them.

Aliases of Sys_var_bit are not implemented, because we don't
have them, so would've been no way to verify that the new code works.

Post-Review edits by Sergei Golubchik <serg@mariadb.com>
2023-08-10 08:37:18 +02:00

181 lines
5.8 KiB
Text

--source include/no_protocol.inc
--source include/not_embedded.inc
set @save_session_track_system_variables=@@session_track_system_variables;
SELECT @@session.character_set_connection;
SET @@session.session_track_system_variables='character_set_connection';
--echo # tracking info on
--enable_session_track_info
SET NAMES 'utf8';
SET NAMES 'big5';
--disable_session_track_info
--echo # tracking info on once
--enable_session_track_info ONCE
SET NAMES 'utf8';
SET NAMES 'big5';
--echo # tracking info on
--enable_session_track_info
SET NAMES 'utf8';
--echo # tracking info off once
--disable_session_track_info ONCE
SET NAMES 'big5';
--disable_session_track_info
SET @@session.session_track_system_variables= @save_session_track_system_variables;
--echo #
--echo # MDEV-22504: session tracking return incorrectly long traking data
--echo #
set @save_optimizer_switch=@@optimizer_switch;
SET @@session.session_track_system_variables='optimizer_switch';
--enable_session_track_info
set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
--disable_session_track_info
set @@optimizer_switch=@save_optimizer_switch;
SET @@session.session_track_system_variables= @save_session_track_system_variables;
--echo # End of 10.2 tests
--echo #
--echo # MDEV-22134 handle_fatal_signal (sig=11) in __strlen_avx2 on START
--echo # SLAVE | Assertion
--echo # `global_system_variables.session_track_system_variables' failed in
--echo # Session_sysvars_tracker::init | *** buffer overflow detected ***
--echo # (on optimized builds)
--echo #
--error ER_WRONG_VALUE_FOR_VAR
SET @@GLOBAL.session_track_system_variables=NULL;
--error ER_WRONG_VALUE_FOR_VAR
SET SESSION session_track_system_variables=NULL;
--echo # End of 10.3 tests
--echo #
--echo # MDEV-25237: crash after setting global session_track_system_variables
--echo # to an invalid value
--echo #
--error ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL session_track_system_variables='a';
SET GLOBAL event_scheduler=1;
--echo # check that value really returns as it was
set GLOBAL session_track_system_variables='character_set_connection';
--error ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL session_track_system_variables='a';
connect (con,localhost,root,,test);
--enable_session_track_info
SET NAMES 'utf8';
SET NAMES 'big5';
--disable_session_track_info
select @@session_track_system_variables;
connection default;
disconnect con;
SET GLOBAL session_track_system_variables=default;
SET GLOBAL event_scheduler=default;
--echo # End of 10.4 test
--echo #
--echo # MDEV-16470 - Session user variables tracker
--echo #
#SET @@session.session_track_user_variables=1;
#--enable_session_track_info
#SET @a=1;
#SET @b=NULL;
#SELECT @c:=10;
#--disable_session_track_info
#SET @@session.session_track_user_variables=0;
#--echo #
#--echo # mdev-22337 Assertion `Alloced_length >= (str_length + length +
#--echo net_length_size(length))' failed in Binary_string::q_net_store_data
#--echo on long MULTIPOLYGON query with session_track_user_variables=1
#--echo (optimized builds)
#--echo #
#set @@session.session_track_user_variables=1;
#--enable_session_track_info
#set @a=repeat('X', 1029);
#--disable_session_track_info
#set @@session.session_track_user_variables=0;
#--echo #
#--echo # MDEV-22709 Assertion `store.length() <= (256L*256L*256L-1)' failed in net_send_ok
#--echo #
#SET SESSION session_track_user_variables=1;
#SET @inserted_value=REPEAT(1,16777180); # Only crashes when >=16777180 (max = 16777216)
--echo # End of 10.5 tests
--echo #
--echo # MDEV-31746 Problems with tx_isolation after MDEV-21921
--echo #
--echo # tracking info on
--enable_session_track_info
SET session_track_system_variables='max_insert_delayed_threads';
SET max_delayed_threads=0;
SET @@max_delayed_threads=0;
SET SESSION max_delayed_threads=0;
SET session_track_system_variables='max_delayed_threads';
SET max_insert_delayed_threads=@@global.max_delayed_threads;
SET session_track_system_variables='tx_isolation';
SET @@session.tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-UNCOMMITTED';
SET SESSION transaction_isolation='REPEATABLE-READ';
--echo Track 2, get 2
SET session_track_system_variables='tx_isolation,transaction_isolation';
select @@session_track_system_variables;
SET @@session.tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-UNCOMMITTED';
SET SESSION transaction_isolation='REPEATABLE-READ';
SET session_track_system_variables='transaction_isolation';
SET @@session.tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-UNCOMMITTED';
SET SESSION transaction_isolation='REPEATABLE-READ';
SET session_track_system_variables='tx_isolation,transaction_isolation,tx_isolation';
SELECT @@session_track_system_variables;
SET @@session.tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-UNCOMMITTED';
SET SESSION transaction_isolation='REPEATABLE-READ';
--echo accumulate as we encounter duplicates
SET session_track_system_variables='*';
SET @@session.tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-UNCOMMITTED';
SET SESSION transaction_isolation='REPEATABLE-READ';
# TEST GAP, there are no aliases of Sys_var_bit variables, implemented but
# no tests yet.
--disable_session_track_info
--echo # End of 11.1 tests