wangyong9999 opened a new issue, #287: URL: https://github.com/apache/paimon-cpp/issues/287
### Search before asking - [x] I searched in the [issues](https://github.com/apache/paimon-cpp/issues) and found nothing similar. ### Paimon-cpp version main (7351dad0) ### Minimal reproduce step 1. Build a `ScanContextBuilder` per point lookup, as serving code does, and call `Finish()`. 2. Trace thread creation, for example `strace -f -c -e trace=clone` around the lookups. Each `ScanContextBuilder` costs eight `clone` calls: `ScanContextBuilder::Impl` calls `CreateDefaultExecutor()` in its member initializer and again in `Reset()`, which `Finish()` invokes right after building the context, and every `DefaultExecutor` spawns `DEFAULT_EXECUTOR_THREAD_COUNT` (4) worker threads in its constructor and joins them on destruction. This happens even when the caller supplies its own executor through `WithExecutor()`. Measured on a point-lookup path, about nine `clone` calls per lookup, eight of them from this builder. ### What doesn't meet your expectations? Constructing or resetting a builder should not create threads. A context that is given an executor through `WithExecutor()` should create none at all, and the default executor's workers should only exist once the scan actually submits work. ### Anything else? `ReadContextBuilder` already resolves its default executor lazily in `Finish()`; `ScanContextBuilder` should behave the same. Falling back to the process-wide `GetGlobalDefaultExecutor()` is not an option: it sizes its pool by CPU count and `FileStoreScan::ReadFileEntries()` blocks in `CollectAll()` on the same pool, which can deadlock once every worker is inside a scan. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! (#282) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
