[HUDI-4083] Fix the flink application fails to start due to uncomplet…#5556
[HUDI-4083] Fix the flink application fails to start due to uncomplet…#5556BruceKellan wants to merge 1 commit intoapache:masterfrom
Conversation
|
@danny0405 : please rope in anyone who could assist in reviewing. for now, assigned the PR to you. |
|
@hudi-bot run azure |
…ed archiving deletion
| LOG.info("Deleting instants " + archivedInstants); | ||
| boolean success = true; | ||
| List<String> instantFiles = archivedInstants.stream().map(archivedInstant -> | ||
| new Path(metaClient.getMetaPath(), archivedInstant.getFileName()) |
There was a problem hiding this comment.
The archivedInstants seems already been sorted, because the instants from the timeline are already sorted by the instant timestamp and state, while in
we group by the instant pairs but it should still keep sequence for single instant,
one instant would be sorted by state: requested -> inflight -> complete,
so in theory, the files are also cleaned in this sequence.
There was a problem hiding this comment.
Yes, that's right. But I'm not sure if deleteFilesParallelize is cleaned in order. It use FSUtils.parallelizeFilesProcess to delete file and depend on implement in different engine.
For example, in flink engine context, it use parallel stream to delete file.
This is my understanding, please ping me if I am wrong.
There was a problem hiding this comment.
Yes, the parallel deletion may cause the disorder of the files.
But there is still a confusion needs to be resolved here:
The archiver only archives the old/completed instant on the timeline, while the flink writer only checks the latest inflight instant which should not be archived yet, so why the flink client is affected here ?
There was a problem hiding this comment.
I had this happen last time. Flink Application's JobManager was force killed because of memory.
Ant it left some instant file:
- 20220513170152006.commit.requested
- 20220513170152006.inflight
- 20220513170202566.commit
- 20220513170202566.commit.requested
- 20220513170202566.inflight
In this case, flink Application will execute this code:
It will scan and get last pending instant, and create a in-flight file in .hoodie/.aux/ckp_meta(20220513170152006 in this case).
The final result will throw an excpetion:
Caused by: org.apache.hudi.exception.HoodieRollbackException: Found commits after time :20220513170152006, please rollback greater commits first
There was a problem hiding this comment.
Cool, the logic to fetch the pending instant is problematic, but the error trace you paste is mainly because when collecting the instants to rollback in line:
We do not consider that there are inflight instants (previously completed but inflight again because of the archiving) on the timeline, cc @nsivabalan :)
There was a problem hiding this comment.
I have a patch to fix the pending instant time fetch but it does not solve your problem :)
fix.patch.zip
|
Close because HUDI-4145 already resolved it. |
|
I will close this pr because other prs have solved similar problems. |
…ed archiving deletion
What is the purpose of the pull request
Suppose a flink application crashes while archiving, it leaves some instant files that should be deleted.
If the commit file is deleted but the in-flight file is left, when the flink application starts, it will scan and get the last pending instant and throw an exception.
So we need to delete non-commit file first, and then delete commit file.
Verify this pull request
(Please pick either of the following options)
This pull request is a trivial rework / code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Committer checklist
Has a corresponding JIRA in PR title & commit
Commit message is descriptive of the change
CI is green
Necessary doc changes done or have another open PR
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.