Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL)
-
None
-
Linux
Description
When we set the config option "general_log" as ON, and "log_output" as TABLE in the config file, MySQL records the related general logs into the table named "general_log". However, if we dynamically update the option "general_log" into OFF, the table "general_log" is still keeping open until "flush tables" command is entered.
The ideal situation is that when general_log turns into OFF, the table general_log should be closed right now. Otherwise, the big table would occupy lots of cache, which might affect the performance of the cache-related operations. Similar situations are option "slow_query_log" and table "slow_log". Similarly, the table "general_log/slow_log" should be closed when config "log_output" set into NONE or File.
(We check the open tables by the command "show open tables from mysql;")
How to repeat:
set global general_log = 'ON';
|
set global log_output = 'TABLE';
|
show global variables where variable_name like 'general_log';
|
show global variables where variable_name like 'log_output';
|
|
create table t1
|
(
|
a int primary key,
|
b char(10)
|
);
|
insert into t1 values (1,'one');
|
insert into t1 values (2,'two');
|
show open tables from mysql;
|
|
set global general_log = OFF;
|
show global variables where variable_name like 'general_log';
|
show open tables from mysql;
|
|
flush tables;
|
show global variables where variable_name like 'general_log';
|
show open tables from mysql;
|
suggest to fix:
when runtime change "general_log", the function fix_general_log_file will be called. Maybe we can close the table general_log during fix_general_log_file.
static bool fix_general_log_file(sys_var *self, THD *thd, enum_var_type type)
static bool fix_slow_log_file(sys_var *self, THD *thd, enum_var_type type)