Skip to content

MDEV-38454 CHANGE MASTER TO master_heartbeat_period does not accept numbers with + sign - #4617

Merged
gkodinov merged 1 commit into
MariaDB:10.11from
gengtianuiowa:mdev-34646
Mar 14, 2026
Merged

MDEV-38454 CHANGE MASTER TO master_heartbeat_period does not accept numbers with + sign#4617
gkodinov merged 1 commit into
MariaDB:10.11from
gengtianuiowa:mdev-34646

Conversation

@gengtianuiowa

Copy link
Copy Markdown
Contributor

Description

Fixed parser inconsistency where CHANGE MASTER TO master_heartbeat_period rejected numeric values with an explicit '+' sign, while other parameters like master_connect_retry accepted them.

The issue was in sql/sql_yacc.yy where master_heartbeat_period used NUM_literal (which doesn't accept '+'), while other parameters used ulong_num (which includes opt_plus).

Solution: Added opt_plus before NUM_literal in the master_heartbeat_period grammar rule, making it consistent with other numeric parameters.

How can this PR be tested?

Execute the mdev_38454.test in rpl test suite in mysql-test-run.

Basing the PR against the correct MariaDB version

  • This is a bug fix and the PR is based against the latest MariaDB development branch

Backward compatibility

This is a bug fix which allows "+" sign for "master_heartbeat_period". It is compatible with previous versions.

Copyright

All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.

@bnestere
bnestere requested a review from ParadoxV5 February 4, 2026 22:18
@bnestere bnestere added External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. Replication Patches involved in replication labels Feb 4, 2026

@ParadoxV5 ParadoxV5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m back from Weekend Wednesday!

Thanks for including a test as well!
Although I don’t like how the older tests are named mdev_ABCD – very undescriptive.

Though for this topic, I suggest including the master_heartbeat_period=+60 test under the existing CHANGE MASTER test, which would be mysql-test/suite/rpl/t/rpl_heartbeat_basic.test by convention (if not rpl.rpl_heartbeat and it seems to have have their purposes mixed together).

master_connect_retry=+60 would belong to the corresponding CHANGE MASTER test… if there is one.
It and other fields are not the focus, anyhow.
(This is the status quo… I’d actually prefer gathering ALL format tests together in one script.)

As for the slave_net_timeout warning on amd64-debian-12-debug-embedded – It might be because the test needs --source include/not_embedded.inc, which in the rpl suite is normally practically covered by rpl_init.inc and co..
(We still can’t just get rid of Embedded builds… oh well.)

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

This is a preliminary review. Since this is a bug and (IMHO) is a relatively safe to fix, I'd use 10.6 to base my fix on.

Comment thread sql/sql_yacc.yy
@gengtianuiowa

Copy link
Copy Markdown
Contributor Author

I’m back from Weekend Wednesday!

Thanks for including a test as well! Although I don’t like how the older tests are named mdev_ABCD – very undescriptive.

Though for this topic, I suggest including the master_heartbeat_period=+60 test under the existing CHANGE MASTER test, which would be mysql-test/suite/rpl/t/rpl_heartbeat_basic.test by convention (if not rpl.rpl_heartbeat and it seems to have have their purposes mixed together).

master_connect_retry=+60 would belong to the corresponding CHANGE MASTER test… if there is one. It and other fields are not the focus, anyhow. (This is the status quo… I’d actually prefer gathering ALL format tests together in one script.)

As for the slave_net_timeout warning on amd64-debian-12-debug-embedded – It might be because the test needs --source include/not_embedded.inc, which in the rpl suite is normally practically covered by rpl_init.inc and co.. (We still can’t just get rid of Embedded builds… oh well.)

Moved the test to mysql-test/suite/rpl/t/rpl_heartbeat_basic.test file. Please review again

@gengtianuiowa
gengtianuiowa changed the base branch from 10.6 to 10.11 February 26, 2026 23:19
@ParadoxV5

Copy link
Copy Markdown
Contributor

Moved the test to mysql-test/suite/rpl/t/rpl_heartbeat_basic.test file. Please review again

? Is GitHub not updated, or did you accidentally rebased and pushed the pre-move (rpl.mdev_38454) version?

@gengtianuiowa

Copy link
Copy Markdown
Contributor Author

Moved the test to mysql-test/suite/rpl/t/rpl_heartbeat_basic.test file. Please review again

? Is GitHub not updated, or did you accidentally rebased and pushed the pre-move (rpl.mdev_38454) version?

Ah that was a mistake... I just tried to change the merge target and tweaked my local repo and it accidentally reverted to the previous version....

Will change it back shortly.

@gengtianuiowa
gengtianuiowa force-pushed the mdev-34646 branch 2 times, most recently from 3cd5fb6 to d560284 Compare February 27, 2026 00:04
@gengtianuiowa

Copy link
Copy Markdown
Contributor Author

Moved the test to mysql-test/suite/rpl/t/rpl_heartbeat_basic.test file. Please review again

? Is GitHub not updated, or did you accidentally rebased and pushed the pre-move (rpl.mdev_38454) version?

Ah that was a mistake... I just tried to change the merge target and tweaked my local repo and it accidentally reverted to the previous version....

Will change it back shortly.

Should be good now. Please check again

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the rest of it is good. Please just use ulong_num. And add tests about it: e.g. with a hex num, with a float etc.

Comment thread sql/sql_yacc.yy

@ParadoxV5 ParadoxV5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Anything more to add, Georgi-san?

eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=+60;
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
RESET SLAVE;
# Test without + sign (should still work)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to say,

  • Please use line breaks to keep lines within 80-character wide.
    • Alternatively, use the style --eval without ;.
      No line breaks in this comment-like style, however.
  • These RESETs could be omitted by testing with different values each time.

But then, I noticed that these are existing styles in the surrounding code.
So nevermind about them for now.

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gkodinov
gkodinov enabled auto-merge (rebase) March 13, 2026 13:23
…umbers with `+` sign

Fixed parser inconsistency where CHANGE MASTER TO master_heartbeat_period
rejected numeric values with an explicit '+' sign, while other parameters
like master_connect_retry accepted them.

The issue was in sql/sql_yacc.yy where master_heartbeat_period used
NUM_literal (which doesn't accept '+'), while other parameters used
ulong_num (which includes opt_plus).

Solution: Added opt_plus before NUM_literal in the master_heartbeat_period
grammar rule, making it consistent with other numeric parameters.

Added test case to verify:
- master_heartbeat_period=+60 now works (was broken)
- master_heartbeat_period=60 still works (backward compatible)

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
@gkodinov
gkodinov merged commit c45a0d8 into MariaDB:10.11 Mar 14, 2026
15 of 17 checks passed
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.

4 participants