Commit 039bc612 authored by unknown's avatar unknown

MDEV-4816: Incorrect disabling of binlog for mysql.gtid_slave_pos update

The update of mysql.gtid_slave_pos during event replication used
the wrong way to disable binary logging for the table updates.
Fix to instead temporarily clear the OPT_BIN_LOG flag.
parent acc539a2
...@@ -203,17 +203,15 @@ rpl_slave_state::truncate_state_table(THD *thd) ...@@ -203,17 +203,15 @@ rpl_slave_state::truncate_state_table(THD *thd)
{ {
TABLE_LIST tlist; TABLE_LIST tlist;
int err= 0; int err= 0;
TABLE *table;
tmp_disable_binlog(thd);
tlist.init_one_table(STRING_WITH_LEN("mysql"), tlist.init_one_table(STRING_WITH_LEN("mysql"),
rpl_gtid_slave_state_table_name.str, rpl_gtid_slave_state_table_name.str,
rpl_gtid_slave_state_table_name.length, rpl_gtid_slave_state_table_name.length,
NULL, TL_WRITE); NULL, TL_WRITE);
if (!(err= open_and_lock_tables(thd, &tlist, FALSE, 0))) if (!(err= open_and_lock_tables(thd, &tlist, FALSE, 0)))
{ {
table= tlist.table; err= tlist.table->file->ha_truncate();
table->no_replicate= 1;
err= table->file->ha_truncate();
if (err) if (err)
{ {
...@@ -230,6 +228,7 @@ rpl_slave_state::truncate_state_table(THD *thd) ...@@ -230,6 +228,7 @@ rpl_slave_state::truncate_state_table(THD *thd)
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
} }
reenable_binlog(thd);
return err; return err;
} }
...@@ -349,13 +348,14 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, ...@@ -349,13 +348,14 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
if ((err= gtid_check_rpl_slave_state_table(table))) if ((err= gtid_check_rpl_slave_state_table(table)))
goto end; goto end;
table->no_replicate= 1;
if (!in_transaction) if (!in_transaction)
{ {
DBUG_PRINT("info", ("resetting OPTION_BEGIN")); DBUG_PRINT("info", ("resetting OPTION_BEGIN"));
thd->variables.option_bits&= thd->variables.option_bits&=
~(ulonglong)(OPTION_NOT_AUTOCOMMIT|OPTION_BEGIN); ~(ulonglong)(OPTION_NOT_AUTOCOMMIT|OPTION_BEGIN|OPTION_BIN_LOG);
} }
else
thd->variables.option_bits&= ~(ulonglong)OPTION_BIN_LOG;
bitmap_set_all(table->write_set); bitmap_set_all(table->write_set);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment