Skip to content

MDEV-40545 mariadb-binlog --force-read loops on truncated events - #5784

Open
GoldenEmperor1177 wants to merge 1 commit into
MariaDB:11.4from
GoldenEmperor1177:MDEV-40545
Open

GoldenEmperor1177 wants to merge 1 commit into
MariaDB:11.4from
GoldenEmperor1177:MDEV-40545

Conversation

@GoldenEmperor1177

@GoldenEmperor1177 GoldenEmperor1177 commented Sep 29, 2026 •

Copy link
Copy Markdown

MDEV-40545 mariadb-binlog --force-read loops on truncated events

What was wrong:
With --force-read, Log_event::read_log_event() returned a synthetic
"Encrypted event" (Unknown_log_event) for every read error. A
truncated event is such an error, so mariadb-binlog printed a fake
event instead of stopping, and on most truncated binlogs it then never
stopped at all.

How it is fixed:
The synthetic event is meant for encrypted events that mariadb-binlog
cannot decrypt (MDEV-11319). It is now returned only for a decryption
failure. Other read errors, like a truncated event, are reported, and
mariadb-binlog stops as it does without --force-read.

How it is tested:
main.mysqlbinlog_force_read reads two truncated binlogs from std_data,
one with a truncated event header and one with a truncated event body.
The test loops forever without the fix.

@CLAassistant

CLAassistant commented Sep 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Sep 30, 2026

@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 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.

@gkodinov gkodinov self-assigned this Sep 30, 2026
@GoldenEmperor1177
GoldenEmperor1177 force-pushed the MDEV-40545 branch 3 times, most recently from 1e9c474 to 06dd0ec Compare September 30, 2026 09:13

@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. Please stand by for the final review.

For the record: do not push out incomplete changes!!! This makes it harder for me to process these.

@gkodinov
gkodinov requested a review from bnestere September 30, 2026 09:16
@gkodinov gkodinov assigned bnestere and unassigned gkodinov Sep 30, 2026
@bnestere
bnestere requested a review from ParadoxV5 October 5, 2026 19:22

@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.

Hello, thanks for your contribution and sorry that I took long to get here.

Comment thread client/mysqlbinlog.cc Outdated
Comment thread mysql-test/main/mysqlbinlog_force_read.test Outdated
@ParadoxV5
ParadoxV5 removed the request for review from bnestere October 8, 2026 00:58
@GoldenEmperor1177

Copy link
Copy Markdown
Author

Hello, thanks for your contribution and sorry that I took long to get here.

no isssues !! i will be working on the change reqests right away ! 👊

@GoldenEmperor1177
GoldenEmperor1177 force-pushed the MDEV-40545 branch 2 times, most recently from 9d1ebf4 to fb946f0 Compare October 9, 2026 16:39
@GoldenEmperor1177
GoldenEmperor1177 changed the base branch from 10.11 to 11.4 October 9, 2026 16:39
@GoldenEmperor1177

Copy link
Copy Markdown
Author

moved this to 11.4 too, since Khaled said thats the oldest branch for fixes now. same single commit, applied cleanly, and on 11.4 the test loops without the fix and passes with it, main, binlog and binlog_encryption suites all pass.

@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.

Excellent. Some nits to pick, and we should be good to go.


--echo # The event header is truncated
--error 1
--exec $MYSQL_BINLOG --short-form --force-read $MYSQL_TEST_DIR/std_data/mdev-40545-binlog.000001 2>&1 > /dev/null

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.

/dev/null might not work on Windoze, right? (MDEV-41085)

Error message tests like this were using --result-file=path/to/throwaway_file.
Though for this case, I suggest including STDOUT in the results. too.

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.

Please give these data files descriptive names, too, such as truncated_binlog.000001

Comment thread mysql-test/std_data/mdev-40545-binlog.000002
Comment thread mysql-test/main/mysqlbinlog_force_read_truncated.test
Comment thread sql/log_event.cc
@ParadoxV5

Copy link
Copy Markdown
Contributor

moved this to 11.4 too, since Khaled said thats the oldest branch for fixes now. same single commit, applied cleanly, and on 11.4 the test loops without the fix and passes with it, main, binlog and binlog_encryption suites all pass.

Wait, what are these merge conflicts?
Did you only change the target base but forget to rebase your commit from 10.11 to 11.4?

What was wrong:
With --force-read, Log_event::read_log_event() returned a synthetic
"Encrypted event" (Unknown_log_event) for every read error. A
truncated event is such an error, so mariadb-binlog printed a fake
event instead of stopping, and on most truncated binlogs it then never
stopped at all.

How it is fixed:
The synthetic event is meant for encrypted events that mariadb-binlog
cannot decrypt (MDEV-11319). It is now returned only for a decryption
failure. Other read errors, like a truncated event or an out of memory
error, are critical: continuing after them cannot produce meaningful
output, so they are reported and mariadb-binlog stops as it does
without --force-read.

How it is tested:
main.mysqlbinlog_force_read_truncated reads two truncated binlogs from
std_data, one with a truncated event header and one with a truncated
event body. The test loops forever without the fix.
@GoldenEmperor1177

Copy link
Copy Markdown
Author

its fine 😊 i have no idea of ruby so will pass on the offer to join ruby server 😅 umm and i have re based it to 11.4 now, its now a single commit and aklso renamed the test, so i think that should rap it up ? did i miss somethin ? oh yes ! added ur point on critical faliures like out of memory to the commit message. the bin log encryption thing should pass on the rebased build now as well! it worked when i tested it ! 😊 and no, i do use bots, and ai agents time to time 😭 i just make sure that i have througly checked the code though, and make sure these are usually sub 100 lines which makes checking for both u and me easier 😭 tbh im still kinda new to how a db works inside, so the mistakes here are me learning it as i go, and when i dont get something i will just say it and ask 😊 also forgive the spellings !! i got a new keyboard, and trying to type on this is weird.. 😭

@ParadoxV5

Copy link
Copy Markdown
Contributor

Hm, strange – there weren’t any sources of merge conflicts that your rebase needed to eliminate. Could it be GitHub’s outdated cache?

Anyways, two last issues remaining: #5784 (comment), #5784 (comment).

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.

Development

Successfully merging this pull request may close these issues.

5 participants