You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Phixsura (via GitHub)" <gi...@apache.org> on 2026/05/19 19:11:46 UTC
[PR] KAFKA-14490: Throw UncheckedIOException from LazyIndex [kafka]
Phixsura opened a new pull request, #22330:
URL: https://github.com/apache/kafka/pull/22330
## Background
[KAFKA-14490](https://issues.apache.org/jira/browse/KAFKA-14490) proposes replacing checked `IOException` with `UncheckedIOException` in the log layer, following the pattern already adopted by the raft module. The ticket description specifically calls out `LazyIndex`'s private constructor as a candidate for simplification once `IOException` is unchecked.
This is the first PR in the KAFKA-14490 series. Plan posted on the ticket walks through the remaining 17 files in dependency order.
## Changes
- `LazyIndex.get` / `renameTo` / `deleteIfExists` / `close` no longer declare `throws IOException`. `IOException` is caught at the file-IO boundary inside `IndexFile`, `IndexValue` and the loader, and re-thrown as `UncheckedIOException`. This mirrors `FileRawSnapshotReader` / `FileRawSnapshotWriter` / `Snapshots` / `FileQuorumStateStore` / `KafkaRaftLog` in the raft module.
- The private constructor changes from `(IndexWrapper, long, int, IndexType)` to `(IndexWrapper, IndexLoader<T>)`. The new `IndexLoader<T>` is a small `@FunctionalInterface` that allows the lambda to declare `throws IOException`. `forOffset` and `forTime` now pass a lambda that captures `baseOffset` and `maxIndexSize` directly.
- The previous `loadIndex` private method and its `@SuppressWarnings("unchecked")` switch on `IndexType` are removed. The remaining `@SuppressWarnings("unchecked")` on `get` is for the `(IndexValue<T>) wrapper` cast, which is structurally required by the `<?>` wildcard on `instanceof IndexValue<?>` and cannot be eliminated without a larger refactor.
## Scope kept minimal
External callers' method signatures (e.g. `LogSegment.offsetIndex() throws IOException`) are left untouched. Their `throws IOException` clauses become redundant since `LazyIndex.get` no longer throws checked, but Java permits over-declared `throws` and pruning them belongs in the follow-up PRs that convert the surrounding files. This keeps the blast radius of the first PR limited to `LazyIndex.java`.
## Verification
- `:storage:compileJava` clean.
- `:storage:test --tests "*LogSegment*" --tests "*Index*"` all green.
- `:core:test --tests "*LogSegment*" --tests "*UnifiedLog*" --tests "*LazyIndex*"` all green (covers the Scala `LogTestUtils` and `RemoteLogManagerTest` callers).
- `:storage:spotlessCheck`, `:storage:checkstyleMain`, `:storage:checkstyleTest`, `:storage:spotbugsMain --rerun-tasks` all clean.
## Committer review notes
Happy to split out the constructor cleanup into its own PR if reviewers prefer the IOException conversion be reviewed in isolation first.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-14490: Throw UncheckedIOException from LazyIndex [kafka]
Posted by "Phixsura (via GitHub)" <gi...@apache.org>.
Phixsura commented on PR #22330:
URL: https://github.com/apache/kafka/pull/22330#issuecomment-4491355076
@ijuma First PR in the KAFKA-14490 series is up. This batch covers `LazyIndex`: the IOException-to-UncheckedIOException conversion plus the private-constructor cleanup you called out in the description (removes the `loadIndex` switch on `IndexType` and its `@SuppressWarnings("unchecked")`). Added `LazyIndexTest` with 11 unit tests covering both the happy path and the wrap-on-IOException paths. Happy to tune the pattern before the larger files (`AbstractIndex` / `OffsetIndex` / `TimeIndex` / `TransactionIndex`) land in subsequent PRs.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-14490: Throw UncheckedIOException from LazyIndex [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22330:
URL: https://github.com/apache/kafka/pull/22330#issuecomment-4551334199
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the `triage` label
should be removed to prevent this automation from happening again.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-14490: Throw UncheckedIOException from LazyIndex [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22330:
URL: https://github.com/apache/kafka/pull/22330#issuecomment-6307506019
This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.
<p>
If you are having difficulty finding a reviewer, please reach out on the
[mailing list](https://kafka.apache.org/contact).
<p>
If this PR is no longer valid or desired, please feel free to close it. If no activity
occurs in the next 30 days, it will be automatically closed.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-14490: Throw UncheckedIOException from LazyIndex [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22330:
URL: https://github.com/apache/kafka/pull/22330#issuecomment-6514082641
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the `triage` label
should be removed to prevent this automation from happening again.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org