-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-6151] Rollback previously applied commits to MDT when operations are retried. #8604
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
[HUDI-6151] Rollback previously applied commits to MDT when operations are retried. #8604
Conversation
| // if this is a new commit being applied to metadata for the first time | ||
| writeClient.startCommitWithTime(instantTime); | ||
| LOG.info("New commit at " + instantTime + " being applied to MDT"); | ||
| } else { |
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.
to MDT -> to MDT.
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.
Fixed
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.
Can we sync the logic also to FlinkHoodieBackedTableMetadataWriter ?
...park-client/src/main/java/org/apache/hudi/metadata/SparkHoodieBackedTableMetadataWriter.java
Show resolved
Hide resolved
...park-client/src/main/java/org/apache/hudi/metadata/SparkHoodieBackedTableMetadataWriter.java
Show resolved
Hide resolved
| alreadyCompletedInstant.isPresent() ? "Already" : "Partially", instantTime)); | ||
|
|
||
| // Rollback the previous committed commit | ||
| if (!writeClient.rollback(instantTime)) { |
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.
Trying to gauge if we really need this.
I guess in next couple of patches, you are going to add below change:
- Any rollback in DT will be an actual rollback in MDT as well.
having said that, lets go through this use-case.
Compaction Commit C5 is inflight in DT and succeeded in MDT, but crashed in DT.
so on restart, a rollback is triggered in DT. which when gets into MDT territory, will rollback the succeeded commit in MDT. So, it will be automatically taken care of.
After rollback of C5 is completed, C5 will be re-attempted in DT. and when it gets into MDT territory, there won't be any traces of DC5 at all. So, wondering when exactly we will hit this case?
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.
if we are talking about a partially failed commit in MDT:
Compaction Commit C5 is inflight in DT and DC5 in MDT is also partitally committed and crashed.
On restart, any new operation in DT when it gets into MDT territory, on deducting a partial commit in MDT, a rollback will be triggered eagerly. Ref:
Line 151 in 04e54a6
| if (dataWriteConfig.getFailedWritesCleanPolicy().isEager() |
So, this case is also taken care of.
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.
will rollback the succeeded commit in MDT. So, it will be automatically taken care of.
The current code on master just removes the .complete metadata file, is that a rollback you are mentioning about? To keep sync with regular rollback, I think triggering a real rollback action is necessary.
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.
Older solution of removing the completed action and reattempt won't work in all scenarios. We will have to consider the following scenarios:
(1) c1.commit failed on the main dataset; On MDT, c1.deltacommit was completed.
(a) with record index enabled, new log block was added to the log file by c1.deltacommit. Simply removing deltacommit, may not be enough and will require additional action to rollback the logblock, to keep the log file consistent.
(2) c1.clean was attempted. c1.deltacommit was completed. When clean is retried, second attempt could bring in some of the files that were in the "failed" list of the first attempt (vs the "success" list).
(3) c1.rollback was attempted. c1.deltacommit was completed. (We fixed an issue with incomplete rollback, with MDT updated with deltacommit, scenario. This change played a role in this scenario as well).
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.
Yeah, fix the rollback in sync with normal DT can avoid many potential bugs, +1 for this direction.
|
LGTM. |
nbalajee
left a comment
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
|
+1, we are good if the test failures are resolved. |
|
once the CI is green, we can land |
|
@prashantwason can you rebase with the latest master code and re-trigger the Azure CI tests? |
4 similar comments
|
@prashantwason can you rebase with the latest master code and re-trigger the Azure CI tests? |
|
@prashantwason can you rebase with the latest master code and re-trigger the Azure CI tests? |
|
@prashantwason can you rebase with the latest master code and re-trigger the Azure CI tests? |
|
@prashantwason can you rebase with the latest master code and re-trigger the Azure CI tests? |
f1653d9 to
f0cf8b8
Compare
|
@danny0405 @nsivabalan @prashantwason I rebased the PR on the latest PR. Once CI passes, we can land this. |
danny0405
left a comment
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.
Hi, @prashantwason , can we also sync the fix to FlinkHoodieBackedTableMetadataWriter ?
...park-client/src/main/java/org/apache/hudi/metadata/SparkHoodieBackedTableMetadataWriter.java
Outdated
Show resolved
Hide resolved
7612c1e to
2faefb4
Compare
|
@danny0405 I have synced the fix to FlinkHoodieBackedTableMetadataWriter. Please take a look. |
|
@hudi-bot run azure |
danny0405
left a comment
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.
+1
|
There was a test failure: https://dev.azure.com/apache-hudi-ci-org/apache-hudi-ci/_build/results?buildId=18151&view=logs&j=7601efb9-4019-552e-11ba-eb31b66593b2&t=9688f101-287d-53f4-2a80-87202516f5d0&l=34039, can you take a look ~ |
e6b3312 to
eb39bc7
Compare
codope
left a comment
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.
Change looks good. Have fixed the failing tests. We can land once the CI is green.
Nice job! @codope ~ |
[HUDI-6151] Rollback previously applied commits to MDT when operations are retried.
Change Logs
Operations like Clean, Compaction are retried after failures with the same instant time. If the previous run of the operation successfully committed to the MDT but failed to commit to the dataset, then the operation will be retried later with the same instantTime causing duplicate updates applied to MDT.
Currently, we simply delete the completed deltacommit without rolling back the deltacommit.
To handle this, we detect a replay of operation and rollback any changes from that operation in MDT.
Impact
Fixes the issue of duplicate log blocks written in the MDT. This is deterimental for indexes where duplicates are not allowed.
Risk level (write none, low medium or high below)
None. Unit test has been added.
Documentation Update
None
Contributor's checklist