huan233usc opened a new pull request, #2520:
URL: https://github.com/apache/iceberg-rust/pull/2520

   ## Which issue does this PR close?
   
   Resolves the in-code `TODO` at `crates/iceberg/src/util/mod.rs:40` (no 
tracking issue).
   
   ## What changes are included in this PR?
   
   When `std::thread::available_parallelism()` fails, `available_parallelism()` 
falls back to `DEFAULT_PARALLELISM` (= 1). Both call sites — 
`TableScanBuilder::new` and `ArrowReaderBuilder::new` — use this value to size 
their internal concurrency, so a silent fallback turns parallel execution into 
serial with no signal to the operator.
   
   This PR emits a `tracing::warn!` carrying the underlying error so the 
degraded state is observable, e.g.:
   
   ```text
   WARN error=...: Failed to determine available parallelism; falling back to 1
   ```
   
   The `iceberg` crate gains a direct `tracing` dependency. `tracing` is 
already declared at the workspace level and is the agreed logging facade (per 
the conclusion of #482).
   
   ## Are these changes tested?
   
   No new unit test. `std::thread::available_parallelism()` succeeds on every 
standard CI environment and cannot be forced to fail without mocking the 
standard library, so a fallback-path test would require either:
   
   - a `cfg(test)` indirection layer to inject a mock 
`available_parallelism()`, or
   - a custom runner inside a cgroup that artificially constrains parallelism.
   
   Both seemed disproportionate for a one-line observability change. Existing 
callers (`TableScanBuilder`, `ArrowReaderBuilder`) continue to receive a valid 
`NonZeroUsize` on success, exercised by the existing test suite. Happy to add 
either approach if reviewers prefer.
   
   Verified locally:
   
   - `cargo check -p iceberg`
   - `cargo test -p iceberg --lib util::`
   - `cargo clippy -p iceberg --all-targets -- -D warnings`
   - `cargo fmt -p iceberg --check`


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to