Uh oh!
There was an error while loading. Please reload this page.
Bulk delete - #6682
Conversation
…ailable Previously deletes were handled by a per Action execution service that would be used to parallelize single deletes. In this PR we move the responsibility of performing the deletes and the parallelization of those deletes to the FileIO via SupportsBulkOperations. This deprecates all methods which used to be used for doing single deletes as well as passing executor services to Actions which delete many files.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
amogh-jahagirdar
commented
Jan 28, 2023
Thanks a ton for closing the loop on this @RussellSpitzer ! Left some comments |
aokolnychyi
commented
Jan 31, 2023
I am getting to this today, hopefully. |
dramaticlly
left a comment
There was a problem hiding this comment.
Would love to see this merged, thank you @RussellSpitzer
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
aokolnychyi
commented
Feb 2, 2023
I agree with the overall direction but I'd try to support the existing API to avoid massive deprecation and simplify the implementation. It will be hard to test all possible scenarios. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
125af50 to
46107fdCompare46107fd to
cb28cbaCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| .onFailure( | ||
| (f, e) -> { | ||
| LOG.error("Failure during bulk delete on file: {} ", f, e); | ||
| failureCount.incrementAndGet(); |
There was a problem hiding this comment.
This is going to increment the count on each failed attempt and won't be accurate. We could count the number of successfully deleted files instead and then use Iterables.size(pathsToDelete) to find how many we were supposed to delete.
There was a problem hiding this comment.
Ah I thought it was once per element
There was a problem hiding this comment.
I'm not sure we want to go over the iterable more than once ... let me think about this
There was a problem hiding this comment.
I double checked this, it only fires off when all retries are exhausted so it is correct as is.
scala>deftestFailure() = { varfailureCount=0Tasks.foreach("value")
.retry(3)
.onFailure((y, x: Throwable) => failureCount +=1)
.suppressFailureWhenFinished()
.run(x =>thrownewException("ohNO"))
failureCount
}
scala> testFailure()
23/03/0110:16:22WARNTasks:Retrying task after failure: ohNO
java.lang.Exception: ohNO
... 23/03/0110:16:23WARNTasks:Retrying task after failure: ohNO
java.lang.Exception: ohNO
...
23/03/0110:16:25WARNTasks:Retrying task after failure: ohNO
java.lang.Exception: ohNO
...
res21:Int=1There was a problem hiding this comment.
iceberg/core/src/main/java/org/apache/iceberg/util/Tasks.java
Lines 219 to 225 in 715c9b9
There was a problem hiding this comment.
You are right, we overlooked it while reviewing another PR. I like it more. I'll update SparkCleanupUtil to follow this patter as well.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| .suppressFailureWhenFinished() | ||
| .onFailure((file, exc) -> LOG.warn("Failed to delete file: {}", file, exc)) | ||
| .run(deleteFunc::accept); | ||
| if (deleteFunc == null && table.io() instanceof SupportsBulkOperations) { |
There was a problem hiding this comment.
This is the new pattern
if (bulk)
Bulkelse {
ifnocustomdeletetable.io:: deleteIfcustomdeletecustomDelete
}This logic is repeated in all of the actions
Uh oh!
There was an error while loading. Please reload this page.
| if (deleteFunc == null && io instanceof SupportsBulkOperations) { | ||
| summary = deleteFiles((SupportsBulkOperations) io, files); | ||
| } else { | ||
There was a problem hiding this comment.
I actually meant an empty line after DeleteSummary var but formatting here is up to you.
I like the new pattern.
Uh oh!
There was an error while loading. Please reload this page.
| if (deleteFunc == null) { | ||
| LOG.info( | ||
| "Table IO {} does not support bulk operations. Using non-bulk deletes.", table.io()); |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
aokolnychyi
left a comment
There was a problem hiding this comment.
A few non-blocking nits. Looks great otherwise. Thanks, @RussellSpitzer! Feel free to merge whenever you are ready.
RussellSpitzer
commented
Mar 2, 2023
Thanks @amogh-jahagirdar , @dramaticlly and @aokolnychyi I'll merge when tests pass. I'll do the Backport Pr's after my subsurface talk. |
This change backports PR #6682 to Spark 3.2.
Previously deletes were handled by a per Action execution service that would be used to parallelize single deletes. In this PR we move the responsibility of performing the deletes and the parallelization of those deletes to the FileIO via SupportsBulkOperations.
This change backports PR apache#6682 to Spark 3.2.
Previously deletes were handled by a per Action execution service that would be used to parallelize single deletes. In this PR we move the responsibility of performing the deletes and the parallelization of those deletes to the FileIO via SupportsBulkOperations.
Changes all Deleting Spark Actions to use FileIO Bulk Operations, adds Bulk delete to HadoopIO
The basic idea here is all of our deletes should use the bulk api or have their parallelism controlled at the FileIO level primarily. All deletes should use some parallelism by default.