-
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] Throw InvalidTableException when we encounter a known invalid table state #3288
[Kernel] Throw InvalidTableException when we encounter a known invalid table state #3288
Conversation
) | ||
} | ||
|
||
// TODO address the inconsistent behaviors and throw better error messages for corrupt listings? |
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.
I also addressed this in this PR since it was an easy fix. See this change.
kernel/kernel-api/src/main/java/io/delta/kernel/internal/snapshot/SnapshotManager.java
Outdated
Show resolved
Hide resolved
"Log file not found.\nExpected: %s\nFound: %s", | ||
FileNames.deltaFile(logPath, newCheckpointVersion + 1), | ||
FileNames.deltaFile(logPath, deltaVersionsAfterCheckpoint.get(0)) | ||
throw new InvalidTableException( |
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.
DeltaErrors.invalidTable(Path tablePath, String msg, Object args...)
?
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.
I wasn't sure if we needed a method for this. If it just passes the args exactly the same and it's a specific exception class it seems like we can just throw the exception in line? What do you think?
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.
sounds good.
FileNames.deltaVersion(deltas.get(deltas.size() - 1).getPath()) < newVersion) { | ||
throw new InvalidTableException( | ||
tablePath.toString(), | ||
String.format("Missing delta file for version %s", newVersion) |
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.
Missing delta log file(s) needed for state construction?
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.
Not sure if it matters but this error you actually can reconstruct the state... (since there is a checkpoint file) but we throw an error anyways (in most cases, see the test suite... it's not all cases) because there should be a delta file for the checkpoint version present
…hot/SnapshotManager.java Co-authored-by: Venki Korukanti <[email protected]>
Which Delta project/connector is this regarding?
Description
During log reconstruction we throw a bunch of various errors when we encounter a table state that we consider invalid. This PR updates some of those errors to be
InvalidTableException
. This doesn't necessarily cover all possible exceptions due to an invalid table, just some of the known and clear cases during log reconstruction.How was this patch tested?
Updates existing tests.
Does this PR introduce any user-facing changes?
Yes, instead of internal
RuntimeExceptions
orIllegalStateExceptions
, etc aInvalidTableException
will be thrown when certain invalid table states are encountered.