【wip】[common] Keep the shared _temporary directory while other writers stage there#8862
Closed
sundapeng wants to merge 1 commit into
Closed
【wip】[common] Keep the shared _temporary directory while other writers stage there#8862sundapeng wants to merge 1 commit into
sundapeng wants to merge 1 commit into
Conversation
…ge there TempFileCommitter#clean deleted the whole '_temporary' directory of the target directory after committing one file. That directory is shared with every other writer: two concurrent writers into the same directory wiped each other's pending files, and a Hadoop FileOutputCommitter job staging there lost its output. Delete this stream's own temporary file, and the directory itself only once nothing is staged there any more.
2 tasks
2 tasks
Member
Author
|
Folded into #8861. Reviewing this on its own surfaced why the split was wrong: keeping a non-empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
RenamingTwoPhaseOutputStreamstages a file at<target dir>/_temporary/.tmp.<uuid>and renames it into place on commit.TempFileCommitter#cleanthen deletedtempPath.getParent()— the whole_temporarydirectory — after committing a single file.That directory is not private to one stream. It is the staging directory of the target directory, shared with everything else writing there, so deleting it outright throws away work that is still in flight:
renamewithFailed to rename ...;FileOutputCommitterjob staging into the same directory loses its task output.clean()now deletes this stream's own temporary file, and removes_temporaryonly once nothing is staged there any more. In the ordinary single-writer case the directory is already empty at that point and is removed exactly as before, so nothing is left behind.Brief change log
RenamingTwoPhaseOutputStream.TempFileCommitter#clean: delete the temporary file, and the staging directory only when it is empty.Tests
RenamingTwoPhaseOutputStreamTest#testCleanKeepsTheSharedStagingDirectory: another writer's pending file, and the directory holding it, surviveclean(). Fails without the change.RenamingTwoPhaseOutputStreamTest#testCleanRemovesTheStagingDirectoryOnceEmpty: an uncontended commit still leaves no_temporarybehind.mvn -pl paimon-common test -Dtest='RenamingTwoPhaseOutputStreamTest,MultiPartUploadTwoPhaseOutputStreamTest'API and Format
RenamingTwoPhaseOutputStreamis@Public, but no signature changes and an uncontended commit behaves exactly as before; only the case where something else is staging in the same directory differs.Documentation