diff options
author | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2012-09-20 12:34:31 +0530 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2020-10-08 07:41:43 +1100 |
commit | 00c44fb18ec54682ffd208126e0de6ab172fa50b (patch) | |
tree | e231f50cc7223a2feb3d154b4579ded630f6f713 | |
parent | 83bd8ebfcd2dd3aca4b5e89f6de993749e59e8e2 (diff) | |
download | mariadb-git-00c44fb18ec54682ffd208126e0de6ab172fa50b.tar.gz |
MDEV-4851: BUG#11763447: 'YOU CANNOT 'ALTER' A LOG TABLE IF LOGGING IS ENABLED'
EVEN IF I LOG TO FILE.
Analysis:
----------
MYSQL_UPGRADE of the master breaks the replication when
the query logging is enabled with FILE/NONE 'log-output'
option on the slave.
mysql_upgrade modifies the 'general_log' and 'slow_log'
tables after the logging is disabled as below:
SET @old_log_state = @@global.general_log;
SET GLOBAL general_log = 'OFF';
ALTER TABLE general_log
MODIFY event_time TIMESTAMP NOT NULL,
( .... );
SET GLOBAL general_log = @old_log_state;
and
SET @old_log_state = @@global.slow_query_log;
SET GLOBAL slow_query_log = 'OFF';
ALTER TABLE slow_log
MODIFY start_time TIMESTAMP NOT NULL,
( .... );
SET GLOBAL slow_query_log = @old_log_state;
In the binary log, only the ALTER statements are logged
but not the SET statements which turns ON/OFF the logging.
So when the slave replays the binary log,the ALTER of LOG
tables throws an error since the logging is enabled. Also
the 'log-output' option is not checked to determine
whether to allow/disallow the ALTER operation.
Fix:
----
The 'log-output' option is included in the check while
determining whether the query logging happens using the
log tables.
Picked from mysql respository at 0daaf8aecd8f84ff1fb400029139222ea1f0d812
-rw-r--r-- | sql/log.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/log.cc b/sql/log.cc index 8049b94bab1..f2fe0d852d1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. +/* Copyright (c) 2000, 2012, 2018, Oracle and/or its affiliates. Copyright (c) 2009, 2019, MariaDB Corporation This program is free software; you can redistribute it and/or modify @@ -534,9 +534,11 @@ bool LOGGER::is_log_table_enabled(uint log_table_type) { switch (log_table_type) { case QUERY_LOG_SLOW: - return (table_log_handler != NULL) && global_system_variables.sql_log_slow; + return (table_log_handler != NULL) && global_system_variables.sql_log_slow + && (log_output_options & LOG_TABLE); case QUERY_LOG_GENERAL: - return (table_log_handler != NULL) && opt_log ; + return (table_log_handler != NULL) && opt_log + && (log_output_options & LOG_TABLE); default: DBUG_ASSERT(0); return FALSE; /* make compiler happy */ |