Bug #121966 CHANGE REPLICATION SOURCE accepts 2 for documented binary options
Description:
The MySQL 26.10 Reference Manual, “CHANGE REPLICATION SOURCE TO Statement” (https://dev.mysql.com/doc/refman/26.10/en/change-replication-source-to.html), documents these options as:
SOURCE_SSL = {0|1}
SOURCE_SSL_VERIFY_SERVER_CERT = {0|1}
GET_SOURCE_PUBLIC_KEY = {0|1}
SOURCE_AUTO_POSITION = {0|1}
However, CHANGE REPLICATION SOURCE TO accepts 2 for each option and silently treats it as enabled. The first case reports YES for all three SSL-related options. With @@GLOBAL.gtid_mode=ON, the SOURCE_AUTO_POSITION variant reports AUTO_POSITION as 1.
Values outside the documented {0|1} domain should be rejected instead of normalized.
How to repeat:
Run as root. For the SOURCE_AUTO_POSITION variant, start the stock server with this configuration:
[mysqld]
gtid_mode=ON
enforce_gtid_consistency=ON
CHANGE REPLICATION SOURCE TO
SOURCE_HOST='127.0.0.1', SOURCE_SSL=0,
SOURCE_SSL_VERIFY_SERVER_CERT=0, GET_SOURCE_PUBLIC_KEY=0
FOR CHANNEL 'ch1';
CHANGE REPLICATION SOURCE TO
SOURCE_SSL=2, SOURCE_SSL_VERIFY_SERVER_CERT=2, GET_SOURCE_PUBLIC_KEY=2
FOR CHANNEL 'ch1';
SELECT SSL_ALLOWED, SSL_VERIFY_SERVER_CERTIFICATE, GET_PUBLIC_KEY
FROM performance_schema.replication_connection_configuration
WHERE CHANNEL_NAME='ch1';
-- Observed: YES, YES, YES
-- Expected: the preceding CHANGE REPLICATION SOURCE TO is rejected
RESET REPLICA ALL FOR CHANNEL 'ch1';
-- Variant: run on a server configured as shown above.
SELECT @@GLOBAL.gtid_mode;
-- Observed prerequisite: ON
CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1'
FOR CHANNEL 'ch2';
CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION=2
FOR CHANNEL 'ch2';
SELECT AUTO_POSITION
FROM performance_schema.replication_connection_configuration
WHERE CHANNEL_NAME='ch2';
-- Observed: 1
-- Expected: the preceding CHANGE REPLICATION SOURCE TO is rejected
RESET REPLICA ALL FOR CHANNEL 'ch2';
Suggested fix:
Validate these options before converting them to Boolean values, and reject integers other than 0 and 1.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.