balodesecurity opened a new pull request, #8333:
URL: https://github.com/apache/hadoop/pull/8333
### Problem
After HDFS-17263, deleting `.Trash/Current/` or `.Trash/<checkpoint>/` via
the RBF router fails with:
The operation is not allowed because there are mount points:
<mount-points> under the path: /user/alice/.Trash/Current
However, deleting `.Trash/` itself succeeds. The regression was introduced
by HDFS-17263 which removed the trailing `/` from the `isTrashPath` regex
pattern.
### Root Cause
`RouterClientProtocol.delete()` calls `getLocationsForPath(src,
failIfLocked=true)`, which calls `MountTableResolver.getMountPoints(src)`. When
`src` is a trash-current path like `/user/alice/.Trash/Current`,
`getMountPoints` detects it as a trash path via `isTrashPath()`, subtracts the
trash prefix via `subtractTrashCurrentPath()`, and gets an empty string `""`.
The code then queries the mount table tree with `subMap("", ""+MAX_VALUE)`,
which returns **all** mount table entries.
`FileSubclusterResolver.getMountPoints("", allKeys)` therefore returns a
non-null list of all mount point names, causing `getLocationsForPath` to throw
`AccessControlException`.
Before HDFS-17263, `isTrashPath` required a trailing `/`, so
`.Trash/Current` (without trailing slash) was not recognized as a trash path
and `getMountPoints` would correctly look for mount points directly under
`.Trash/Current` — finding none.
### Fix
In `MountTableResolver.getMountPoints()`, after applying
`subtractTrashCurrentPath()`, if the resulting path is empty (meaning the input
was exactly the trash Current or checkpoint directory with no sub-path), return
`null` immediately. An empty result means the path is the trash checkpoint
directory itself, which never hosts RBF mount points.
### Testing
Added `testDeleteTrashCurrentAndCheckpoint()` to `TestRouterTrash` which:
1. Moves a file to trash via the router
2. Verifies that `fs.delete(.Trash/Current, recursive=true)` succeeds
3. Verifies that `fs.delete(.Trash, recursive=true)` also succeeds
JIRA: https://issues.apache.org/jira/browse/HDFS-17842
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]