Skip to content

Fix operator typo in || chain#5118

Open
ParadoxV5 wants to merge 1 commit into
10.6from
px5.comma_operator
Open

Fix operator typo in || chain#5118
ParadoxV5 wants to merge 1 commit into
10.6from
px5.comma_operator

Conversation

@ParadoxV5
Copy link
Copy Markdown
Contributor

@ParadoxV5 ParadoxV5 commented May 24, 2026

There is a , breaking Table_map_log_event::write_data_body()’s || chain.
This “comma operator” still connects the expressions, but if a step in the first sub-chain fails, the code will disregard the failure and continue with the second half-chain.

This change was originally unsolicitedly suggested by our new spambot in mariadb-corporation/MariaDBEnterprise#265; that is, I did not activate a bot nor provide any prompt, but rather the CI-triggered spambot comment came to me like junk mail.
By verifying the bot output and creating this patch independently without AI assistance, I confirm I understand the change and can claim its authorship and responsibility, and I remain have never provided AI-generated code.


This PR targets 10.6 in the name of stability improvement; I’m happy to retarget 10.11.
(Help me answer the very same spambot: Do I need to engineer a fault-injection test for this triviality as well?)

There is a `,` breaking `Table_map_log_event::write_data_body()`’s
`||` chain.
This “comma operator” still connects the expressions,
but if a step in the first sub-chain fails,
the code will disregard the failure and continue with the second half-chain.

This change was originally **unsolicitedly** suggested by Gemini;
that is, I did not activate Gemini nor provide any prompt,
but rather the CI-triggered Gemini comment came to me like junk mail.
By verifying the bot output and creating this patch independently
*without AI assistance*, I confirm I understand the change and
can claim its authorship and responsibility,
and *I remain have never provided AI-generated code*.

Co-authored-by: gemini-code-assist <200291788+gemini-code-assist@users.noreply.github.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request corrects an error propagation issue in Table_map_log_event::write_data_body by replacing a comma operator with a logical OR operator, ensuring that failures in writing field metadata are correctly handled. The reviewer recommends adding a regression test to verify this error propagation logic and prevent potential binary log corruption.

Comment thread sql/log_event_server.cc
write_data(m_coltype, m_colcnt) ||
write_data(mbuf, (size_t) (mbuf_end - mbuf)) ||
write_data(m_field_metadata, m_field_metadata_size),
write_data(m_field_metadata, m_field_metadata_size) ||
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

A regression test should be added to cover the error propagation logic in this function. This is particularly important for binary log events to prevent partial write failures from leading to log corruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant