Description:
The GTID state (GTID_EXECUTED and GTID_PURGED) can be reset using RESET MASTER.
RESET MASTER only works when the binary log is enabled. If the binary log is disabled, RESET MASTER fails with an error. This did not limit the GTID feature in 5.6, since GTIDs could only be enabled when the binary log was enabled.
However, since WL#6559 was pushed to 5.7.5, GTIDs can be enabled even when the binary log is disabled. So in this case there is no way to reset the GTID state.
How to repeat:
Run the server with GTID_MODE=ON and log-bin disabled, see that RESET MASTER fails.
Suggested fix:
8909 Sven Sandberg 2014-09-29
(no message)
@ sql/binlog.cc
- Fix whitespace
- Remove pointless call to gtid_state->init
@ sql/rpl_master.cc
- Remove the ER_FLUSH_MASTER_BINLOG_CLOSED error.
- Reset the GTID state if the binary log is disabled.
=== modified file 'sql/binlog.cc'
--- sql/binlog.cc revid:annamalai.gurusami@oracle.com-20140923080047-y0nz0emspzjlsham
+++ sql/binlog.cc revid:sven.sandberg@oracle.com-20140929173315-w0wg3u6tyxgvi376
@@ -4362,14 +4362,11 @@
*/
if (!is_relay_log)
{
- if(gtid_state->clear(thd))
+ if (gtid_state->clear(thd))
{
error= 1;
goto err;
}
- // don't clear global_sid_map because it's used by the relay log too
- if (gtid_state->init() != 0)
- goto err;
}
#endif
=== modified file 'sql/rpl_master.cc'
--- sql/rpl_master.cc revid:annamalai.gurusami@oracle.com-20140923080047-y0nz0emspzjlsham
+++ sql/rpl_master.cc revid:sven.sandberg@oracle.com-20140929173315-w0wg3u6tyxgvi376
@@ -527,15 +527,16 @@
*/
int reset_master(THD* thd)
{
- if (!mysql_bin_log.is_open())
- {
- my_message(ER_FLUSH_MASTER_BINLOG_CLOSED,
- ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
- return 1;
- }
-
- if (mysql_bin_log.reset_logs(thd))
- return 1;
+ if (mysql_bin_log.is_open())
+ {
+ if (mysql_bin_log.reset_logs(thd))
+ return 1;
+ }
+ else
+ {
+ if (gtid_state->clear(thd))
+ return 1;
+ }
(void) RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
return 0;
}