MDEV-40122: +DEFAULT is not a valid value for master_heartbeat_period - #5491
MDEV-40122: +DEFAULT is not a valid value for master_heartbeat_period#5491prathamesh04 wants to merge 1 commit into
+DEFAULT is not a valid value for master_heartbeat_period#5491Conversation
|
Hi @LinuxJedi, could you please take a look? This is a small parser fix for MDEV-40122, a mismerge of MDEV-38454 into MDEV-28302, with a regression test in |
|
I’m quite certain that LinuxJedi doesn’t work at MariaDB anymore. |
|
Agree. Why should
It seems that |
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
LGTM. Please stand by for the final review.
MDEV-28302 changed the grammar for master_heartbeat_period to accept DEFAULT (via num_or_default), while MDEV-38454 added an opt_plus to allow numeric values with an explicit `+` sign. The combination made the rule `opt_plus num_or_default`, which also accepted `+DEFAULT`, equivalent to `= DEFAULT`. Split the rule so that `opt_plus` may only precede a numeric literal, and DEFAULT is a separate alternative. Now `master_heartbeat_period= +DEFAULT` is a syntax error again, while `= +45` and `= DEFAULT` are both accepted. Remove the now-unused num_or_default production.
5a3eea4 to
a14ac29
Compare
gkodinov
left a comment
There was a problem hiding this comment.
LGTM. Please keep working with the final reviewer.
Summary
CHANGE MASTER TO master_heartbeat_period= +DEFAULT;was accepted as valid syntax (equivalent to= DEFAULT). It now produces a syntax error again.This is a mismerge of MDEV-38454 into MDEV-28302:
MASTER_HEARTBEAT_PERIOD_SYM '=' num_or_default, addingDEFAULTsupport.opt_plus(to allow values like+60) on top of it, resulting inopt_plus num_or_default, which also accepts+DEFAULT.Fix
Split the grammar rule in
sql/sql_yacc.yysoopt_plusmay only precede a numeric literal:MASTER_HEARTBEAT_PERIOD_SYM '=' opt_plus NUM_literal(numbers, with or without+)MASTER_HEARTBEAT_PERIOD_SYM '=' DEFAULTmaster_heartbeat_period= +45and= DEFAULTstill work;+DEFAULTis rejected withER_PARSE_ERROR.Note: 11.4 and 11.8 use
opt_plus NUM_literal(noDEFAULTat all), so they are not affected; the bug only exists on the 12.x line.Test
Extended
mysql-test/main/change_master_default.test(the MDEV-28302 test) with a regression case for+DEFAULTplus positive checks for+45andDEFAULT. Verified with:Both tests pass (the generated parser is rebuilt from
sql_yacc.yyat build time).Jira: https://jira.mariadb.org/browse/MDEV-40122
This contribution is licensed under the 3-clause BSD license.