mariadb/mysql-test/main/master_retry_count_basic.test
ParadoxV5 e2dbd9b6ac MDEV-35304: Add Connects_Tried and Master_Retry_Count to SSS
When the IO thread (re)connect to a primary,
no updates are available besides unique errors that cause the failure.
These new `Master_info` numbers supplement SHOW SLAVE STATUS’s (most-
recent) ‘Connecting’ state with statistics on (re)connect attempts:

* `Connects_Tried`: how many retries have been attempted so far
  This was previously a local variable that only counted re-attempts;
  it’s now meaningful even after the “Connecting” state concludes.
* `Master_Retry_Count` (from MDEV-25674): out of how many configured

Side-note: Some of the tests updated by this commit dump the entire
SHOW SLAVE STATUS, which might include non-deterministic entries.

Reviewed-by: Kristian Nielsen <knielsen@knielsen-hq.org>
Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
2025-02-26 20:37:53 -07:00

80 lines
2.8 KiB
Text

# MDEV-25674: Test the `Master_Retry_Count` field of
# CHANGE MASTER [name] TO and SHOW SLAVE [name] STATUS & co. (no feature testing)
# Two connections tests that the field is now per-connection.
--source include/have_perfschema.inc
--echo # Use `--master-retry-count` when not specified
CHANGE MASTER 'named' TO master_host='example.com';
CHANGE MASTER TO master_host='127.0.0.1', master_ssl_verify_server_cert=0;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # Replace when specified
CHANGE MASTER 'named' TO master_retry_count=11;
# Default master does not replace named master
CHANGE MASTER TO master_retry_count=10;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # Conventional views also show the configuations
--let $all_slaves_status= 1
--let $status_items= Connection_name, Master_Retry_Count
--source include/show_slave_status.inc
--let $all_slaves_status= 0
--let $status_items= Master_Retry_Count
--source include/show_slave_status.inc
--let $slave_name= 'named'
--source include/show_slave_status.inc
SELECT CHANNEL_NAME, CONNECTION_RETRY_COUNT
FROM performance_schema.replication_connection_configuration;
--echo # Restore specified config on restart
--let $restart_parameters= --skip-slave-start
--source include/restart_mysqld.inc # not_embedded
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # Keep specified config on RESET REPLICA
RESET REPLICA 'named';
RESET REPLICA;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # Don't replace when not specified
CHANGE MASTER TO master_user='root';
CHANGE MASTER 'named' TO master_user='root';
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # 0 internally means "not specified"
CHANGE MASTER TO master_retry_count=0;
CHANGE MASTER 'named' TO master_retry_count=0;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # Truncates decimals
CHANGE MASTER TO master_retry_count=0.5;
CHANGE MASTER 'named' TO master_retry_count=0.5;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
--echo # Caps values (such as UINT64_MAX + 1) to `--master-retry-count`'s max
CHANGE MASTER TO master_retry_count=18446744073709551616;
CHANGE MASTER 'named' TO master_retry_count=18446744073709551616;
SELECT Connection_name
FROM information_schema.SLAVE_STATUS
WHERE Master_Retry_Count IN (4294967295, 18446744073709551615);
--echo # Negative
--error ER_PARSE_ERROR
CHANGE MASTER TO master_retry_count=-1;
--error ER_PARSE_ERROR
CHANGE MASTER 'named' TO master_retry_count=-1;
--echo # NaN
--error ER_PARSE_ERROR
CHANGE MASTER TO master_retry_count='5';
--error ER_PARSE_ERROR
CHANGE MASTER 'named' TO master_retry_count='5';
--echo # Cleanup
RESET REPLICA 'named' ALL;