jojochuang opened a new pull request, #10779:
URL: https://github.com/apache/ozone/pull/10779
## What changes were proposed in this pull request?
Follow-up of HDDS-15678, which introduced a `headOp` (metadata / type-only)
flag so that OFS (`ofs://`) `isDirectory`/`isFile` skip the SCM pipeline
refresh (an OM→SCM round-trip) and block-location retrieval — those calls only
need the entry type, not block locations.
That change only covered the rooted (`ofs://`) filesystem. This PR extends
the same optimization to the remaining call sites that fetch a full
`FileStatus` solely to determine whether a path is a file or a directory:
1. **o3fs `BasicOzoneFileSystem.isDirectory`/`isFile`** (primary). These
still delegated to the deprecated `FileSystem.super.isDirectory`/`isFile`,
which internally call the full `getFileStatus(f)` and therefore trigger a
pipeline refresh for file paths. They now go through a head-op `getFileStatus`,
mirroring what HDDS-15678 did for the rooted filesystem.
`BasicOzoneClientAdapterImpl` gains a `headOp` `getFileStatus` override that
forwards the flag to `OzoneBucket.getFileStatus(key, headOp)`. Without this,
`o3fs` kept paying the SCM round-trip for `isDirectory`/`isFile` while `ofs`
did not. The `@SuppressWarnings("deprecation")` (previously needed for the
`super.*` calls) is removed as those calls are gone.
2. **`DeleteKeyHandler`** (`ozone sh key delete` on FSO buckets). The two
`bucket.getFileStatus(...).isDirectory()` checks now pass `headOp=true` (the
API added by HDDS-15678).
3. **Trash-root type checks** in `BasicOzoneFileSystem#getTrashRoots` and
`BasicRootedOzoneClientAdapterImpl#getTrashRoots`. These fetched the same
path's status via `exists()` plus up to two `getFileStatus()` calls; they now
fetch it once. (Trash roots are directories, which never triggered a pipeline
refresh, so the win here is removing redundant RPCs rather than skipping a
refresh.)
Behaviour is unchanged: `isDirectory`/`isFile` still return `false` for a
non-existent path (`FileNotFoundException` is swallowed) and still propagate
other `IOException`s.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15877
## How was this patch tested?
- New unit tests in `ozonefs-common`:
- `TestBasicOzoneClientAdapterHeadOp` — verifies the o3fs adapter forwards
`headOp` into `OzoneBucket.getFileStatus`, that the 4-arg overload defaults to
`headOp=false`, and that `FILE_NOT_FOUND` maps to `FileNotFoundException` while
other `OMException`s propagate.
- `TestOzoneFileSystemHeadOp` — verifies
`BasicOzoneFileSystem.isDirectory`/`isFile` request `headOp=true`, that
`getFileStatus(Path)` still uses `headOp=false`, that missing paths return
`false`, and that non-not-found exceptions propagate.
- Existing `ozonefs-common` unit suite passes (46 tests), including the
HDDS-15678 rooted head-op tests.
- `mvn checkstyle:check` clean on `ozone-filesystem-common` and
`ozone-cli-shell`.
- `ozone-filesystem-hadoop2` builds against the Hadoop 2.10.2 classpath (no
Hadoop 3-only API used).
Made with [Cursor](https://cursor.com)
--
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]