diff --git a/mysql-test/suite/binlog/r/mariadb-dump_master_log_pos.result b/mysql-test/suite/binlog/r/mariadb-dump_master_log_pos.result new file mode 100644 index 00000000000..f44ed832257 --- /dev/null +++ b/mysql-test/suite/binlog/r/mariadb-dump_master_log_pos.result @@ -0,0 +1,27 @@ +include/reset_master_slave.inc +SET @prev_dbug= @@GLOBAL.debug_dbug; +connect switcher, 127.0.0.1, root, , , $SERVER_MYPORT_1; +CREATE PROCEDURE switch_binlog() BEGIN +SET @@SESSION.debug_sync= 'now WAIT_FOR after_sbs'; +FLUSH BINARY LOGS; +FLUSH BINARY LOGS; # for good measure +SET @@SESSION.debug_sync= 'now SIGNAL sbs_continue'; +END;// +CALL switch_binlog(); +connection default; +SET @@GLOBAL.debug_dbug= 'd,wait_after_sbs'; +$MYSQL_DUMP --delete-master-logs test +/*M!999999\- enable the sandbox mode */ +-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000004', MASTER_LOG_POS; +-- SET GLOBAL gtid_slave_pos='0-1-1'; +connection switcher; +DROP PROCEDURE switch_binlog; +connection default; +disconnect switcher; +SHOW BINARY LOGS; +Log_name File_size +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +SET @@GLOBAL.debug_dbug= @prev_dbug; +SET @@SESSION.debug_sync= RESET; diff --git a/mysql-test/suite/binlog/t/mariadb-dump_master_log_pos.test b/mysql-test/suite/binlog/t/mariadb-dump_master_log_pos.test new file mode 100644 index 00000000000..9e6ddbb2498 --- /dev/null +++ b/mysql-test/suite/binlog/t/mariadb-dump_master_log_pos.test @@ -0,0 +1,39 @@ +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_mixed.inc # format-agnostic + +--source include/reset_master_slave.inc +SET @prev_dbug= @@GLOBAL.debug_dbug; + + +--connect (switcher, 127.0.0.1, root, , , $SERVER_MYPORT_1) + --delimiter // + CREATE PROCEDURE switch_binlog() BEGIN + SET @@SESSION.debug_sync= 'now WAIT_FOR after_sbs'; + FLUSH BINARY LOGS; + FLUSH BINARY LOGS; # for good measure + SET @@SESSION.debug_sync= 'now SIGNAL sbs_continue'; + END;// + --delimiter ; + --send CALL switch_binlog() +--connection default + +SET @@GLOBAL.debug_dbug= 'd,wait_after_sbs'; +--echo \$MYSQL_DUMP --delete-master-logs test +--replace_regex /MASTER_LOG_POS=\d+/MASTER_LOG_POS/i +--exec $MYSQL_DUMP --compact --delete-master-logs test + + +--connection switcher + --reap + DROP PROCEDURE switch_binlog; +--connection default +--disconnect switcher + +--replace_column 2 # +SHOW BINARY LOGS; + + +# Clean-up +SET @@GLOBAL.debug_dbug= @prev_dbug; +SET @@SESSION.debug_sync= RESET; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8be73d4ba48..9066267160e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4243,6 +4243,11 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) if (check_global_access(thd, PRIV_STMT_SHOW_BINLOG_STATUS)) goto error; res = show_binlog_info(thd); + DBUG_EXECUTE_IF("wait_after_sbs", { + DBUG_SET("-d,wait_after_sbs"); + DBUG_ASSERT(!debug_sync_set_action(thd, + STRING_WITH_LEN("now SIGNAL after_sbs WAIT_FOR sbs_continue"))); + }); break; }