HDFS-17842. RBF: Unable to delete files under trash path.#8333
Open
balodesecurity wants to merge 3 commits intoapache:trunkfrom
Open
HDFS-17842. RBF: Unable to delete files under trash path.#8333balodesecurity wants to merge 3 commits intoapache:trunkfrom
balodesecurity wants to merge 3 commits intoapache:trunkfrom
Conversation
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
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.
Problem
After HDFS-17263, deleting
.Trash/Current/or.Trash/<checkpoint>/via the RBF router fails with:However, deleting
.Trash/itself succeeds. The regression was introduced by HDFS-17263 which removed the trailing/from theisTrashPathregex pattern.Root Cause
RouterClientProtocol.delete()callsgetLocationsForPath(src, failIfLocked=true), which callsMountTableResolver.getMountPoints(src). Whensrcis a trash-current path like/user/alice/.Trash/Current,getMountPointsdetects it as a trash path viaisTrashPath(), subtracts the trash prefix viasubtractTrashCurrentPath(), and gets an empty string"". The code then queries the mount table tree withsubMap("", ""+MAX_VALUE), which returns all mount table entries.FileSubclusterResolver.getMountPoints("", allKeys)therefore returns a non-null list of all mount point names, causinggetLocationsForPathto throwAccessControlException.Before HDFS-17263,
isTrashPathrequired a trailing/, so.Trash/Current(without trailing slash) was not recognized as a trash path andgetMountPointswould correctly look for mount points directly under.Trash/Current— finding none.Fix
In
MountTableResolver.getMountPoints(), after applyingsubtractTrashCurrentPath(), if the resulting path is empty (meaning the input was exactly the trash Current or checkpoint directory with no sub-path), returnnullimmediately. An empty result means the path is the trash checkpoint directory itself, which never hosts RBF mount points.Testing
Added
testDeleteTrashCurrentAndCheckpoint()toTestRouterTrashwhich:fs.delete(.Trash/Current, recursive=true)succeedsfs.delete(.Trash, recursive=true)also succeedsJIRA: https://issues.apache.org/jira/browse/HDFS-17842