1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-7640: CHANGE MASTER TO doesn't work with prepared statements

When CHANGE MASTER was executed as a PS, its attributes were wrongly
getting reset toward the end of PREPARE. As a result, the subsequent
executions had no effect. Fixed by making sure that the CHANGE MASTER
attributes are preserved during the lifetime of the PS.
This commit is contained in:
Nirbhay Choubey
2015-10-11 17:06:03 -04:00
parent 16c4b3c68b
commit 978c2a37c0
5 changed files with 98 additions and 1 deletions

View File

@ -3416,7 +3416,8 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
thd->mdl_context.release_transactional_locks();
}
lex_end(lex);
/* Preserve CHANGE MASTER attributes */
lex_end_stage1(lex);
cleanup_stmt();
thd->restore_backup_statement(this, &stmt_backup);
thd->stmt_arena= old_stmt_arena;
@ -3997,6 +3998,10 @@ void Prepared_statement::deallocate()
{
/* We account deallocate in the same manner as mysqld_stmt_close */
status_var_increment(thd->status_var.com_stmt_close);
/* It should now be safe to reset CHANGE MASTER parameters */
lex_end_stage2(lex);
/* Statement map calls delete stmt on erase */
thd->stmt_map.erase(this);
}