From 04c5af18023014c2925c83df32f68906e706495d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Mar 2008 14:49:21 +0200 Subject: [PATCH] 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. --- mysql-test/r/rpl_master_pos_wait.result | 6 ++++++ mysql-test/t/rpl_master_pos_wait.test | 11 +++++++++++ sql/slave.cc | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/rpl_master_pos_wait.result b/mysql-test/r/rpl_master_pos_wait.result index f0f48de4e07..b831eb9b95a 100644 --- a/mysql-test/r/rpl_master_pos_wait.result +++ b/mysql-test/r/rpl_master_pos_wait.result @@ -16,3 +16,9 @@ select master_pos_wait('master-bin.999999',0); stop slave sql_thread; master_pos_wait('master-bin.999999',0) NULL +"*** must be empty ***" +show slave status; +"*** must be NULL ***" +select master_pos_wait('foo', 98); +master_pos_wait('foo', 98) +NULL diff --git a/mysql-test/t/rpl_master_pos_wait.test b/mysql-test/t/rpl_master_pos_wait.test index 893c8746efc..2f7b18ae04b 100644 --- a/mysql-test/t/rpl_master_pos_wait.test +++ b/mysql-test/t/rpl_master_pos_wait.test @@ -15,4 +15,15 @@ stop slave sql_thread; connection slave; 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 diff --git a/sql/slave.cc b/sql/slave.cc index 181ad4ed8cb..d4d0655f366 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2685,7 +2685,7 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name, longlong timeout) { if (!inited) - return -1; + return -2; int event_count = 0; ulong init_abort_pos_wait; int error=0;