-
Brandon Nesterenko authored
MDEV-34274: Test rpl.rpl_change_master_demote frequently fails on buildbot with "IO thread should not be running..." The test rpl.rpl_change_master_demote used a `sleep 1` command to give time for a START SLAVE UNTIL to start the slave threads and wait for them to automatically die by UNTIL. On machines with heavy load (especially MSAN bb builders), one second was not enough, and the test would fail due to the IO thread still being up. This patch fixes the test by replacing the sleep with specific conditions to wait for. The test cannot wait for the IO or SQL threads to start, as it would be possible that they would be started and stopped by the time the MTR executor would check the slave status. So instead, we test for proof that they existed via the Connections status variable being incremented by at least 2 (Connections just shows the global thread id). At this point, we still can't use the wait_for_slave_to_stop helper, as the SQL/IO_Running fields of SHOW SLAVE STATUS may not be updated yet. So instead, we use information_schema.processlist, which would show the presence of the Slave_SQL/IO threads. So to "wait for the slave to stop", we wait for the Slave_SQL/IO threads to be gone from the processlist.
8c8b3ab7