[skip-ci] Remove deprecated read_only_action implementations from MySQL and PgSQL HostGroups managers#5291
Conversation
…QL and PgSQL HostGroups managers The old read_only_action() implementations were marked for deletion after 2025-07-14. These were replaced with new implementation that doesn't depend on the admin table. This change removes the deprecated code paths to clean up the codebase.
Summary of ChangesHello @renecannao, 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 focuses on improving code hygiene and robustness by removing deprecated Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
|
There was a problem hiding this comment.
Code Review
This pull request is a good cleanup, removing deprecated read_only_action implementations from both MySQL and PgSQL host group managers. The removal of this dead code improves maintainability. The addition of the new regression test for issue #5233 is also valuable for ensuring the stability of multi-statement command parsing. The test is well-structured and effectively demonstrates the bug. I've provided a few suggestions for the new test file to enhance resource management and code readability.
| // Enable multi-statements | ||
| if (!mysql_real_connect(proxy, cl.host, cl.username, cl.password, "test", cl.port, NULL, CLIENT_MULTI_STATEMENTS)) { | ||
| diag("Failed to connect to ProxySQL proxy: %s", mysql_error(proxy)); | ||
| mysql_close(admin); |
There was a problem hiding this comment.
There is a resource leak in this error handling path. If mysql_real_connect for the proxy connection fails, the proxy handle is not closed before exiting. This can lead to resource leaks, which might affect the stability of the CI environment. The proxy handle should be closed here.
| mysql_close(admin); | |
| mysql_close(proxy); | |
| mysql_close(admin); |
| diag("Using log file: %s", log_path.c_str()); | ||
|
|
||
| // Create test database and table | ||
| MYSQL_QUERY(admin, "CREATE DATABASE IF NOT EXISTS test"); |
There was a problem hiding this comment.
The MYSQL_QUERY macro, as defined in utils.h, uses return EXIT_FAILURE; on error. This causes the function to exit immediately, bypassing the cleanup code at the end of main where mysql_close is called for the admin and proxy connections. This will lead to resource leaks if any of the MYSQL_QUERY calls fail. To make the test more robust and prevent leaks, consider refactoring to use a goto cleanup pattern for error handling, or use RAII wrappers (like std::unique_ptr with a custom deleter) for the MYSQL* resources to ensure they are always closed.
| bool starts_with_set = (digest_text.size() >= 4 && | ||
| (digest_text[0] == 'S' || digest_text[0] == 's') && | ||
| (digest_text[1] == 'E' || digest_text[1] == 'e') && | ||
| (digest_text[2] == 'T' || digest_text[2] == 't') && | ||
| digest_text[3] == ' '); |
There was a problem hiding this comment.



Summary
read_only_action()implementations that were marked for deletion after 2025-07-14Test plan