Skip to content

MDEV-40122: +DEFAULT is not a valid value for master_heartbeat_period - #5491

Open
prathamesh04 wants to merge 1 commit into
MariaDB:12.3from
prathamesh04:MDEV-40122
Open

MDEV-40122: +DEFAULT is not a valid value for master_heartbeat_period#5491
prathamesh04 wants to merge 1 commit into
MariaDB:12.3from
prathamesh04:MDEV-40122

Conversation

@prathamesh04

Copy link
Copy Markdown

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:

  • MDEV-28302 changed the rule to MASTER_HEARTBEAT_PERIOD_SYM '=' num_or_default, adding DEFAULT support.
  • MDEV-38454 added opt_plus (to allow values like +60) on top of it, resulting in opt_plus num_or_default, which also accepts +DEFAULT.

Fix

Split the grammar rule in sql/sql_yacc.yy so opt_plus may only precede a numeric literal:

  • MASTER_HEARTBEAT_PERIOD_SYM '=' opt_plus NUM_literal (numbers, with or without +)
  • MASTER_HEARTBEAT_PERIOD_SYM '=' DEFAULT

master_heartbeat_period= +45 and = DEFAULT still work; +DEFAULT is rejected with ER_PARSE_ERROR.

Note: 11.4 and 11.8 use opt_plus NUM_literal (no DEFAULT at 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 plus positive checks for +45 and DEFAULT. Verified with:

./mariadb-test-run.pl --suite=main change_master_default ps_change_master

Both tests pass (the generated parser is rebuilt from sql_yacc.yy at build time).

Jira: https://jira.mariadb.org/browse/MDEV-40122

This contribution is licensed under the 3-clause BSD license.

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.
@CLAassistant

CLAassistant commented Aug 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@prathamesh04

Copy link
Copy Markdown
Author

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 main.change_master_default. Thanks!

@ParadoxV5
ParadoxV5 self-requested a review August 5, 2026 21:25
@ParadoxV5

ParadoxV5 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

I’m quite certain that LinuxJedi doesn’t work at MariaDB anymore.

@ParadoxV5 ParadoxV5 added External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. Replication Patches involved in replication labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. Replication Patches involved in replication

Development

Successfully merging this pull request may close these issues.

3 participants