Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2f8cea4
MDEV-37530: Create iterables for Repl. info files
ParadoxV5 Nov 4, 2025
e14601a
MDEV-37530: Link `InfoFile` structs to `mi`/`rli`
ParadoxV5 Nov 6, 2025
ee27c8c
MDEV-37530 × MDEV-28302: `InfoFile` Persistence
ParadoxV5 Nov 7, 2025
9722e56
Merge branch 'main' into MDEV-37530
ParadoxV5 Nov 9, 2025
7a8834b
Silly but deadly mistakes caught by MTR!
ParadoxV5 Nov 9, 2025
3ba73e6
issues found by CI, 1st batch
ParadoxV5 Nov 10, 2025
0069e96
MDEV-37530: CI Round 2 & Early Feedback
ParadoxV5 Nov 15, 2025
fa9b7ae
Cherry-pick #4441 for merge conflict resolution
ParadoxV5 Nov 19, 2025
dc71fe8
Fix: `string_view::const_iterator` on Windows …
ParadoxV5 Nov 19, 2025
e044efd
Split `master_heartbeat_period.from_chars()` again
ParadoxV5 Nov 21, 2025
dde1c4c
MDEV-28302 configurable defaults for CHANGE MASTER
ParadoxV5 Nov 21, 2025
a91537a
MDEV-37530: tiny renames
ParadoxV5 Nov 21, 2025
6f95640
MDEV-37530: nits
ParadoxV5 Nov 23, 2025
2fd00ad
Merge branch 'main' into MDEV-37530
ParadoxV5 Nov 23, 2025
80b604f
MDEV-37530: more adjustments, now for MDEV-28302
ParadoxV5 Nov 26, 2025
61b2a4a
MDEV-28302 Configurable defaults for for CHANGE MASTER
ParadoxV5 Nov 26, 2025
3bc2b77
MDEV-28302 CI-based fixes (batch 1?)
ParadoxV5 Nov 27, 2025
34a16b3
this nit is for MDEV-37530
ParadoxV5 Nov 27, 2025
de37744
Merge branch 'main' into MDEV-37530
ParadoxV5 Nov 27, 2025
d89517d
How’s this?
ParadoxV5 Nov 28, 2025
0010d44
Microsoft loves doing macro-hard things, don’t they?
ParadoxV5 Nov 28, 2025
cad3ca2
MDEV-37530: hm, I like this implementation better
ParadoxV5 Nov 28, 2025
d00d4b2
batch 2?
ParadoxV5 Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libmysqld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/field.cc ../sql/field_conv.cc ../sql/field_comp.cc
../sql/filesort_utils.cc ../sql/sql_digest.cc
../sql/filesort.cc ../sql/grant.cc
../sql/gstream.cc ../sql/slave.cc
../sql/gstream.cc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when moving these functions to mysys, don't forget to remove slave.cc from libmysqld/CMakeLists.txt
init_intvar_from_file()’s code documentation

../sql/signal_handler.cc
../sql/handler.cc ../sql/hash_filo.cc ../sql/hostname.cc
../sql/init.cc ../sql/item_buff.cc ../sql/item_cmpfunc.cc
Expand Down
102 changes: 102 additions & 0 deletions mysql-test/main/change_master_default.result
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question for the future (no need to answer immediately):
Should other fields (the ones not listed) “recognize” the DEFAULT keyword as well?

Fields with trivial DEFAULTs

  • Primary & Relay File/Pos:
    • MASTER_LOG_FILE: DEFAULT is empty, and empty means “first”.
    • MASTER_LOG_POS/RELAY_LOG_POS: DEFAULT is 4
      • silently set to DEFAULT if set to less
    • ignored with a warning when using GTID
  • MASTER_PORT: DEFAULT is the MariaDB port
    • 0 is (technically) invalid.
  • IGNORE_SERVER_IDS/DO_DOMAIN_IDS/IGNORE_DOMAIN_IDS: DEFAULT is empty.
  • MASTER_DELAY: DEFAULT is 0.
    • int32_t on paper, unsigned in practice: errors if set larger than MASTER_DELAY_MAX (0x7F'FF'FF'FF)

No DEFAULT – “recognizes” as an error

Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
CREATE PROCEDURE show_defaultable_fields()
SELECT connection_name,
connect_retry,
master_ssl_allowed,
master_ssl_ca_file,
master_ssl_ca_path,
master_ssl_cert,
master_ssl_cipher,
master_ssl_key,
`master_ssl_verify_server_cert`, # MDEV-38194
master_ssl_crl,
master_ssl_crlpath,
using_gtid,
master_retry_count,
slave_heartbeat_period
FROM information_schema.slave_status ORDER BY connection_name;
CHANGE MASTER 'unset' TO master_host='127.0.1.1';
CHANGE MASTER 'defaulted' TO
master_connect_retry= DEFAULT,
master_ssl= DEFAULT,
master_ssl_ca= DEFAULT,
master_ssl_capath= DEFAULT,
master_ssl_cert= DEFAULT,
master_ssl_cipher= DEFAULT,
master_ssl_key= DEFAULT,
master_ssl_verify_server_cert= DEFAULT,
master_ssl_crl= DEFAULT,
master_ssl_crlpath= DEFAULT,
master_use_gtid= DEFAULT,
master_retry_count= DEFAULT,
master_heartbeat_period= DEFAULT,
master_host= '127.0.1.2';
CHANGE MASTER TO # Default master does not replace named masters
master_connect_retry= 90,
master_ssl= FALSE,
master_ssl_ca= 'specified_ca',
master_ssl_capath= 'specified_capath',
master_ssl_cert= 'specified_cert',
master_ssl_cipher= 'specified_cipher',
master_ssl_key= 'specified_key',
master_ssl_verify_server_cert= FALSE,
master_ssl_crl= 'specified_crl',
master_ssl_crlpath= 'specified_crlpath',
master_use_gtid= NO,
master_retry_count= 150000,
master_heartbeat_period= 45,
master_host='127.0.0.1';
CALL show_defaultable_fields();
connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period
90 No specified_ca specified_capath specified_cert specified_cipher specified_key No specified_crl specified_crlpath No 150000 45.000
defaulted 60 Yes Yes Slave_Pos 100000 60.000
unset 60 Yes Yes Slave_Pos 100000 60.000
# restart: --skip-slave-start --master-connect-retry=30 --skip-master-ssl --master-ssl-ca=default_ca --master-ssl-capath=default_capath --master-ssl-cert=default_cert --master-ssl-cipher=default_cipher --master-ssl-key=default_key --skip-master-ssl-verify-server-cert --master-ssl-crl=default_crl --master-ssl-crlpath=default_crlpath --master-use-gtid=CURRENT_POS --master-retry-count=50000 --master-heartbeat-period=15
CALL show_defaultable_fields();
connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period
90 No specified_ca specified_capath specified_cert specified_cipher specified_key No specified_crl specified_crlpath No 150000 45.000
defaulted 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000
unset 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000
SET @@GLOBAL.slave_net_timeout= 100;
SELECT connection_name, slave_heartbeat_period
FROM information_schema.slave_status ORDER BY connection_name;
connection_name slave_heartbeat_period
45.000
defaulted 15.000
unset 15.000
CHANGE MASTER TO
master_connect_retry= DEFAULT,
master_ssl= DEFAULT,
master_ssl_ca= DEFAULT,
master_ssl_capath= DEFAULT,
master_ssl_cert= DEFAULT,
master_ssl_cipher= DEFAULT,
master_ssl_key= DEFAULT,
master_ssl_verify_server_cert= DEFAULT,
master_ssl_crl= DEFAULT,
master_ssl_crlpath= DEFAULT,
master_use_gtid= DEFAULT,
master_retry_count= DEFAULT,
master_heartbeat_period= DEFAULT;
CALL show_defaultable_fields();
connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period
30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000
defaulted 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000
unset 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000
RESET REPLICA 'unset' ALL;
CHANGE MASTER 'unset' TO master_host='127.0.1.3';
# restart_abort: --master-heartbeat-period=''
# restart_abort: --master-heartbeat-period=123abc
# restart_abort: --master-heartbeat-period=-1
# restart_abort: --master-heartbeat-period=4294967.296
# restart: --skip-slave-start --master-heartbeat-period=0.000499
CALL mtr.add_suppression('.*master-heartbeat-period.+0.* disabl.+');
# restart: --skip-slave-start --skip-master-ssl --master-ssl --skip-master-ssl-verify-server-cert --master-ssl-verify-server-cert --master-use-gtid=NO --autoset-master-use-gtid --master-heartbeat-period=45 --autoset-master-heartbeat-period
CALL show_defaultable_fields();
connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period
60 Yes Yes Slave_Pos 100000 60.000
defaulted 60 Yes Yes Slave_Pos 100000 60.000
unset 60 Yes Yes Slave_Pos 100000 60.000
DROP PROCEDURE show_defaultable_fields;
RESET REPLICA 'unset' ALL;
RESET REPLICA 'defaulted' ALL;
RESET REPLICA ALL;
145 changes: 145 additions & 0 deletions mysql-test/main/change_master_default.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# MDEV-28302: Test how `CHANGE MASTER [named]` reads server
# options for its default values and the lack of those options.
# The test creates multiple CHANGE MASTER connections,
# where the defaultable fields of a connection are:
# * left unset
# * set to `DEFAULT`
# * configured with values

# only need CHANGE MASTER and IS.slave_status
--source include/have_binlog_format_mixed.inc

CREATE PROCEDURE show_defaultable_fields()
SELECT connection_name,
connect_retry,
master_ssl_allowed,
master_ssl_ca_file,
master_ssl_ca_path,
master_ssl_cert,
master_ssl_cipher,
master_ssl_key,
`master_ssl_verify_server_cert`, # MDEV-38194
master_ssl_crl,
master_ssl_crlpath,
using_gtid,
master_retry_count,
slave_heartbeat_period
FROM information_schema.slave_status ORDER BY connection_name;

CHANGE MASTER 'unset' TO master_host='127.0.1.1';

CHANGE MASTER 'defaulted' TO
master_connect_retry= DEFAULT,
master_ssl= DEFAULT,
master_ssl_ca= DEFAULT,
master_ssl_capath= DEFAULT,
master_ssl_cert= DEFAULT,
master_ssl_cipher= DEFAULT,
master_ssl_key= DEFAULT,
master_ssl_verify_server_cert= DEFAULT,
master_ssl_crl= DEFAULT,
master_ssl_crlpath= DEFAULT,
master_use_gtid= DEFAULT,
master_retry_count= DEFAULT,
master_heartbeat_period= DEFAULT,
master_host= '127.0.1.2';

# This subject does not stay constant.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this comment is trying to say

CHANGE MASTER TO # Default master does not replace named masters
master_connect_retry= 90,
master_ssl= FALSE,
master_ssl_ca= 'specified_ca',
master_ssl_capath= 'specified_capath',
master_ssl_cert= 'specified_cert',
master_ssl_cipher= 'specified_cipher',
master_ssl_key= 'specified_key',
master_ssl_verify_server_cert= FALSE,
master_ssl_crl= 'specified_crl',
master_ssl_crlpath= 'specified_crlpath',
master_use_gtid= NO,
master_retry_count= 150000,
master_heartbeat_period= 45,
master_host='127.0.0.1';

# Show freshly created configurations
CALL show_defaultable_fields();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and for the other CALL calls, to make the .result file more readable there's:

Suggested change
CALL show_defaultable_fields();
--query_vertical CALL show_defaultable_fields();



# Those set or left as `DEFAULT` should pick up changes to defaults.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test! Also these kinds of statements which set up expectations/context for the results should be --echo'd, so one can read through just the .result file and understand what is happening.


--let $restart_parameters= --skip-slave-start --master-connect-retry=30 --skip-master-ssl --master-ssl-ca=default_ca --master-ssl-capath=default_capath --master-ssl-cert=default_cert --master-ssl-cipher=default_cipher --master-ssl-key=default_key --skip-master-ssl-verify-server-cert --master-ssl-crl=default_crl --master-ssl-crlpath=default_crlpath --master-use-gtid=CURRENT_POS --master-retry-count=50000 --master-heartbeat-period=15
--source include/restart_mysqld.inc # not_embedded

CALL show_defaultable_fields();


# The `DEFAULT` of `master_heartbeat_period` changes with `@@slave_net_timeout`.

SET @@GLOBAL.slave_net_timeout= 100;

SELECT connection_name, slave_heartbeat_period
FROM information_schema.slave_status ORDER BY connection_name;


# `DEFAULT` overwrites the existing configs only for the CHANGEd connection.

CHANGE MASTER TO
master_connect_retry= DEFAULT,
master_ssl= DEFAULT,
master_ssl_ca= DEFAULT,
master_ssl_capath= DEFAULT,
master_ssl_cert= DEFAULT,
master_ssl_cipher= DEFAULT,
master_ssl_key= DEFAULT,
master_ssl_verify_server_cert= DEFAULT,
master_ssl_crl= DEFAULT,
master_ssl_crlpath= DEFAULT,
master_use_gtid= DEFAULT,
master_retry_count= DEFAULT,
master_heartbeat_period= DEFAULT;

CALL show_defaultable_fields();


# Recreate 'unset' to test that it saves `DEFAULT`, not the options' values
--disable_warnings
RESET REPLICA 'unset' ALL;
--enable_warnings
CHANGE MASTER 'unset' TO master_host='127.0.1.3';

# Invalid `--master-heartbeat-period` values should abort the server
--source include/shutdown_mysqld.inc
--let $restart_parameters= --master-heartbeat-period=''
--echo # restart_abort: $restart_parameters
--write_line "restart_abort: $restart_parameters" $_expect_file_name
--let $restart_parameters= --master-heartbeat-period=123abc
--echo # restart_abort: $restart_parameters
--write_line "restart_abort: $restart_parameters" $_expect_file_name
--let $restart_parameters= --master-heartbeat-period=-1
--echo # restart_abort: $restart_parameters
--write_line "restart_abort: $restart_parameters" $_expect_file_name
--let $restart_parameters= --master-heartbeat-period=4294967.296
--echo # restart_abort: $restart_parameters
--write_line "restart_abort: $restart_parameters" $_expect_file_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what the above restart parameters are trying to test. It looks like some error testing setup, but I don't see the server being actually started or any error verification.


# Numbers between 0 and 0.5 exclusive should warn about rounding to 0 (disabled)
--let $restart_parameters= --skip-slave-start --master-heartbeat-period=0.000499
--source include/start_mysqld.inc
CALL mtr.add_suppression('.*master-heartbeat-period.+0.* disabl.+');

# Test prefixes: adding `auto-` and omitting `skip-`
--let $restart_parameters= --skip-slave-start --skip-master-ssl --master-ssl --skip-master-ssl-verify-server-cert --master-ssl-verify-server-cert --master-use-gtid=NO --autoset-master-use-gtid --master-heartbeat-period=45 --autoset-master-heartbeat-period
--source include/restart_mysqld.inc

CALL show_defaultable_fields();


# Clean-up

DROP PROCEDURE show_defaultable_fields;

RESET REPLICA 'unset' ALL;
RESET REPLICA 'defaulted' ALL;
RESET REPLICA ALL;
# check-testcase
#CHANGE MASTER TO master_user= 'root', master_ssl_verify_server_cert= FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover CHANGE MASTER TO from old testing?

Also the test needs an

--echo # End of main.change_master_default

36 changes: 14 additions & 22 deletions mysql-test/main/master_retry_count_basic.result
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# 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;
Connection_name Master_Retry_Count
1
named 1
# Replace when specified
CHANGE MASTER 'named' TO master_retry_count=11;
CHANGE MASTER TO master_retry_count=10;
# Replace `--master-retry-count` when specified
CHANGE MASTER 'named' TO master_retry_count=11, master_host='example.com';
CHANGE MASTER TO master_retry_count=10,
master_host='127.0.0.1', master_ssl_verify_server_cert=0;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
Connection_name Master_Retry_Count
Expand Down Expand Up @@ -49,17 +42,17 @@ FROM information_schema.SLAVE_STATUS;
Connection_name Master_Retry_Count
10
named 11
# 0 internally means "not specified"
# 0 does not mean "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;
Connection_name Master_Retry_Count
10
named 11
0
named 0
# Truncates decimals
CHANGE MASTER TO master_retry_count=0.5;
CHANGE MASTER 'named' TO master_retry_count=0.5;
CHANGE MASTER TO master_retry_count=10.75;
CHANGE MASTER 'named' TO master_retry_count=11.25;
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
Connection_name Master_Retry_Count
Expand All @@ -68,12 +61,11 @@ named 11
# 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);
Connection_name

named
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;
Connection_name Master_Retry_Count
18446744073709551615
named 18446744073709551615
# Negative
CHANGE MASTER TO master_retry_count=-1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1' at line 1
Expand Down
30 changes: 13 additions & 17 deletions mysql-test/main/master_retry_count_basic.test
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# 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.
# `CHANGE MASTER [name] TO` and `SHOW SLAVE [name] STATUS` & co..
# feature testing is in `multi_source.connects_tried` and
# `--master-retry-count` testing is in `main.change_master_default`.
# The use of 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;
--echo # Replace `--master-retry-count` when specified
CHANGE MASTER 'named' TO master_retry_count=11, master_host='example.com';
# Default master does not replace named master
CHANGE MASTER TO master_retry_count=10;
CHANGE MASTER TO master_retry_count=10,
master_host='127.0.0.1', master_ssl_verify_server_cert=0; # check-testcase
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;

Expand Down Expand Up @@ -46,24 +43,23 @@ CHANGE MASTER 'named' TO master_user='root';
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;

--echo # 0 internally means "not specified"
--echo # 0 does not mean "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;
CHANGE MASTER TO master_retry_count=10.75;
CHANGE MASTER 'named' TO master_retry_count=11.25;
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);
SELECT Connection_name, Master_Retry_Count
FROM information_schema.SLAVE_STATUS;

--echo # Negative
--error ER_PARSE_ERROR
Expand Down
Loading
Loading