Refactor AsyncThreadCtx to use shared_ptr and state management#201
Refactor AsyncThreadCtx to use shared_ptr and state management#201fzhedu merged 23 commits intobytedance:mainfrom
Conversation
|
Fixed formatting issues reported by CI. The clang-tidy errors appear to be related to a missing compilation database in the CI environment (unable to find folly headers), which is unrelated to my changes. |
|
@Ashutosh0x Do you mind fixing the build issue on It needs to updated to use the |
|
Fixed the build issue in DirectBufferedInputTest.cpp. It was still using the raw pointer instead of passing the shared_ptr directly. Changes pushed. |
|
@fzhedu ADDRESSED ALL COMMENTS. Summary of changes:
Ready for re-review. |
There was a problem hiding this comment.
the changing in the TableScanTest.cpp should revert? https://github.com/bytedance/bolt/pull/167/changes#diff-6209d0e16d534b05b3230495e04f26d4a1a4ae2357d6cdd0ba19cf59cb0f74f1
|
@fzhedu Reverted changes to TableScanTest.cpp as requested. Also removed empty lines in Connector.h. |
@Ashutosh0x thank you for you PR and fixing some comments, would you like to continue to fix some new comments? |
|
@fzhedu Thanks for the review! I've addressed your comments:
Ready for re-review! |
|
thanks for your quick reply! |
|
@fzhedu I've applied additional fixes in the latest commit:
|
|
we should revert the commit c748524 , as it actually is the previous way where the main thread should wait all async threads. This problem is the goal to be solved by this PR, as the PR description said |
|
@fzhedu I've addressed the latest feedback:
The PR is now ready for re-review! |
fzhedu
left a comment
There was a problem hiding this comment.
LGTM, thanks for your contribution, nice work!
Co-authored-by: Zhuhe Fang <fzhedu@gmail.com>
Thank you so much |
This PR refactors AsyncThreadCtx to use std::shared_ptr for shared ownership, ensuring context survival during async tasks even if TableScan closes. It introduces State::kActive and State::kClosed to handle graceful shutdown. It updates AsyncLoadHolder and TableScan to check isClosed() and create Guard only within the async task, preventing the main thread from waiting on queued tasks. It also reverts manual in() calls in TableScan::preload and ensures AsyncThreadCtx is properly managed.