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.
5a3eea4 to
a14ac29
Compare
gkodinov
left a comment
There was a problem hiding this comment.
LGTM. Please keep working with the final reviewer.
ParadoxV5
left a comment
There was a problem hiding this comment.
Thanks @prathamesh04; please see my comments.
There was a problem hiding this comment.
Frankly, I’d suggest avoiding breaking num_or_default back to NUM_literal and DEFAULT cases, and instead move the opt_plus under num_or_default’s definition.
But gkodinov and vuvova have already pushed the dissolution of num_or_default.
It’s true that master_heartbeat_period is the only decimal option in CHANGE MASTER, even in the foreseeable future.
But the motivation behind the X_or_defaults (at least the other ones) is to avoid repeating the MASTER_HEARTBEAT_PERIOD_SYM part of the definition, once for the explicit value and once for DEFAULT.
The ideal design was to pass both values and DEFAULTs uniformly to the options themselves… but the path to it turned out to be a lot longer than I could cram when working on MDEV-28302.
Inlining num_or_default’s branches into master_heartbeat_period’s definition also makes a seemingly complex change in contrast to moving the opt_plus.
There was a problem hiding this comment.
Done — opt_plus is now part of num_or_default (num_or_default := opt_plus NUM_literal | DEFAULT), and the action code in master_def stays unified. Thanks for the suggestion.
There was a problem hiding this comment.
Oh. Okay. When I first saw the description of this issue — before I looked at the code — I did a fix locally exactly this way, moving opt_plus into num_or_default. But then I saw your first fix and I kind of liked how small and simple the DEFAULT branch became and I thought your fix was better.
Well, anyway, no need to redo it again. Keep it the way @ParadoxV5 wants, it's his code after all.
There was a problem hiding this comment.
It’s already hard to tell apart someone who agreed after consideration and a yes-man, and these days it’s even harder with 96%-AI vibers in the mix, innit?
Offence not intended; I’m just sombre about the downhill trend as an honest associate dev.
In plainer language:
My suggestion was less about “what I want”, but more to prompt thought on whether the simplicity of the separated branches outweighs num_or_default’s consolidation.
There was a problem hiding this comment.
Thanks for being direct about it — that's fair, and the design question deserves a real answer rather than a quick "done".
I did weigh the two forms before settling. The separated branches (opt_plus NUM_literal / DEFAULT inline in master_def, no num_or_default) are more explicit and would sidestep the $$-initialization trap entirely. What kept me on the consolidated form is that master_def already uses the same X_or_default pattern for its other options, so keeping num_or_default makes the heartbeat branch read like the rest of the grammar instead of being the odd one out. Both are defensible; I chose consistency over brevity, and I'm comfortable with that trade-off.
And to be plain about the yes-man part — none taken, and I'd rather earn the approval than have it handed over. The buildbot crash was mine: moving opt_plus into num_or_default left $$ uninitialized, and I should have caught that before CI did. I verified the fix against the full grammar with bison 3.7.5 and 3.8.2 and on the builder that originally crashed, so this version is the result of checking, not of agreeing.
If you have a concrete reason the separated form is better I'll switch to it; otherwise I'd like to keep the consolidated one.
|
|
||
| # `+` with a number and `DEFAULT` itself remain valid | ||
| CHANGE MASTER 'mdev40122' TO master_heartbeat_period= +45; | ||
| CHANGE MASTER 'mdev40122' TO master_heartbeat_period= DEFAULT; | ||
| RESET SLAVE 'mdev40122' ALL; |
There was a problem hiding this comment.
These are unnecessary, right?
- MDEV-38454’s test (should) cover
master_heartbeat_period= +45. master_heartbeat_period= DEFAULTis earlier in this file.
(Not to mention the additional connection setup.)
There was a problem hiding this comment.
Done — removed the +45/DEFAULT positive checks and the mdev40122 connection setup; the test now only keeps the +DEFAULT regression case. The +45 case is covered by MDEV-38454's rpl_heartbeat_basic and DEFAULT by this file earlier, as you noted.
a14ac29 to
47595ec
Compare
gkodinov
left a comment
There was a problem hiding this comment.
There seems to be a crash in buildbot. Please rectify.
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`. Move the opt_plus under num_or_default's definition, so that `+` 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.
47595ec to
b7640ff
Compare
|
Hi @gkodinov — the crash is fixed and the buildbot builder that crashed now passes. Root cause. The fix for MDEV-40122 folded bison injects a default Fix (commit b7640ff). Set the value explicitly: Verified by reprocessing the full grammar with the repo's Remaining red check. The only failing check is I'd rather not touch that unchanged base test section for an unrelated flake, but if you'd prefer the check to be deterministic I can make the block robust instead. |
There was a problem hiding this comment.
It’s already hard to tell apart someone who agreed after consideration and a yes-man, and these days it’s even harder with 96%-AI vibers in the mix, innit?
Offence not intended; I’m just sombre about the downhill trend as an honest associate dev.
In plainer language:
My suggestion was less about “what I want”, but more to prompt thought on whether the simplicity of the separated branches outweighs num_or_default’s consolidation.
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
Move
opt_plusintonum_or_default's definition insql/sql_yacc.yy, so the+prefix may only precede a numeric literal:num_or_default := opt_plus NUM_literal | 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+DEFAULT. The+-with-a-number andDEFAULTcases are already covered by MDEV-38454'srpl_heartbeat_basicand earlier in this file respectively. 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.