MDEV-40545 mariadb-binlog --force-read loops on truncated events - #5784
Open
GoldenEmperor1177 wants to merge 1 commit into
Open
GoldenEmperor1177 wants to merge 1 commit into
GoldenEmperor1177 wants to merge 1 commit into
Conversation
gkodinov
requested changes
Sep 30, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
Please squash your two commits into one. And add a commit message that's compliant to the coding standards, in essence:
MDEV reference
- what was wrong
- how was it fixed
- how is the fix tested.
GoldenEmperor1177
force-pushed
the
MDEV-40545
branch
2 times, most recently
from
September 30, 2026 09:08
e5b16d8 to
1e9c474
Compare
With --force-read, a truncated event header could return a synthetic Unknown_log_event without advancing the input position. The local binlog dump loop treated the non-NULL event as successful and repeatedly read the same offset. Detect a successful-looking read that leaves the file position unchanged, delete the synthetic event, and route it through the existing read-error path. Add an MTR regression test using a 17-byte binlog whose event header is truncated. The test verifies that mariadb-binlog reports the read error and exits instead of looping.
GoldenEmperor1177
force-pushed
the
MDEV-40545
branch
from
September 30, 2026 09:13
1e9c474 to
06dd0ec
Compare
gkodinov
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mariadb-binlog --force-read can return a synthetic Unknown_log_event after a truncated event-header read without advancing the input position. dump_local_log_entries() then processes the synthetic event and repeatedly reads the same offset, causing an infinite loop.
This patch detects a non-null event returned without forward progress, deletes it, and routes execution through the existing read-error path. The command now terminates with:
ERROR: Could not read entry at offset 4: Error in log format or read error.
An MTR regression test recreates the malformed loop.001 input and verifies that mariadb-binlog --force-read exits instead of looping.
Tests on the 10.11 branch:
Thanks to Raja Sai Pranav for identifying the non-advancing --force-read path and suggesting the forward-progress guard implemented here.
Jira: https://jira.mariadb.org/browse/MDEV-40545