| 1 |
# |
| 2 |
# Bug #30703 SHOW STATUS LIKE 'Slave_running' is not compatible with `SHOW SLAVE STATUS' |
| 3 |
# The test verifies that SHOW STATUS LIKE 'Slave_running' displays ON |
| 4 |
# if and only if `SHOW SLAVE STATUS' displays YES for Slave_IO_Running and Slave_SQL_Running |
| 5 |
# |
| 6 |
source include/have_debug.inc; |
| 7 |
source include/have_debug_sync.inc; |
| 8 |
source include/master-slave.inc; |
| 9 |
|
| 10 |
connection slave; |
| 11 |
|
| 12 |
SET DEBUG_SYNC= 'RESET'; |
| 13 |
source include/stop_slave.inc; |
| 14 |
SET @saved_dbug = @@GLOBAL.debug_dbug; |
| 15 |
set global debug_dbug= 'd,dbug.before_get_running_status_yes'; # to block due-started IO |
| 16 |
|
| 17 |
# Test 1. Slave is stopped |
| 18 |
|
| 19 |
--echo Slave_running, Slave_IO_Running, Slave_SQL_Running, must be OFF, NO, NO in three following queries |
| 20 |
|
| 21 |
SHOW STATUS LIKE 'Slave_running'; |
| 22 |
let $status= query_get_value("show slave status", Slave_IO_Running, 1); |
| 23 |
echo Slave_IO_Running= $status; |
| 24 |
let $status= query_get_value("show slave status", Slave_SQL_Running, 1); |
| 25 |
echo Slave_SQL_Running= $status; |
| 26 |
|
| 27 |
# Test 2. The slave IO thread is started but not yet got connected to master |
| 28 |
# and SQL thread is not started |
| 29 |
|
| 30 |
start slave io_thread; |
| 31 |
|
| 32 |
# |
| 33 |
# Notice a difference between versions in showing p.2: |
| 34 |
# 5.1 has two OFF,ON IO-thread state running state whereas later versions |
| 35 |
# have three: OFF,Connecting,ON. |
| 36 |
# Hence, 5.1 must display OFF NO NO where as 5.1+ OFF Connecting NO |
| 37 |
# |
| 38 |
--echo Slave_running, Slave_IO_Running, Slave_SQL_Running must be OFF Connecting NO in three following queries |
| 39 |
|
| 40 |
SHOW STATUS LIKE 'Slave_running'; |
| 41 |
let $status= query_get_value("show slave status", Slave_IO_Running, 1); |
| 42 |
echo Slave_IO_Running= $status; |
| 43 |
let $status= query_get_value("show slave status", Slave_SQL_Running, 1); |
| 44 |
echo Slave_SQL_Running= $status; |
| 45 |
|
| 46 |
# Test 3. The slave IO thread is started and got connected to master |
| 47 |
# and SQL thread is still not started |
| 48 |
|
| 49 |
SET DEBUG_SYNC='now SIGNAL signal.io_thread_let_running'; # unblock IO thread now |
| 50 |
let $slave_param= Slave_IO_Running; |
| 51 |
let $slave_param_value= YES; |
| 52 |
source include/wait_for_slave_param.inc; |
| 53 |
|
| 54 |
--echo Slave_running, Slave_IO_Running, Slave_SQL_Running must be OFF YES NO in three following queries |
| 55 |
|
| 56 |
SHOW STATUS LIKE 'Slave_running'; |
| 57 |
let $status= query_get_value("show slave status", Slave_IO_Running, 1); |
| 58 |
echo Slave_IO_Running= $status; |
| 59 |
let $status= query_get_value("show slave status", Slave_SQL_Running, 1); |
| 60 |
echo Slave_SQL_Running= $status; |
| 61 |
|
| 62 |
# Test 4. The slave IO thread is started and got connected to master |
| 63 |
# and SQL thread is started |
| 64 |
|
| 65 |
start slave sql_thread; |
| 66 |
source include/wait_for_slave_sql_to_start.inc; |
| 67 |
|
| 68 |
--echo Slave_running, Slave_IO_Running, Slave_SQL_Running must be ON, YES, YES in three following queries |
| 69 |
|
| 70 |
SHOW STATUS LIKE 'Slave_running'; |
| 71 |
let $status= query_get_value("show slave status", Slave_IO_Running, 1); |
| 72 |
echo Slave_IO_Running= $status; |
| 73 |
let $status= query_get_value("show slave status", Slave_SQL_Running, 1); |
| 74 |
echo Slave_SQL_Running= $status; |
| 75 |
|
| 76 |
# cleanup |
| 77 |
|
| 78 |
connection slave; |
| 79 |
|
| 80 |
SET @@GLOBAL.debug_dbug = @saved_dbug; |
| 81 |
SET DEBUG_SYNC= 'RESET'; |
| 82 |
--echo End of tests |
| 83 |
--source include/rpl_end.inc |