Route FilterDirectory#copyFrom through createOutput (10x backport of #16530) - #16538
Closed
tballison wants to merge 1 commit into
Closed
Route FilterDirectory#copyFrom through createOutput (10x backport of #16530)#16538tballison wants to merge 1 commit into
tballison wants to merge 1 commit into
Conversation
…pache#16530) Backport of the non-breaking parts of apache#16530. apache#16173 changed FilterDirectory#copyFrom to delegate to the wrapped directory, which hid FilterDirectory subclasses that override createOutput for per-file bookkeeping (TrackingTmpOutputDirectoryWrapper, MockDirectoryWrapper, NRTCachingDirectory, DirectIODirectory, ByteWritesTrackingDirectoryWrapper). Unlike main, Directory#copyFrom keeps its default implementation on 10x; FilterDirectory#copyFrom simply routes through it (and thus createOutput) instead of delegating. Also fixes TrackingTmpOutputDirectoryWrapper#copyFrom failure cleanup to delete the temp file rather than the logical dest name, and ports the tests from apache#16530. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Description
Backport to
branch_10xof the non-breaking parts of #16530 (which itself follows up #16173). Opened ahead of the main merge to get CI on the 10x variant; happy to hold merging until #16530 lands.#16173 (backported to 10x in 148ee2f) changed
FilterDirectory#copyFromto delegate to the wrapped directory, which hidFilterDirectorysubclasses that overridecreateOutputfor per-file bookkeeping (TrackingTmpOutputDirectoryWrapper,MockDirectoryWrapper,NRTCachingDirectory,DirectIODirectory,ByteWritesTrackingDirectoryWrapper).Differences from #16530, since we can't break the API on 10x:
Directory#copyFromkeeps its concrete default implementation (no abstract method, nocopyThroughCreateOutputhelper).FilterDirectory#copyFromroutes throughsuper.copyFrom— i.e. throughcreateOutput— instead of delegating, with javadoc noting that subclasses wanting an optimized copy (e.g.HardlinkCopyDirectoryWrapper) may override to delegate.CompoundDirectory,FileSwitchDirectory,BaseMergePolicyTestCase) are unnecessary here and are omitted.TrackingTmpOutputDirectoryWrapper#copyFromfailure cleanup usesIOUtils.deleteFilesIgnoringExceptionssincedeleteFilesSuppressingExceptions(Catch and re-throw Throwable rather than using a success boolean #14633) is main-only.Same as #16530:
TrackingTmpOutputDirectoryWrapper#copyFromfailure cleanup to delete the temp file rather than the logical dest name.TestFilterDirectory#testCopyFromRoutesThroughCreateOutput(replacestestCopyFromDelegates),TestTrackingTmpOutputDirectoryWrapper,TestByteWritesTrackingDirectoryWrapper#testCopyFromTracksBytes,TestDirectIODirectoryCopyFrom.The CHANGES entry replaces the #16173 entry under 10.6.0 Bug Fixes since this reverts that behavior before it ships in a release.
Made with Cursor