-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bug-MDEV-29077. When general_log and slow_query_log turns into of… #2186
base: 10.10
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First brief review. Thanks.
Please squash commits up and follow existing conventions of title and description on your commit message.
ref: https://mariadb.org/get-involved/getting-started-for-developers/submitting-pull-request/#make-sure-your-commit-messages-and-content-follow-the-following-guidelines
insert into t1 values (1,'one'); | ||
insert into t1 values (2,'two'); | ||
|
||
show open tables from mysql; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest:
SHOW OPEN TABLES FROM mysql WHERE `Table` in ('general_log', 'slow_log');
|
||
show open tables from mysql; | ||
|
||
set global slow_query_log = OFF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that the slow query table isn't opened until there is a slow query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, in actually, slow_log table is opened. It's strange. maybe there were some thread making slow logs?
@@ -5266,6 +5266,12 @@ static bool fix_log_output(sys_var *self, THD *thd, enum_var_type type) | |||
logger.lock_exclusive(); | |||
logger.init_slow_log(log_output_options); | |||
logger.init_general_log(log_output_options); | |||
switch(log_output_options){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note log_output
is a set and log_output_options
is a bitmask, in can contain FILE,TABLE
so a more not-table criteria is needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. good suggestion!
|
||
set global slow_query_log = OFF; | ||
show global variables where variable_name like 'general_log'; | ||
show global variables where variable_name like 'slow_query_log'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to test the changing of the global variables.
|
||
set global log_output = 'TABLE'; | ||
show global variables where variable_name like 'general_log'; | ||
show global variables where variable_name like 'slow_query_log'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The X_query_log and log_output transition should be tested both ways.
Is the setting of is_log_tables_initialized= FALSE
handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The X_query_log and log_output transition should be tested both ways.
Did you mean that we need two sub-test for X_query_log and log_output separately?
Is the setting of is_log_tables_initialized= FALSE handled?
I didn't consider how to handle is_log_tables_initialized= FALSE
. Maybe I need re-check the code.
Thanks! I would learn it. I made some mistakes because of my negligence. |
…f, close the table general_log and slow_log. fix bug-MDEV-29077. When general_log and slow_query_log turns into off, close the table general_log and slow_log.
2331a88
to
26bd027
Compare
The Jira issue number for this PR is: MDEV-29077.
Description
If dynamically update the option "general_log" into OFF, the table "general_log" is still keeping open until "flush tables" command is entered. This patch fix method fix_log_output() and fix_log_state(). When general_log and slow_query_log turns into off, close the table general_log and slow_log and clean the table cache.