-
Notifications
You must be signed in to change notification settings - Fork 3.4k
API, Core, Spark:Add file groups failure in rewrite result #7361
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 5 commits
945a548
d75b98c
1f31e5b
6d59eff
a577e01
d7c3749
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 |
|---|---|---|
|
|
@@ -337,14 +337,21 @@ private Result doExecuteWithPartialProgress( | |
| commitManager.service(groupsPerCommit); | ||
| commitService.start(); | ||
|
|
||
| List<FileGroupFailureResult> rewriteFailures = Lists.newCopyOnWriteArrayList(); | ||
|
Member
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. In general this would probably be an expensive data-structure for this operation since we never traverse. I don't think this is ever going to be that huge, but let's use something a bit more efficient. I think something like
Member
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. Just to note, I don't think we actually would have performance issues with copy on write array list, it just seems a bit wasteful to me in this context.
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. After reading the introduction of newCopyOnWriteArrayList and ConcurrentLinkedQueue, it is true that the latter is more efficient, thank you. |
||
| // Start rewrite tasks | ||
| Tasks.foreach(groupStream) | ||
| .suppressFailureWhenFinished() | ||
| .executeWith(rewriteService) | ||
| .noRetry() | ||
| .onFailure( | ||
| (fileGroup, exception) -> | ||
| LOG.error("Failure during rewrite group {}", fileGroup.info(), exception)) | ||
| (fileGroup, exception) -> { | ||
| LOG.error("Failure during rewrite group {}", fileGroup.info(), exception); | ||
| rewriteFailures.add( | ||
| ImmutableRewriteDataFiles.FileGroupFailureResult.builder() | ||
| .info(fileGroup.info()) | ||
| .dataFilesCount(fileGroup.numFiles()) | ||
| .build()); | ||
| }) | ||
| .run(fileGroup -> commitService.offer(rewriteFiles(ctx, fileGroup))); | ||
| rewriteService.shutdown(); | ||
|
|
||
|
|
@@ -362,7 +369,10 @@ private Result doExecuteWithPartialProgress( | |
|
|
||
| List<FileGroupRewriteResult> rewriteResults = | ||
| commitResults.stream().map(RewriteFileGroup::asResult).collect(Collectors.toList()); | ||
| return ImmutableRewriteDataFiles.Result.builder().rewriteResults(rewriteResults).build(); | ||
| return ImmutableRewriteDataFiles.Result.builder() | ||
| .rewriteResults(rewriteResults) | ||
| .rewriteFailures(rewriteFailures) | ||
| .build(); | ||
| } | ||
|
|
||
| Stream<RewriteFileGroup> toGroupStream( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -755,7 +755,9 @@ public void testPartialProgressWithRewriteFailure() { | |
|
|
||
| RewriteDataFiles.Result result = spyRewrite.execute(); | ||
|
|
||
| Assert.assertEquals("Should have 7 fileGroups", result.rewriteResults().size(), 7); | ||
| assertThat(result.rewriteResults()).hasSize(7); | ||
| assertThat(result.rewriteFailures()).hasSize(3); | ||
|
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. nit: could you also update the line above please? |
||
| assertThat(result.failedDataFilesCount()).isEqualTo(6); | ||
| assertThat(result.rewrittenBytesCount()).isGreaterThan(0L).isLessThan(dataSizeBefore); | ||
|
|
||
| table.refresh(); | ||
|
|
@@ -796,7 +798,9 @@ public void testParallelPartialProgressWithRewriteFailure() { | |
|
|
||
| RewriteDataFiles.Result result = spyRewrite.execute(); | ||
|
|
||
| Assert.assertEquals("Should have 7 fileGroups", result.rewriteResults().size(), 7); | ||
| assertThat(result.rewriteResults()).hasSize(7); | ||
| assertThat(result.rewriteFailures()).hasSize(3); | ||
|
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. nit: could you also update the line above please? |
||
| assertThat(result.failedDataFilesCount()).isEqualTo(6); | ||
| assertThat(result.rewrittenBytesCount()).isGreaterThan(0L).isLessThan(dataSizeBefore); | ||
|
|
||
| table.refresh(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Instead of re-using the FileGroupRewriteResult, would it make more sense to have a FailedFileGroupRewriteResult, with just failure?
I dont think the bytesCount/fileCount make too much sense on failure, and we can also put the exception there? cc @aokolnychyi @RussellSpitzer for thoughts
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.
I think it is ok that have a FailedFileGroupRewriteResult. What about the following data structure?
FailedFileGroupRewriteResult {
FileGroupInfo info();
boolean isFailedGroup()
}
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.
Not sure why we would need a "boolean" wouldn't it be this class because it failed?
Uh oh!
There was an error while loading. Please reload this page.
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.
I think we should probably have result have two new interfaces, something like
Then we won't mix failures and successes in the same list
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.
Thanks @RussellSpitzer reply,
Yes, "boolean" is redundant, They are great advice, I wiil fix them according to your advice.