diff options
author | <Li-Bing.Song@sun.com> | 2009-09-28 14:24:19 +0800 |
---|---|---|
committer | <Li-Bing.Song@sun.com> | 2009-09-28 14:24:19 +0800 |
commit | 90d4b21d1d8418d4e6180cddbebd90daeea5b02d (patch) | |
tree | c89e1f4e3c499a80d9550f7aa479b18ac5543411 /client/mysqlcheck.c | |
parent | f8f2362bf48852b94705ae59e0ba56d1c941cab8 (diff) | |
download | mariadb-git-90d4b21d1d8418d4e6180cddbebd90daeea5b02d.tar.gz |
BUG#43579 mysql_upgrade tries to alter log tables on replicated database
All statements executed by mysql_upgrade are binlogged and then are replicated to slave.
This will result in some errors. The report of this bug has demonstrated some examples.
Master and slave should be upgraded separately. All statements executed by
mysql_upgrade will not be binlogged.
--write-binlog and --skip-write-binlog options are added into mysql_upgrade.
These options control whether sql statements are binlogged or not.
Diffstat (limited to 'client/mysqlcheck.c')
-rw-r--r-- | client/mysqlcheck.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 82aabd77b24..1533e602639 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -652,6 +652,17 @@ static int use_db(char *database) return 0; } /* use_db */ +static int disable_binlog() +{ + const char *stmt= "SET SQL_LOG_BIN=0"; + if (mysql_query(sock, stmt)) + { + fprintf(stderr, "Failed to %s\n", stmt); + fprintf(stderr, "Error: %s\n", mysql_error(sock)); + return 1; + } + return 0; +} static int handle_request_for_tables(char *tables, uint length) { @@ -844,6 +855,14 @@ int main(int argc, char **argv) if (dbConnect(current_host, current_user, opt_password)) exit(EX_MYSQLERR); + if (!opt_write_binlog) + { + if (disable_binlog()) { + first_error= 1; + goto end; + } + } + if (opt_auto_repair && my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64)) { |