-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Kernel] Handle KernelEngineException
when reading the _last_checkpoint
file
#3086
Conversation
UncheckedIOException
when reading the _last_checkpoint
fileKernelEngineException
when reading the _last_checkpoint
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the capital T
mean in msgT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. Clarified.
kernel/kernel-defaults/src/test/scala/io/delta/kernel/defaults/LogReplayMetricsSuite.scala
Show resolved
Hide resolved
…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.
There is an issue with the
CloseableIterator
interface that Kernel is using. Currently, it extends Java'siterator
, which doesn't throw any exceptions. We useCloseableIterator
when returning data read from a file or any incremental data access. Any IOException inhasNext
ornext
is wrapped in aUncheckedIOException
orRuntimeException
. Users of theCloseableIterator
need to catch forUncheckedIOException
orRuntimeException
explicitly 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 expectKernelEngineException
for any exceptions that occur while executing in theEngine
.DefaultParquetHandler
andDefaultJsonHandler
to throwKernelEngineException
instead ofUncheckedIOException
orRuntimeException
.KernelEngineException
and see if the cause isFileNotFoundException.
If yes, don't retry loading.