[skip-ci] Add comprehensive ProxySQL_Poll usage documentation throughout codebase#5286
[skip-ci] Add comprehensive ProxySQL_Poll usage documentation throughout codebase#5286renecannao merged 1 commit intov3.0from
Conversation
Enhance ProxySQL_Poll class documentation with detailed usage patterns: - lib/ProxySQL_Poll.cpp: Enhanced file-level documentation with architecture overview, template specialization, memory management, and event processing pipeline explanations - lib/MySQL_Thread.cpp: Added usage documentation for listener registration, removal patterns, client session setup, and main poll loop - lib/PgSQL_Thread.cpp: Added equivalent PostgreSQL usage documentation mirroring MySQL patterns with protocol-specific details - lib/mysql_data_stream.cpp: Documented cleanup, receive activity tracking, and send activity tracking patterns - lib/PgSQL_Data_Stream.cpp: Documented equivalent PostgreSQL data stream patterns for cleanup and activity tracking All documentation is placed directly where code is used, avoiding specific line numbers for better maintainability. Includes comprehensive explanations of when, why, and how ProxySQL_Poll methods are used throughout ProxySQL's event-driven architecture. [skip-ci]
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 significantly improving the documentation for the 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 adds comprehensive documentation for ProxySQL_Poll usage across the codebase. The new documentation is well-structured and provides valuable insights into the I/O multiplexing system. My review focuses on improving the accuracy and maintainability of the added comments. I've identified a few typos and suggested replacing hardcoded line number references with function names to align with the documentation approach outlined in the pull request description.
| * 2. Remove the socket using remove_index_fast() with the found index | ||
| * | ||
| * Usage pattern: | ||
| * int i = mypollolls.find_index(sock); // Find index by file descriptor |
| * or the timeout expires. | ||
| * | ||
| * Usage pattern: rc = poll(mypolls.fds, mypolls.len, ttw) | ||
| * - mypollolls.fds: Array of pollfd structures containing file descriptors and events |
| * or the timeout expires. | ||
| * | ||
| * Usage pattern: rc = poll(mypolls.fds, mypolls.len, ttw) | ||
| * - mypollolls.fds: Array of pollfd structures containing file descriptors and events |
| * @section Usage Patterns | ||
| * Called during: | ||
| * - New client connections (MySQL_Thread.cpp:4518) | ||
| * - New server connections (MySQL_Thread.cpp:3600) | ||
| * - Listener socket registration (MySQL_Thread.cpp:3015) | ||
| * - PostgreSQL session establishment (PgSQL_Session.cpp:1094) | ||
| * |
There was a problem hiding this comment.
The documentation here includes specific line numbers as references, which contradicts the PR description's goal of avoiding them for maintainability. Also, the reference to PgSQL_Session.cpp seems incorrect as the file is not part of this PR.
Consider replacing the line numbers with function names for better context and future-proofing. For example, MySQL_Thread.cpp:4518 is inside MySQL_Thread::listener_handle_new_connection.
* @section Usage Patterns
* Called during:
* - New client connections (e.g., in `MySQL_Thread::listener_handle_new_connection`)
* - New server connections (e.g., in `MySQL_Thread::worker_thread_gets_sessions_from_idle_thread`)
* - Listener socket registration (e.g., in `MySQL_Thread::poll_listener_add`)
* - PostgreSQL session establishment (e.g., in `PgSQL_Thread::listener_handle_new_connection`)| * @section Usage Patterns | ||
| * Called during: | ||
| * - Data stream destruction (MySQL_Data_Stream.cpp:337, PgSQL_Data_Stream.cpp:1114) | ||
| * - Thread cleanup operations (MySQL_Thread.cpp:3451) | ||
| * - Connection termination and cleanup |
There was a problem hiding this comment.
The documentation here includes specific line numbers as references, which contradicts the PR description's goal of avoiding them for maintainability. Some references might also be incorrect (e.g., PgSQL_Data_Stream.cpp:1114 seems to point to a non-existent line).
Consider replacing the line numbers with function names for better context and future-proofing.
* @section Usage Patterns
* Called during:
* - Data stream destruction (e.g., `MySQL_Data_Stream::~MySQL_Data_Stream`, `PgSQL_Data_Stream::~PgSQL_Data_Stream`)
* - Thread cleanup operations (e.g., `MySQL_Thread::cleanup_sessions_from_thread`)
* - Connection termination and cleanup| * @section Usage Patterns | ||
| * Called during: | ||
| * - Listener socket operations (MySQL_Thread.cpp:3019) | ||
| * - Connection management and lookup (PgSQL_Thread.cpp:2789) | ||
| * - Debugging and diagnostic operations |
There was a problem hiding this comment.
The documentation here includes specific line numbers as references, which contradicts the PR description's goal of avoiding them for maintainability.
Consider replacing the line numbers with function names for better context and future-proofing.
* @section Usage Patterns
* Called during:
* - Listener socket operations (e.g., `MySQL_Thread::poll_listener_del`)
* - Connection management and lookup (e.g., `PgSQL_Thread::poll_listener_del`)
* - Debugging and diagnostic operations


Summary
Add comprehensive ProxySQL_Poll usage documentation throughout the ProxySQL codebase to better explain how the core I/O multiplexing system is used and integrated.
What was documented
Core Class Documentation
Usage Pattern Documentation
Key Usage Patterns Covered
mypolls.add(events, fd, data_stream, timestamp)find_index()+remove_index_fast()last_recv/senttimestamp updatespoll(mypolls.fds, mypolls.len, timeout)Documentation Approach
Benefits
Test plan
This is a documentation-only change with no functional code modifications. No new tests are required, but the existing test suite should continue to pass.
[skip-ci]