Skip to content
/ server Public

MDEV-29252: Avoid masking specific IO thread errors with generic relay log write failure#4676

Open
abhishek593 wants to merge 1 commit intoMariaDB:10.11from
abhishek593:MDEV-29252
Open

MDEV-29252: Avoid masking specific IO thread errors with generic relay log write failure#4676
abhishek593 wants to merge 1 commit intoMariaDB:10.11from
abhishek593:MDEV-29252

Conversation

@abhishek593
Copy link

This PR ensures that the slave IO thread reports specific error codes instead of masking them with the generic ER_SLAVE_RELAY_LOG_WRITE_FAILURE.

Changes:

  • Updated logic in sql/slave.cc to preserve specific error codes from queue_event.
  • Updated existing tests.

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Feb 23, 2026
Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash all of your commits into a single one.
Please also target 10.11: this is a bug fix and it needs to be in all affected versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest not to send anything here and fix queue_event to send it in all cases.
Note that this also requires checking all the error paths in queue_event() and making sure no tricks are played to work around the below check.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the implementation. I found only 1 instance where we could return without going through err: label in queue_event(), which is queue_old_event(). There, previously, it just sent error 1, instead of standard error codes, and in handle_slave_io(), it printed errors for ER_SLAVE_RELAY_LOG_WRITE_FAILURE.

Now, I change this return error 1 in queue_old_event() directly to ER_SLAVE_RELAY_LOG_WRITE_FAILURE, which goes through the err: label in queue_event(), and all error reporting happens there.

@@ -6752,7 +6919,7 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len)
handle_slave_io() prints it on return.
*/
if (unlikely(error) && error != ER_SLAVE_RELAY_LOG_WRITE_FAILURE)
mi->report(ERROR_LEVEL, error, NULL, ER_DEFAULT(error),
mi->report(ERROR_LEVEL, error, NULL, ER_THD(mi->io_thd, error),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason to do this? How is it connected to the problem?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this because previously, when ER_SLAVE_RELAY_LOG_WRITE_FAILURE was handled in handle_slave_io(), it used ER_THD, so to keep the same behaviour. With this change, all errors use ER_THD.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I hope there's always a THD when you are here. Let's have the final reviewer check on that.

@CLAassistant
Copy link

CLAassistant commented Feb 23, 2026

CLA assistant check
All committers have signed the CLA.

@abhishek593 abhishek593 changed the base branch from main to 10.11 February 23, 2026 19:15
Copy link
Member

@gkodinov gkodinov left a comment

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.

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.

4 participants