Skip to content

feat(iceberg): log warning when available_parallelism falls back to default#2520

Open
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:fix/log-available-parallelism-fallback
Open

feat(iceberg): log warning when available_parallelism falls back to default#2520
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:fix/log-available-parallelism-fallback

Conversation

@huan233usc
Copy link
Copy Markdown

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.:

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

…efault

When `std::thread::available_parallelism()` fails, `available_parallelism()`
silently falls back to `DEFAULT_PARALLELISM` (= 1). Both call sites
(`TableScanBuilder::new`, `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.

Emit a `tracing::warn!` carrying the underlying error so the degraded state
is observable. Resolves the existing `TODO` in `util::available_parallelism`.

The `iceberg` crate gains a direct `tracing` dependency; `tracing` is
already declared at the workspace level and is the agreed logging facade
(see apache#482).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant