Skip to content
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

Merged

Conversation

allisonport-db
Copy link
Collaborator

@allisonport-db allisonport-db commented Jun 21, 2024

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

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 or IllegalStateExceptions, etc a InvalidTableException will be thrown when certain invalid table states are encountered.

)
}

// TODO address the inconsistent behaviors and throw better error messages for corrupt listings?
Copy link
Collaborator Author

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.

@allisonport-db allisonport-db changed the title [Kernel] Throw InvalidTableException when we encounter a know invalid table state [Kernel] Throw InvalidTableException when we encounter a known invalid table state Jun 21, 2024
"Log file not found.\nExpected: %s\nFound: %s",
FileNames.deltaFile(logPath, newCheckpointVersion + 1),
FileNames.deltaFile(logPath, deltaVersionsAfterCheckpoint.get(0))
throw new InvalidTableException(
Copy link
Collaborator

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...)?

Copy link
Collaborator Author

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?

Copy link
Collaborator

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)
Copy link
Collaborator

@vkorukanti vkorukanti Jun 21, 2024

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?

Copy link
Collaborator Author

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

@allisonport-db allisonport-db merged commit 864b5e3 into delta-io:master Jun 24, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants