Description:
When session tracker track some non-atomicity statement(such as set system variables), part of them may success and part of them may fail.
When this case happen, server will send error packet use net_send_error_packet(), and the session trackers are not reset. This will cause wrong session tracker information of next statement.
How to repeat:
Use the following test case to repeat, you can see the "select 1;" statement output session tracker information by wrong.
TESTCASE:
--enable_session_track_info
set session_track_system_variables = "*";
set session_track_schema = off;
--error ER_MALFORMED_GTID_SPECIFICATION
set session_track_schema = on, gtid_next = "123";
select 1;
OUTPUT:
set session_track_system_variables = "*";
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- session_track_system_variables
-- *
set session_track_schema = off;
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- session_track_schema
-- OFF
set session_track_schema = on, gtid_next = "123";
ERROR HY000: Malformed GTID specification '123'.
select 1;
1
1
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- session_track_schema
-- ON
Suggested fix:
Reset the session tracker when the store() function have not been called and the tracker have been mark_as_changed.