-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-35879 Slave_heartbeat_period is imprecise #4441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 10.11
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ show status like 'Slave_heartbeat_period';; | |
| Variable_name Slave_heartbeat_period | ||
| Value 5.000 | ||
| connection slave; | ||
| change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.0009999; | ||
| change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.0004999; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I keep the rounding method change out of 10.11? |
||
| Warnings: | ||
| Warning 1703 The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled | ||
| show status like 'Slave_heartbeat_period';; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2267,30 +2267,37 @@ master_def: | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| | MASTER_HEARTBEAT_PERIOD_SYM '=' NUM_literal | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| Lex->mi.heartbeat_period= (float) $3->val_real(); | ||||||||||||||||||||||||||||||
| if (unlikely(Lex->mi.heartbeat_period > | ||||||||||||||||||||||||||||||
| SLAVE_MAX_HEARTBEAT_PERIOD) || | ||||||||||||||||||||||||||||||
| unlikely(Lex->mi.heartbeat_period < 0.0)) | ||||||||||||||||||||||||||||||
| my_yyabort_error((ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), | ||||||||||||||||||||||||||||||
| SLAVE_MAX_HEARTBEAT_PERIOD)); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (unlikely(Lex->mi.heartbeat_period > slave_net_timeout)) | ||||||||||||||||||||||||||||||
| static const struct Decimal_from_double: my_decimal | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| Decimal_from_double(double value): my_decimal() | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| int unexpected_error __attribute__((unused))= | ||||||||||||||||||||||||||||||
| double2my_decimal(E_DEC_ERROR, value, this); | ||||||||||||||||||||||||||||||
| DBUG_ASSERT(!unexpected_error); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } MAX_PERIOD= SLAVE_MAX_HEARTBEAT_PERIOD/1000.0, THOUSAND= 1000; | ||||||||||||||||||||||||||||||
|
Comment on lines
+2272
to
+2278
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| auto decimal_buffer= my_decimal(); | ||||||||||||||||||||||||||||||
| my_decimal *decimal= $3->val_decimal(&decimal_buffer); | ||||||||||||||||||||||||||||||
| if (!decimal || | ||||||||||||||||||||||||||||||
| decimal->sign() || decimal_cmp(&MAX_PERIOD, decimal) < 0) | ||||||||||||||||||||||||||||||
| my_yyabort_error((ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), | ||||||||||||||||||||||||||||||
| SLAVE_MAX_HEARTBEAT_PERIOD/1000)); | ||||||||||||||||||||||||||||||
| bool overprecise= decimal->frac > 3; | ||||||||||||||||||||||||||||||
| // decomposed from my_decimal2int() to reduce a bit of computations | ||||||||||||||||||||||||||||||
| auto rounded= my_decimal(); | ||||||||||||||||||||||||||||||
| int unexpected_error __attribute__((unused))= | ||||||||||||||||||||||||||||||
| decimal_round(decimal, &rounded, 3, HALF_UP) | | ||||||||||||||||||||||||||||||
| decimal_mul(&rounded, &THOUSAND, &decimal_buffer) | | ||||||||||||||||||||||||||||||
| decimal2ulonglong(&decimal_buffer, &(Lex->mi.heartbeat_period)); | ||||||||||||||||||||||||||||||
|
Comment on lines
+2290
to
+2291
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| DBUG_ASSERT(!unexpected_error); | ||||||||||||||||||||||||||||||
| if (unlikely(Lex->mi.heartbeat_period > slave_net_timeout*1000ULL)) | ||||||||||||||||||||||||||||||
| push_warning(thd, Sql_condition::WARN_LEVEL_WARN, | ||||||||||||||||||||||||||||||
| ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX, | ||||||||||||||||||||||||||||||
| ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| if (unlikely(Lex->mi.heartbeat_period < 0.001)) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| if (unlikely(Lex->mi.heartbeat_period != 0.0)) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| else if (unlikely(!Lex->mi.heartbeat_period && overprecise)) | ||||||||||||||||||||||||||||||
| push_warning(thd, Sql_condition::WARN_LEVEL_WARN, | ||||||||||||||||||||||||||||||
| ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN, | ||||||||||||||||||||||||||||||
| ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN)); | ||||||||||||||||||||||||||||||
| Lex->mi.heartbeat_period= 0.0; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| | IGNORE_SERVER_IDS_SYM '=' '(' ignore_server_id_list ')' | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Range testing of
master_heartbeat_periodis duplicated betweenrpl_heartbeat_basic(runs withmixonly) andrpl_heartbeat(tests all three binlog formats).