-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-5279] move logic for deleting active instant to HoodieActiveTimeline #7196
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
Changes from all commits
13c31f3
d741194
4d6c6b8
a7d0518
4a760ca
65c6fdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,22 +266,26 @@ public void deleteCompactionRequested(HoodieInstant instant) { | |
| deleteInstantFile(instant); | ||
| } | ||
|
|
||
| /** | ||
| * Note: This method should only be used in the case that delete requested/inflight instant or empty clean instant, | ||
| * and completed commit instant in an archive operation. | ||
| */ | ||
| public void deleteInstantFileIfExists(HoodieInstant instant) { | ||
| LOG.info("Deleting instant " + instant); | ||
| Path inFlightCommitFilePath = getInstantFileNamePath(instant.getFileName()); | ||
| Path commitFilePath = getInstantFileNamePath(instant.getFileName()); | ||
| try { | ||
| if (metaClient.getFs().exists(inFlightCommitFilePath)) { | ||
| boolean result = metaClient.getFs().delete(inFlightCommitFilePath, false); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems the core change is renaming a method here:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no. For this above, merge the origin method
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the old way to delete active instants when archive uses |
||
| if (metaClient.getFs().exists(commitFilePath)) { | ||
| boolean result = metaClient.getFs().delete(commitFilePath, false); | ||
| if (result) { | ||
| LOG.info("Removed instant " + instant); | ||
| } else { | ||
| throw new HoodieIOException("Could not delete instant " + instant); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method save one invocation for |
||
| } | ||
| } else { | ||
| LOG.warn("The commit " + inFlightCommitFilePath + " to remove does not exist"); | ||
| LOG.warn("The commit " + commitFilePath + " to remove does not exist"); | ||
| } | ||
| } catch (IOException e) { | ||
| throw new HoodieIOException("Could not remove inflight commit " + inFlightCommitFilePath, e); | ||
| throw new HoodieIOException("Could not remove commit " + commitFilePath, e); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
we need to be careful about what commit can be deleted. this API is designed to only delete requested/inflight or empty clean commit, based on the usage. (1 exception is in
org.apache.hudi.cli.commands.TestRepairsCommand#testShowFailedCommitswhere this api is misused for deleting completed commits in tests; we should make separate test helper for that)We can't delete completed commit instants, which breaks the timeline's integrity. So we should name it properly at the variable as well as the API level.
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.
then we should add some doc for this method.
inFlightCommitFilePathdoesn't represent requested and empty clean instant.