-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[MDEV-34614] mysqlbinlog warn on EOF before GTID in --stop-position #3600
base: 10.11
Are you sure you want to change the base?
Conversation
…e stop-condition * `binlog_mysqlbinlog_warn_stop_position`: Name the temporary output redirect as ignored to match `binlog_mysqlbinlog_warn_stop_datetime` * #3400 (comment) * `binlog_mysqlbinlog_warn_stop_datetime`: Remove duplicate case
Previously, if `--gtid-strict-mode` are `-vvv` are not active, it’s recycled upon entering the first `--start-position` GTID range. However, a latter code queries its states again (if it’s not deleted), specifically to confirm the expectation of reaching (start) GTID states. This commit (temporarily?) removes this *optimization* so that this validator and its latest states are consistently accessible at the end. It also adds an optional parameter to preserve the current (non-)behavior of out-of-order (non-)reporting.
This commit adds warnings for `--stop-position` GTIDs that were not reached at EOF, mainly as a follow-up to MDEV-27037 Mysqlbinlog should output a warning if EOF is found before its stop condition (#3400). `--stop-position` warnings inform possible mistakes in the input, especially for progress reporting of scripts/wrappers. MDEV-34614 enhances MDEV-27037 with individualized GTID validation, for GTID range selection weren’t in all versions that MDEV-27037 targeted. Unlike #3400, `Binlog_gtid_state_validator` provides the code behind this feature rather than `mysqlbinlog` itself. Motivations behind this decision are: * For a patch that’ll apply on older versions, this choice yields a smaller change footprint. * `Binlog_gtid_state_validator` is already prompting unreached *`--start-position`s* for `--gtid-strict-mode`/`-vvv`.
PR # 60² |
--echo # MDEV-34614 mysqlbinlog warn on EOF before GTID in --stop-position | ||
--echo | ||
|
||
--source include/have_binlog_format_row_or_statement.inc |
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.
I originally had
--source include/have_binlog_format_row_or_statement.inc | |
--source include/have_log_bin.inc |
But (at least for me,) the Mixed format would rotate 0-1-2
and latter to master-bin.000002
.
mariadb-binlog path/to/master-bin.000002
somehow even alerted
ERROR: Found out of order GTID. Got 0-1-1 after 0-1-3
@@ -3343,6 +3344,7 @@ static my_bool report_audit_findings(void *entry, void *report_ctx_arg) | |||
} | |||
|
|||
/* Report any out of order GTIDs */ | |||
if (report_ctx->report_out_of_order) |
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.
Instead of stashing late_gtids
until the end, Binlog_gtid_state_validator::record
could instead warn/error out-of-order GTIDs itself live.
Description
This PR adds
mariadb-binlog
warnings for--stop-position
GTIDs that were not reached at EOF, mainly as a follow-up to MDEV-27037 which added warnings for unreached--stop-position
file indices and--stop-datetime
s.What problem is the patch trying to solve?
--stop-position
warnings inform possible mistakes in the input; they’re helpful for both DBAs on CLI and scripts/wrappers that check/log the output status.MDEV-34614 enchances MDEV-27037 with per-domain GTID validation.
MDEV-27037 was considered a bug fix and so built upon the oldest supported branch (at the time) for forwardporting, but GTID range selection wasn’t a feature of its ancient base version.
Unlike #3400, the code behind this feature is in the
rpl_gtid.cc
classBinlog_gtid_state_validator
rather than directly in themysqlbinlog.cc
program itself via its filter inputs.There are two
limitationscurrent situations that lead to this decision:Binlog_gtid_state_validator
is already prompting unreached--start-position
s in--gtid-strict-mode
(errors) or-vvv
mode (warnings).This may rather be a side effect. (not certain; I’m new 👶)
The GITD range filter doesn’t have an API for enumerating statuses of individual
--stop-position
GTIDs, whereas modifyingBinlog_gtid_state_validator
only requires one function to gain some optional parameters.A “new feature” PR with unrestrained rewrites would have a more ideal Separation of Concerns, such as:
--start-position
/datetime
s regardless of--gtid-strict-mode
/-vvv
, not just--stop-position
/datetime
s.Do you think this patch might introduce side-effects in other parts of the server?
To enable the
Binlog_gtid_state_validator
-based design, I had to (temporarily?) remove the optimization that recycles the validator object at the first (encounter order)--start-position
GTID outside of--gtid-strict-mode
/-vvv
.server/client/mysqlbinlog.cc
Lines 1130 to 1151 in 0e8fb97
Note that despite this, this latter (runtime order) code queries its states again (if it’s not deleted), specifically to confirm the expectation of reaching (start) GTID states.
server/client/mysqlbinlog.cc
Lines 3732 to 3741 in 0e8fb97
Consequently, outside of
--gtid-strict-mode
and-vvv
, the only case that enters this line is when EOF is found before every--start-position
GTID (rather than any).(Recall that sequences of each domain have individual
--start-position
s, just that file logs are concurrent.)One of these two designs has to be erroneous.
Optional parameters preserve the current (non-)behaviors of (non-)reporting.
Early exits from
--gtid-strict-mode
exceptions also do (should?) not prompt unreached--start-position
s since these states may be natural for those. (We’re logging unreachability, not reachability.)Release Notes
What does #3400 say for its Release Notes?… Nothing? 🤷
Here’s a summary that covers both this and the previous PR:
How can this PR be tested?
The new test
binlog_mysqlbinlog_warn_stop_gtid
covers positive expectations (but not negative testing yet), though QA should run the entirebinlog
suite to also confirm no regressions.PR quality check
main
branch.