Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.11, 11.4, 11.8, 12.3, 13.1, 11.4.13
-
Unexpected results
Description
On 11.4.14-MariaDB (11.4 commit 5d65e04b948), successful calls to sys.diagnostics() leave @@sql_log_bin at 0 when it was 1 before the call. This occurs with in_auto_config = 'current' or 'medium', and with performance_schema=OFF; successful sys.ps_trace_thread() and sys.ps_trace_statement_digest() calls also do this when their auto-setup arguments are TRUE. With log_bin on and binlog_format=ROW, an INSERT before sys.diagnostics() appears in SHOW BINLOG EVENTS, but an INSERT after it does not, although both rows are in the table.
SELECT @@sql_log_bin; |
CALL sys.diagnostics(1, 1, 'current'); |
SELECT @@sql_log_bin; |
SET sql_log_bin = 1; |
CALL sys.ps_trace_statement_digest('00000000000000000000000000000000', 0, 0.1, FALSE, TRUE); |
SELECT @@sql_log_bin; |
SET sql_log_bin = 1; |
|
Output (the result sets of the two procedures are left out) |
SELECT @@sql_log_bin;
|
@@sql_log_bin
|
1
|
CALL sys.diagnostics(1, 1, 'current');
|
SELECT @@sql_log_bin;
|
@@sql_log_bin
|
0
|
SET sql_log_bin = 1;
|
CALL sys.ps_trace_statement_digest('00000000000000000000000000000000', 0, 0.1, FALSE, TRUE);
|
SELECT @@sql_log_bin;
|
@@sql_log_bin
|
0
|
SET sql_log_bin = 1;
|
@@sql_log_bin should still be 1 after each call.
diagnostics.sql:184-187, ps_trace_thread.sql:220-221, and ps_trace_statement_digest.sql:157-158 save @@sql_log_bin in @log_bin and set sql_log_bin = 0. Before they restore it (diagnostics.sql:1057-1059, ps_trace_thread.sql:316, ps_trace_statement_digest.sql:319), calls to sys.ps_setup_save() (ps_setup_save.sql:73), sys.ps_setup_reload_saved(), or sys.statement_performance_analyzer() (statement_performance_analyzer.sql:253) overwrite @log_bin with the current value, 0. The trace procedures call the setup procedures when auto setup is on; diagnostics() calls them when in_auto_config is not 'current' and calls the analyzer when PERFORMANCE_SCHEMA is listed as supported with SUPPORT = YES even when performance_schema=OFF. diagnostics() then skips restoration because @log_bin is no longer 1.
Attachments
Issue Links
- relates to
-
MDEV-37979 sys.ps_setup_save does not restore SQL_LOG_BIN after error, causes replication discrepancy
-
- Closed
-
-
MDEV-41940 sys.ps_setup_reload_saved() leaves session sql_log_bin disabled after an error
-
- Stalled
-