Skip to content

Commit

Permalink
PS-4788: Setting log_slow_verbosity and enabling the slow_query_log c…
Browse files Browse the repository at this point in the history
…ould lead to a server crash

(cherry picked from commit 4b2a4a4)
  • Loading branch information
laurynas-biveinis authored and inikep committed Jun 7, 2022
1 parent c570780 commit 7775bba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions mysql-test/suite/innodb/r/percona_log_slow_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,12 @@ COMMIT;
[log_grep.inc] lines: 1
[log_grep.inc] file: percona.slow_extended.innodb_4 pattern: ^# No InnoDB statistics available for this query$
[log_grep.inc] lines: 4
#
# PS-4788: Setting log_slow_verbosity and enabling the slow_query_log could lead to a server crash
#
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
SET SESSION log_slow_verbosity='microtime,innodb,query_plan';
SET @@GLOBAL.slow_query_log=1;
SELECT * FROM INFORMATION_SCHEMA.TABLES;
SET GLOBAL slow_query_log = @saved_slow_query_log;
DROP TABLE t1, t2;
13 changes: 13 additions & 0 deletions mysql-test/suite/innodb/t/percona_log_slow_innodb.test
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ reap;
--disconnect con2
--connection default

--echo #
--echo # PS-4788: Setting log_slow_verbosity and enabling the slow_query_log could lead to a server crash
--echo #

SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
SET SESSION log_slow_verbosity='microtime,innodb,query_plan';
SET @@GLOBAL.slow_query_log=1;
--disable_result_log
SELECT * FROM INFORMATION_SCHEMA.TABLES;
--enable_result_log

SET GLOBAL slow_query_log = @saved_slow_query_log;

DROP TABLE t1, t2;
--source include/log_cleanup.inc

Expand Down
2 changes: 1 addition & 1 deletion sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ class THD : public MDL_context_owner,
}

void access_distinct_page(ulong page_id) {
if (approx_distinct_pages.test_and_set(mem_root, page_id))
if (approx_distinct_pages.test_and_set(&main_mem_root, page_id))
innodb_page_access++;
}

Expand Down

0 comments on commit 7775bba

Please sign in to comment.