-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Chore](exchange) reduce create wait_channel_timer #57683
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
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
PR approved by anyone and no changes requested. |
|
PR approved by at least one committer and no changes requested. |
Currently, the number of our wait_channel_timers corresponds to the number of `channels`. After the modifications in this PR, the number of wait_channel_timers will align with the number of `local channels`, thereby reducing unnecessary timer generation. This pull request refactors and improves code readability and safety in the `exchange_sink_operator.cpp` file by modernizing loop constructs, improving memory management, and enhancing error handling. The changes mainly focus on using range-based loops, smart pointers, and clearer logic for managing channel dependencies and timers. **Code modernization and safety improvements:** * Replaced traditional for-loops with range-based for-loops for iterating over `channels`, improving readability and reducing indexing errors in multiple methods (`init`, `open`). [[1]](diffhunk://#diff-70038347289359e40966cf399f9a4165f6423f3634ceb13d496da4d4627ce073L85-R86) [[2]](diffhunk://#diff-70038347289359e40966cf399f9a4165f6423f3634ceb13d496da4d4627ce073L217-R217) * Updated memory management for `_writer` by switching from manual `reset` with `new` to `std::make_unique`, ensuring exception safety and clarity. * Used `contains` method instead of `find` for map lookups in `_create_channels`, making the code more concise and modern. * Changed range-based loop in the constructor to use `const auto&` for safety and clarity. **Dependency and error handling improvements:** * Added a null pointer check for local channel dependencies and improved timer management, ensuring that dependencies are valid and timers are only added for non-null dependencies.
What problem does this PR solve?
Currently, the number of our wait_channel_timers corresponds to the number of
channels. After the modifications in this PR, the number of wait_channel_timers will align with the number oflocal channels, thereby reducing unnecessary timer generation.This pull request refactors and improves code readability and safety in the
exchange_sink_operator.cppfile by modernizing loop constructs, improving memory management, and enhancing error handling. The changes mainly focus on using range-based loops, smart pointers, and clearer logic for managing channel dependencies and timers.Code modernization and safety improvements:
channels, improving readability and reducing indexing errors in multiple methods (init,open). [1] [2]_writerby switching from manualresetwithnewtostd::make_unique, ensuring exception safety and clarity.containsmethod instead offindfor map lookups in_create_channels, making the code more concise and modern.const auto&for safety and clarity.Dependency and error handling improvements:
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)