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-3180] Include files from completed commits while bootstrapping metadata table #4519
[HUDI-3180] Include files from completed commits while bootstrapping metadata table #4519
Conversation
a522d61
to
fba1437
Compare
@manojpec : can you review the patch please. |
// add few extra files to table. bootstrap should include those files. | ||
String fileName = UUID.randomUUID().toString(); | ||
Path baseFilePath = FileCreateUtils.getBaseFilePath(basePath, "p1", "0000006", fileName); | ||
FileCreateUtils.createBaseFile(basePath, "p1", "0000006", fileName, 100); |
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.
Should we instead start the commit and not have it completed so that we have it in timeline also ?
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 its part of the timeline, bootstrap may not kick in. also, not sure if we will gain much from it. this test fails if not the fix in source code as part of this patch. So, we should be good. Let me know what you think.
// filter for files that are part of the completed commits | ||
Map<String, Long> validFileNameToSizeMap = fileNameToSizeMap.entrySet().stream().filter(fileSizePair -> { | ||
String commitTime = FSUtils.getCommitTime(fileSizePair.getKey()); | ||
return HoodieTimeline.compareTimestamps(commitTime, HoodieTimeline.LESSER_THAN_OR_EQUALS, createInstantTime); |
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.
this does not filter out the failed old commits right?
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.
bootstrap itself will get triggered only if all operations are complete. If there was a partially failed commit, unless an explicit rollback happens, bootstrap may not kick in.
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.
have responded to clarifications.
// filter for files that are part of the completed commits | ||
Map<String, Long> validFileNameToSizeMap = fileNameToSizeMap.entrySet().stream().filter(fileSizePair -> { | ||
String commitTime = FSUtils.getCommitTime(fileSizePair.getKey()); | ||
return HoodieTimeline.compareTimestamps(commitTime, HoodieTimeline.LESSER_THAN_OR_EQUALS, createInstantTime); |
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.
bootstrap itself will get triggered only if all operations are complete. If there was a partially failed commit, unless an explicit rollback happens, bootstrap may not kick in.
// add few extra files to table. bootstrap should include those files. | ||
String fileName = UUID.randomUUID().toString(); | ||
Path baseFilePath = FileCreateUtils.getBaseFilePath(basePath, "p1", "0000006", fileName); | ||
FileCreateUtils.createBaseFile(basePath, "p1", "0000006", fileName, 100); |
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 its part of the timeline, bootstrap may not kick in. also, not sure if we will gain much from it. this test fails if not the fix in source code as part of this patch. So, we should be good. Let me know what you think.
LGTM |
What is the purpose of the pull request
During metadata table bootstrap, we should include files only from completed commits and not all files after listing files using fs. This patch fixes the same to consider files only from completed commits.
If not for the fix, potential issue:
Same files will be added twice to metadata table. once with bootstrap commit and once by the inflight commit when applied to metadata table. Our combine logic will sum up the file size and will show as 2x. And so queries might end up with EOF exception while trying to read 2x size.
Brief change log
(for example:)
Verify this pull request
This change added tests and can be verified as follows:
TestHoodieMetadataBootstrap.testMetadataBootstrapWithExtraFiles
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.