Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '''' at line 1
RESET SLAVE;

*** MDEV-38454: MASTER_HEARTBEAT_PERIOD should accept + sign ***
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=+60;
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
Variable_name Value
Slave_heartbeat_period 60.000
RESET SLAVE;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=60;
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
Variable_name Value
Slave_heartbeat_period 60.000
RESET SLAVE;

*** Running slave ***
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
include/start_slave.inc
Expand Down
16 changes: 16 additions & 0 deletions mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,22 @@ eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTE
RESET SLAVE;
--echo

#
# MDEV-38454: MASTER_HEARTBEAT_PERIOD should accept values with + sign
#
--echo *** MDEV-38454: MASTER_HEARTBEAT_PERIOD should accept + sign ***
# Test with + sign (was broken before fix)
--replace_result $MASTER_MYPORT MASTER_PORT
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.

--replace_result $MASTER_MYPORT MASTER_PORT
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;
--echo

#
# Testing heartbeat
#
Expand Down
4 changes: 2 additions & 2 deletions sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -2265,9 +2265,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))
Expand Down