This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 57c01622723 HDDS-17755. Use isSupportedBy() for OzoneManagerVersion
check (#12002)
57c01622723 is described below
commit 57c0162272398047e6980dff16d1fb6808a9f032
Author: Billy Shen <[email protected]>
AuthorDate: Tue Nov 10 23:32:56 2026 +0800
HDDS-17755. Use isSupportedBy() for OzoneManagerVersion check (#12002)
---
.../java/org/apache/hadoop/ozone/client/rpc/RpcClient.java | 2 +-
.../hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
index 572b01a9681..43009970ad1 100644
---
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
+++
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
@@ -1578,7 +1578,7 @@ public OzoneDataStreamOutput
createStreamKeyIfNoneMatch(String volumeName, Strin
}
private void checkIfNoneMatchETagSupport() throws IOException {
- if (getOmVersion().compareTo(OzoneManagerVersion.S3_IF_NONE_MATCH_ETAG) <
0) {
+ if
(!OzoneManagerVersion.S3_IF_NONE_MATCH_ETAG.isSupportedBy(getOmVersion())) {
throw new IOException("OzoneManager does not support If-None-Match
entity ETags for writes.");
}
}
diff --git
a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
index 9871fc313be..c899d0507cf 100644
---
a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
+++
b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java
@@ -392,7 +392,7 @@ public InputStream readFile(String pathStr) throws
IOException {
try {
// An empty bucket name takes the getBucket path, which reports it as
FileNotFoundException.
if (!ofsPath.getBucketName().isEmpty()
- &&
proxy.getOmVersion().compareTo(OzoneManagerVersion.GET_KEY_INFO_REJECTS_OBS) >=
0) {
+ &&
OzoneManagerVersion.GET_KEY_INFO_REJECTS_OBS.isSupportedBy(proxy.getOmVersion()))
{
// Ask OM to reject an OBJECT_STORE bucket (HDDS-16948), so read
without fetching the bucket first.
try {
return proxy.readFile(ofsPath.getVolumeName(),
ofsPath.getBucketName(), key, true).getInputStream();
@@ -542,7 +542,7 @@ void rename(OzoneBucket bucket, String path, String newPath)
* file system rename can be sent without fetching the bucket to learn its
layout.
*/
boolean isRenameRequiringFileSystemOptimizedSupported() {
- return
proxy.getOmVersion().compareTo(OzoneManagerVersion.RENAME_KEY_REJECTS_NON_FSO)
>= 0;
+ return
OzoneManagerVersion.RENAME_KEY_REJECTS_NON_FSO.isSupportedBy(proxy.getOmVersion());
}
/**
@@ -761,8 +761,7 @@ private FileStatusAdapter getFileStatusForKeyOrSnapshot(
volume, bucket, uri);
} else {
OzoneFileStatus status;
- if (proxy.getOmVersion()
- .compareTo(OzoneManagerVersion.GET_FILE_STATUS_REJECTS_OBS) >= 0) {
+ if
(OzoneManagerVersion.GET_FILE_STATUS_REJECTS_OBS.isSupportedBy(proxy.getOmVersion()))
{
status = proxy.getOzoneFileStatus(ofsPath.getVolumeName(),
ofsPath.getBucketName(), key, headOp);
} else {
@@ -1032,7 +1031,7 @@ public ListStatusResult<FileStatusAdapter>
listStatusPage(String pathStr, boolea
List<OzoneFileStatus> statuses = Collections.emptyList();
List<OzoneFileStatusLight> lightStatuses = Collections.emptyList();
boolean complete = false;
- if
(proxy.getOmVersion().compareTo(OzoneManagerVersion.LIST_STATUS_REJECTS_OBS) >=
0) {
+ if
(OzoneManagerVersion.LIST_STATUS_REJECTS_OBS.isSupportedBy(proxy.getOmVersion()))
{
// Ask OM to reject an OBJECT_STORE bucket (HDDS-16760), so list
without
// fetching the bucket first. The bucket is fetched only when the
listing
// fails because a bucket is missing, to tell an orphan link bucket
@@ -1489,8 +1488,7 @@ public FileChecksum getFileChecksum(String keyName, long
length)
// client can talk to an older OM that lacks that check, so when the
negotiated
// OM version predates LOOKUP_FILE_REJECTS_OBS, fall back to LookupKey and
// validate the bucket layout client-side as before.
- boolean omRejectsObs = proxy.getOmVersion()
- .compareTo(OzoneManagerVersion.LOOKUP_FILE_REJECTS_OBS) >= 0;
+ boolean omRejectsObs =
OzoneManagerVersion.LOOKUP_FILE_REJECTS_OBS.isSupportedBy(proxy.getOmVersion());
if (!omRejectsObs) {
// Called for its layout validation side effect; the bucket itself is
not needed.
getBucket(ofsPath, false);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]