[Kernel] Handle KernelEngineException when reading the _last_checkpoint file#3086
Merged
vkorukanti merged 5 commits intodelta-io:masterfrom May 16, 2024
Merged
[Kernel] Handle KernelEngineException when reading the _last_checkpoint file#3086vkorukanti merged 5 commits intodelta-io:masterfrom
KernelEngineException when reading the _last_checkpoint file#3086vkorukanti merged 5 commits intodelta-io:masterfrom
Conversation
UncheckedIOException when reading the _last_checkpoint fileKernelEngineException when reading the _last_checkpoint file
scottsand-db
approved these changes
May 16, 2024
Collaborator
scottsand-db
left a comment
There was a problem hiding this comment.
LGTM with minor comments
| * Throws when the {@link Engine} encountered an error while executing an operation. | ||
| */ | ||
| public class KernelEngineException extends RuntimeException { | ||
| private static final String msgT = "Encountered an error from the underlying engine " + |
Collaborator
There was a problem hiding this comment.
what does the capital T mean in msgT?
Collaborator
Author
There was a problem hiding this comment.
It was a shortened messageTemplate. Renaming it to msgTemplate
kernel/kernel-api/src/main/java/io/delta/kernel/internal/checkpoints/Checkpointer.java
Outdated
Show resolved
Hide resolved
kernel/kernel-api/src/main/java/io/delta/kernel/internal/checkpoints/Checkpointer.java
Outdated
Show resolved
Hide resolved
| * any) wrapped in this exception as cause. E.g. | ||
| * {@link IOException} thrown while trying to read from a Delta | ||
| * log file. It will be wrapped in this exception as cause. | ||
| * @throws KernelException When encountered an operation or state that is invalid or |
Collaborator
There was a problem hiding this comment.
for KernelEngineException you state i'ts for exceptions that occur in the Engine.
Am I correct in assuming that KernelException is for exceptions that occur in the Kernel, not in the engine? Can you add that very short clarification here?
Collaborator
Author
There was a problem hiding this comment.
That is correct. Clarified.
kernel/kernel-defaults/src/test/scala/io/delta/kernel/defaults/LogReplayMetricsSuite.scala
Show resolved
Hide resolved
vkorukanti
added a commit
that referenced
this pull request
May 16, 2024
…checkpoint` file (#3086) There is an issue with the `CloseableIterator` interface that Kernel is using. Currently, it extends Java's `iterator`, which doesn't throw any exceptions. We use `CloseableIterator` when returning data read from a file or any incremental data access. Any `IOException` in `hasNext` or `next` is wrapped in a `UncheckedIOException` or `RuntimeException`. Users of the `CloseableIterator` need to catch for `UncheckedIOException` or `RuntimeException` explicitly and look at the cause if they are interested in the `IOException`. This is not consistent and causes problems for the code that want to handle exceptions like `FileNotFoundException` (subclass of `IOException`) and take further actions. * Change the `CloseableIterator.{next, hasNext}` contract to expect `KernelEngineException` for any exceptions that occur while executing in the `Engine`. * Update the `DefaultParquetHandler` and `DefaultJsonHandler` to throw `KernelEngineException` instead of `UncheckedIOException` or `RuntimeException`. * In the checkpoint metadata loading method, catch `KernelEngineException` and see if the cause is `FileNotFoundException.` If yes, don't retry loading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is an issue with the
CloseableIteratorinterface that Kernel is using. Currently, it extends Java'siterator, which doesn't throw any exceptions. We useCloseableIteratorwhen returning data read from a file or any incremental data access. Any IOException inhasNextornextis wrapped in aUncheckedIOExceptionorRuntimeException. Users of theCloseableIteratorneed to catch forUncheckedIOExceptionorRuntimeExceptionexplicitly and look at the cause if they are interested in theIOException. This is not consistent and causes problems for the code that want to handle exceptions likeFileNotFoundException(subclass ofIOException) and take further actions.CloseableIterator.{next, hasNext}contract to expectKernelEngineExceptionfor any exceptions that occur while executing in theEngine.DefaultParquetHandlerandDefaultJsonHandlerto throwKernelEngineExceptioninstead ofUncheckedIOExceptionorRuntimeException.KernelEngineExceptionand see if the cause isFileNotFoundException.If yes, don't retry loading.