Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5340,7 +5340,7 @@ void do_sync_with_master(struct st_command *command)
long offset= 0;
char *p= command->first_argument;
const char *offset_start= p;
char *start, *buff= 0;
char *start, *buff= 0, *str;
start= const_cast<char*>("");

if (*offset_start)
Expand All @@ -5358,15 +5358,15 @@ void do_sync_with_master(struct st_command *command)
p++;
while (*p && my_isspace(charset_info, *p))
p++;
start= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(p)+1,
MYF(MY_WME|MY_FAE));
get_string(&buff, &p, command);
str= buff= (char*)my_malloc(PSI_NOT_INSTRUMENTED, strlen(p)+1,
MYF(MY_WME|MY_FAE));
start= get_string(&str, &p, command);
}
command->last_argument= p;
}
do_sync_with_master2(command, offset, start);
if (buff)
my_free(start);
my_free(buff);
return;
}

Expand Down Expand Up @@ -8417,7 +8417,7 @@ void do_get_errcodes(struct st_command *command)


/*
Get a string; Return ptr to end of string
Get a string; Return ptr to start of string
Strings may be surrounded by " or '

If string is a '$variable', return the value of the variable.
Expand Down
21 changes: 21 additions & 0 deletions mysql-test/suite/rpl/r/mysqltest_sync_with_master_named.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
connect master, 127.0.0.1, root, , , $MASTER_MYPORT;
FLUSH BINARY LOGS;
connect slave, 127.0.0.1, root, , , $SLAVE_MYPORT;
SET @@SESSION.default_master_connection= 'literal';
CHANGE MASTER TO
master_host='127.0.0.1', master_port=MASTER_MYPORT, master_user='root';
include/start_slave.inc
include/stop_slave.inc
RESET SLAVE ALL;
# MDEV-40996
connection master;
FLUSH BINARY LOGS;
connection slave;
SET @@SESSION.default_master_connection= 'variable';
CHANGE MASTER TO
master_host='127.0.0.1', master_port=MASTER_MYPORT, master_user='root';
include/start_slave.inc
include/stop_slave.inc
RESET SLAVE ALL;
disconnect master;
disconnect slave;
42 changes: 42 additions & 0 deletions mysql-test/suite/rpl/t/mysqltest_sync_with_master_named.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--source include/have_binlog_format_mixed.inc # format-agnostic


--connect (master, 127.0.0.1, root, , , $MASTER_MYPORT)
FLUSH BINARY LOGS;
--save_master_pos

--connect (slave, 127.0.0.1, root, , , $SLAVE_MYPORT)
SET @@SESSION.default_master_connection= 'literal';
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval CHANGE MASTER TO
master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root';
--source include/start_slave.inc

--sync_with_master 0, literal

--source include/stop_slave.inc
RESET SLAVE ALL;


--echo # MDEV-40996

--connection master
FLUSH BINARY LOGS;
--save_master_pos

--connection slave
--let $connection= variable
--eval SET @@SESSION.default_master_connection= '$connection'
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval CHANGE MASTER TO
master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root';
--source include/start_slave.inc

--sync_with_master 0, $connection

--source include/stop_slave.inc
RESET SLAVE ALL;


--disconnect master
--disconnect slave