Commit 04c5af18 authored by unknown's avatar unknown

Bug#26622 MASTER_POS_WAIT does not work as documented

MASTER_POS_WAIT return values are different than expected when the server is not a slave. 
It returns -1 instead of NULL.

Fixed with correcting  st_relay_log_info::wait_for_pos() to return the proper
value in the case of rli info is not inited.


mysql-test/r/rpl_master_pos_wait.result:
  results changed
mysql-test/t/rpl_master_pos_wait.test:
  the new test to check that select master_pos_wait() to a server does 
  not have master info returns NULL as specified.
sql/slave.cc:
  changing the return value to correspond the specification.
parent d20bfbbe
...@@ -16,3 +16,9 @@ select master_pos_wait('master-bin.999999',0); ...@@ -16,3 +16,9 @@ select master_pos_wait('master-bin.999999',0);
stop slave sql_thread; stop slave sql_thread;
master_pos_wait('master-bin.999999',0) master_pos_wait('master-bin.999999',0)
NULL NULL
"*** must be empty ***"
show slave status;
"*** must be NULL ***"
select master_pos_wait('foo', 98);
master_pos_wait('foo', 98)
NULL
...@@ -15,4 +15,15 @@ stop slave sql_thread; ...@@ -15,4 +15,15 @@ stop slave sql_thread;
connection slave; connection slave;
reap; reap;
#
# bug#26622 MASTER_POS_WAIT does not work as documented
#
connection master;
echo "*** must be empty ***";
query_vertical show slave status;
echo "*** must be NULL ***";
select master_pos_wait('foo', 98);
# End of 4.1 tests # End of 4.1 tests
...@@ -2685,7 +2685,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, ...@@ -2685,7 +2685,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
longlong timeout) longlong timeout)
{ {
if (!inited) if (!inited)
return -1; return -2;
int event_count = 0; int event_count = 0;
ulong init_abort_pos_wait; ulong init_abort_pos_wait;
int error=0; int error=0;
......
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