diff --git a/mysql-test/suite/rpl/r/mdev_38454.result b/mysql-test/suite/rpl/r/mdev_38454.result new file mode 100644 index 0000000000000..fc848e381f037 --- /dev/null +++ b/mysql-test/suite/rpl/r/mdev_38454.result @@ -0,0 +1,13 @@ +# Testing master_connect_retry with + sign (expected to work) +CHANGE MASTER TO master_connect_retry=+60; +# Success +# Testing master_connect_retry without + sign (expected to work) +CHANGE MASTER TO master_connect_retry=60; +# Success +# Testing master_heartbeat_period with + sign (should work) +CHANGE MASTER TO master_heartbeat_period=+60; +# Testing both without + sign (should work) +CHANGE MASTER TO master_connect_retry=60; +CHANGE MASTER TO master_heartbeat_period=60; +# Success +RESET SLAVE ALL; diff --git a/mysql-test/suite/rpl/t/mdev_38454.test b/mysql-test/suite/rpl/t/mdev_38454.test new file mode 100644 index 0000000000000..8e1ce1b2dddd6 --- /dev/null +++ b/mysql-test/suite/rpl/t/mdev_38454.test @@ -0,0 +1,37 @@ +# +# MDEV-38454: CHANGE MASTER TO master_heartbeat_period does not accept numbers with `+` sign +# +# Simple test to demonstrate the parser inconsistency has been fixed +# + +# +# Test master_connect_retry with explicit + sign (should work) +# +--echo # Testing master_connect_retry with + sign (expected to work) +CHANGE MASTER TO master_connect_retry=+60; +--echo # Success + +# +# Test master_connect_retry without explicit + sign (should work) +# +--echo # Testing master_connect_retry without + sign (expected to work) +CHANGE MASTER TO master_connect_retry=60; +--echo # Success + +# +# Test master_heartbeat_period with explicit + sign (should work after fix) +# +--echo # Testing master_heartbeat_period with + sign (should work) +CHANGE MASTER TO master_heartbeat_period=+60; + +# +# Test without + sign (should work for both) +# +--echo # Testing both without + sign (should work) +CHANGE MASTER TO master_connect_retry=60; +CHANGE MASTER TO master_heartbeat_period=60; +--echo # Success + + +# Reset +RESET SLAVE ALL; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2789c11b7c5c7..aae4a8a1d60fb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2384,9 +2384,9 @@ master_def: Lex->mi.ssl_crlpath= $3.str; } - | MASTER_HEARTBEAT_PERIOD_SYM '=' NUM_literal + | MASTER_HEARTBEAT_PERIOD_SYM '=' opt_plus NUM_literal { - Lex->mi.heartbeat_period= (float) $3->val_real(); + Lex->mi.heartbeat_period= (float) $4->val_real(); if (unlikely(Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD) || unlikely(Lex->mi.heartbeat_period < 0.0))