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
Query sometimes fails with "Failed to delete temporary file" when writing to a sorted (sorted_by) bucketed Hive table on S3 #2296
Comments
I think it's fine if we simply remove the check, per the Hadoop FS specification |
sorted_by
table property in hive connector on s3
@grantatspothero can I assign this to you? |
@findepi 👍 I can remove the unnecessary file checks and test sorting on s3. |
@grantatspothero I'm still getting exceptions as you described above on master. Were you able to submit a PR for the fix you described? |
@ddrinka I got distracted and never got a chance, thanks for opening a PR. You might want to audit the whole |
@electrum Anything I can do on the PR to get this in the next release? I'm not able to run with bucketed sorting at all without this change. |
I got to know this issue while discussing #3410. I tried setting To make things worse, when the insert query is aborted the Just as a data point, the machine in question has 256 GB RAM but the presto JVM is only taking ~9 GB of memory which points to the severe bottleneck created by s3 temp file uploads. |
Right now the
sorted_by
table property in the hive connector does not work very well when the tables are stored in s3.SortingFileWriter.java
writes lots of sorted temporary files to s3 (in order to not consume a bunch of memory for sorting) and then merges them together. This is a problem right now because:SortingFileWriter.mergeFiles
does not work on s3 because s3 lacks read after write consistency for file deletes. Specifically these lines:https://github.com/prestosql/presto/blob/master/presto-hive/src/main/java/io/prestosql/plugin/hive/SortingFileWriter.java#L226-L229
Will sometimes error out as s3 temporarily thinks the file still exists as it was just deleted.
See here for the stacktrace reproducing 2:
A short term solution to just the s3 problem consistency problem is to not do the read after delete and instead to check the return boolean of
fileSystem.delete
.A longer term solution to both problems might be to use local disk for spilling tmp files instead of s3. This would improve performance as well as avoid consistency problems with s3.
@findepi And I talked about this in a slack thread here:
https://prestosql.slack.com/archives/CGB0QHWSW/p1576484582050100?thread_ts=1576180076.157800&cid=CGB0QHWSW
The text was updated successfully, but these errors were encountered: