Skip to content

Core: Improve code robustness across core modules#15893

Open
fightBoxing wants to merge 4 commits intoapache:mainfrom
fightBoxing:fix/improve-code-robustness
Open

Core: Improve code robustness across core modules#15893
fightBoxing wants to merge 4 commits intoapache:mainfrom
fightBoxing:fix/improve-code-robustness

Conversation

@fightBoxing
Copy link
Copy Markdown

Summary

This PR improves code robustness across 7 core files, addressing 12 issues identified through static analysis.

Changes

HTTPClient

  • Fix inconsistent config reading in configureConnectionManager() — Changed Integer.getInteger() to PropertyUtil.propertyAsInt() for REST_MAX_CONNECTIONS, ensuring user-configured rest.client.max-connections takes effect.
  • Preserve original exception in buildUri() — Pass URISyntaxException to RESTException constructor for better debugging.

BaseCommitService

  • Fix race condition on succeededCommits — Changed from plain int to AtomicInteger for thread-safe increment.

SnapshotProducer

  • Add logging for swallowed NumberFormatException in updateTotal() — Previously silently ignored corrupted snapshot summary values.
  • Re-throw Error in catch(Throwable) blocks — Prevents masking OOM/StackOverflow errors during cleanup and notification.
  • Add default branch to switch(entry.status()) — Throws IllegalStateException for unexpected ManifestEntry.Status values.

BaseTaskWriter

  • Change abort() cleanup strategy — Use suppressFailureWhenFinished() instead of throwFailureWhenFinished() to ensure all files are attempted for deletion during abort.

ErrorHandlers

  • Handle HTTP 405/406 status codes — Previously silently ignored.
  • Include HTTP status code in RESTException messages for better diagnostics.

BaseTransaction

  • Add default branch to switch(type) for unknown TransactionType.

Exceptions

  • Add debug logging for suppressed close exceptions.

Verification

  • compileJava — BUILD SUCCESSFUL
  • spotlessCheck — BUILD SUCCESSFUL

raunaqmorarka and others added 4 commits July 26, 2024 18:20
…(backport apache#10691) (apache#10787)

ParallelIterable schedules 2 * WORKER_THREAD_POOL_SIZE tasks for
processing input iterables. This defaults to 2 * # CPU cores.  When one
or some of the input iterables are considerable in size and the
ParallelIterable consumer is not quick enough, this could result in
unbounded allocation inside `ParallelIterator.queue`. This commit bounds
the queue. When queue is full, the tasks yield and get removed from the
executor. They are resumed when consumer catches up.

(cherry picked from commit 7831a8d)

Co-authored-by: Piotr Findeisen <piotr.findeisen@gmail.com>
As part of the change in commit
7831a8d, queue low water mark was
introduced. However, it resulted in increased number of manifests being
read when planning LIMIT queries in Trino Iceberg connector. To avoid
increased I/O, back out the change for now.
Bumps `orc` from 1.9.3 to 1.9.4.

Updates `org.apache.orc:orc-core` from 1.9.3 to 1.9.4

Updates `org.apache.orc:orc-tools` from 1.9.3 to 1.9.4

---
updated-dependencies:
- dependency-name: org.apache.orc:orc-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.apache.orc:orc-tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
SubAgent analysis identified and fixed 12 issues across 7 files:

[HTTPClient] Fix inconsistent config reading in configureConnectionManager()
  - Changed Integer.getInteger() to PropertyUtil.propertyAsInt() for REST_MAX_CONNECTIONS

[HTTPClient] Preserve original exception in buildUri()
  - Pass URISyntaxException to RESTException constructor for better debugging

[BaseCommitService] Fix race condition on succeededCommits
  - Changed from plain int to AtomicInteger for thread-safe increment

[SnapshotProducer] Add logging for swallowed NumberFormatException in updateTotal()
[SnapshotProducer] Re-throw Error in catch(Throwable) blocks
[SnapshotProducer] Add default branch to switch(entry.status())

[BaseTaskWriter] Change abort() cleanup strategy
  - Use suppressFailureWhenFinished() instead of throwFailureWhenFinished()

[ErrorHandlers] Handle HTTP 405/406 status codes
[ErrorHandlers] Include HTTP status code in RESTException messages

[BaseTransaction] Add default branch to switch(type)

[Exceptions] Add debug logging for suppressed close exceptions
@github-actions github-actions Bot added the core label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants