-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix mysql binary logging 0 parameters #5007
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
Conversation
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.
Summary of Changes
Hello @zuofei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request resolves a bug in MySQL's binary logging mechanism. It ensures that when the system is configured to log zero parameters for prepared statements, the parameter count is correctly encoded and written to the binary log, preventing potential data integrity issues or misinterpretations in the log stream.
Highlights
- MySQL Binary Logging Fix: Corrected an issue in
MySQL_Event::write_query_format_1
where the zero parameter count for prepared statements was not properly encoded into the buffer before being written to the binary log. This specifically addresses cases whereeventslog_stmt_parameters=0
.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
Can one of the admins verify this patch? |
|
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.
Code Review
This pull request fixes an issue where MySQL query logging incorrectly handles zero prepared statement parameters. The change adds a call to write_encoded_length
to ensure the number of parameters is correctly written to the log. A suggestion was made to initialize buf[0]
before passing it to write_encoded_length
to avoid using an uninitialized value.
@@ -962,6 +962,7 @@ uint64_t MySQL_Event::write_query_format_1(std::fstream *f) { | |||
// Deterministic binary logging: always report 0 parameters. | |||
uint16_t num_params = 0; | |||
uint8_t paramCountLen = mysql_encode_length(num_params, buf); | |||
write_encoded_length(buf, num_params, paramCountLen, buf[0]); |
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.
The prefix
argument in write_encoded_length
is derived from buf[0]
, but buf[0]
is not initialized in this branch. Although the code works correctly because len
is 1, and prefix
is unused when len==1
, it's better to explicitly set buf[0]
to num_params
for clarity and to avoid potential issues if the function's logic changes in the future.
write_encoded_length(buf, num_params, paramCountLen, buf[0]); | |
buf[0] = (unsigned char)num_params; | |
write_encoded_length(buf, num_params, paramCountLen, buf[0]); |
add to whitelist |
Fix MySQL query logging zero prepared statement parameters when
eventslog_stmt_parameters=0