This is an automated email from the ASF dual-hosted git repository.
arafat2198 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 dda5285a38 HDDS-12229. Remove Incorrect Warning for OBS Bucket in
Namespace CLI Commands #7832
dda5285a38 is described below
commit dda5285a38b6107e1ca2e8b326da9164e76e3fc6
Author: Gargi Jaiswal <[email protected]>
AuthorDate: Mon Feb 17 15:32:11 2025 +0530
HDDS-12229. Remove Incorrect Warning for OBS Bucket in Namespace CLI
Commands #7832
---
.../hadoop/ozone/shell/TestNSSummaryAdmin.java | 1 -
.../admin/nssummary/FileSizeDistSubCommand.java | 5 --
.../ozone/admin/nssummary/NSSummaryAdmin.java | 58 ----------------------
.../ozone/admin/nssummary/NSSummaryCLIUtils.java | 10 ----
.../admin/nssummary/QuotaUsageSubCommand.java | 5 --
.../ozone/admin/nssummary/SummarySubCommand.java | 5 --
6 files changed, 84 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestNSSummaryAdmin.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestNSSummaryAdmin.java
index f212392b59..b1da260c22 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestNSSummaryAdmin.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestNSSummaryAdmin.java
@@ -158,7 +158,6 @@ public void testNSSummaryCLIOBS() throws
UnsupportedEncodingException {
String path = "/" + volumeName + "/" + bucketOBS;
executeAdminCommands(path);
// Should throw warning, since bucket is in OBS bucket layout.
- assertThat(getOutContentString()).contains("[Warning] Namespace CLI is not
designed for OBS bucket layout.");
assertThat(getOutContentString()).contains("Put more files into it to
visualize DU");
assertThat(getOutContentString()).contains("Put more files into it to
visualize file size distribution");
}
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/FileSizeDistSubCommand.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/FileSizeDistSubCommand.java
index 0af263dbe3..1991bc4271 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/FileSizeDistSubCommand.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/FileSizeDistSubCommand.java
@@ -27,7 +27,6 @@
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.makeHttpCall;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printEmptyPathRequest;
-import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printBucketReminder;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printNewLines;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printPathNotFound;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printSpaces;
@@ -79,10 +78,6 @@ public Void call() throws Exception {
} else if
("TYPE_NOT_APPLICABLE".equals(distResponse.path("status").asText())) {
printTypeNA("File Size Distribution");
} else {
- if (parent.isNotValidBucketOrOBSBucket(path)) {
- printBucketReminder();
- }
-
printWithUnderline("File Size Distribution", true);
JsonNode fileSizeDist = distResponse.path("dist");
double sum = 0;
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
index 4edca82520..b4ed275719 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryAdmin.java
@@ -17,26 +17,15 @@
*/
package org.apache.hadoop.ozone.admin.nssummary;
-import org.apache.hadoop.fs.ozone.OzoneClientUtils;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.ozone.admin.OzoneAdmin;
import org.apache.hadoop.hdds.cli.AdminSubcommand;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.server.http.HttpConfig;
-import org.apache.hadoop.ozone.OFSPath;
-import org.apache.hadoop.ozone.client.ObjectStore;
-import org.apache.hadoop.ozone.client.OzoneBucket;
-import org.apache.hadoop.ozone.client.OzoneClient;
-import org.apache.hadoop.ozone.client.OzoneClientFactory;
-import org.apache.hadoop.ozone.om.OmConfig;
-import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.kohsuke.MetaInfServices;
import picocli.CommandLine;
-import java.io.IOException;
-import java.util.HashSet;
-
import static
org.apache.hadoop.hdds.recon.ReconConfigKeys.OZONE_RECON_ADDRESS_DEFAULT;
import static
org.apache.hadoop.hdds.recon.ReconConfigKeys.OZONE_RECON_ADDRESS_KEY;
import static
org.apache.hadoop.hdds.recon.ReconConfigKeys.OZONE_RECON_HTTPS_ADDRESS_DEFAULT;
@@ -66,53 +55,6 @@ public class NSSummaryAdmin implements AdminSubcommand {
@CommandLine.ParentCommand
private OzoneAdmin parent;
- private boolean isObjectStoreBucket(OzoneBucket bucket, ObjectStore
objectStore) {
- boolean enableFileSystemPaths = getOzoneConfig()
- .getBoolean(OmConfig.Keys.ENABLE_FILESYSTEM_PATHS,
- OmConfig.Defaults.ENABLE_FILESYSTEM_PATHS);
- try {
- // Resolve the bucket layout in case this is a Link Bucket.
- BucketLayout resolvedBucketLayout =
- OzoneClientUtils.resolveLinkBucketLayout(bucket, objectStore,
- new HashSet<>());
- return resolvedBucketLayout.isObjectStore(enableFileSystemPaths);
- } catch (IOException e) {
- System.out.println(
- "Bucket layout couldn't be resolved. Exception thrown: " + e);
- return false;
- }
- }
-
- /**
- * Checks if bucket is OBS bucket or if bucket is part of the path.
- * Return false if path is root, just a volume or invalid.
- * Returns false if bucket is part of path but not a OBS bucket.
- * @param path
- * @return true if bucket is OBS bucket or not part of provided path.
- */
- public boolean isNotValidBucketOrOBSBucket(String path) {
- OFSPath ofsPath = new OFSPath(path,
- OzoneConfiguration.of(getOzoneConfig()));
- try (OzoneClient ozoneClient =
OzoneClientFactory.getRpcClient(getOzoneConfig())) {
- ObjectStore objectStore = ozoneClient.getObjectStore();
- // Return false if path is root "/" or
- // contains just the volume and no bucket like "/volume"
- if (ofsPath.getVolumeName().isEmpty() ||
- ofsPath.getBucketName().isEmpty()) {
- return false;
- }
- // Checks if the bucket is part of the path.
- OzoneBucket bucket = objectStore.getVolume(ofsPath.getVolumeName())
- .getBucket(ofsPath.getBucketName());
- return isObjectStoreBucket(bucket, objectStore);
- } catch (IOException e) {
- System.out.println(
- "Bucket layout couldn't be verified for path: " + ofsPath +
- ". Exception: " + e);
- }
- return true;
- }
-
/**
* e.g. Input: "0.0.0.0:9891" -> Output: "0.0.0.0"
*/
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryCLIUtils.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryCLIUtils.java
index 9aff2e9999..1de6c74125 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryCLIUtils.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/NSSummaryCLIUtils.java
@@ -146,16 +146,6 @@ public static void printWithUnderline(String str, boolean
newLine) {
}
}
- public static void printBucketReminder() {
- printNewLines(1);
- System.out.println(
- "[Warning] Namespace CLI is not designed for OBS bucket layout.\n" +
- "Bucket being accessed must be of type FILE_SYSTEM_OPTIMIZED " +
- "bucket layout or \nLEGACY bucket layout with " +
- "'ozone.om.enable.filesystem.paths' set to true.");
- printNewLines(1);
- }
-
public static String parseInputPath(String path) {
if (!path.startsWith("ofs://")) {
return path;
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/QuotaUsageSubCommand.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/QuotaUsageSubCommand.java
index 1e4e719baf..16ed944c1d 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/QuotaUsageSubCommand.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/QuotaUsageSubCommand.java
@@ -27,7 +27,6 @@
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.makeHttpCall;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printEmptyPathRequest;
-import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printBucketReminder;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printKVSeparator;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printNewLines;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printPathNotFound;
@@ -80,10 +79,6 @@ public Void call() throws Exception {
} else if
("TYPE_NOT_APPLICABLE".equals(quotaResponse.path("status").asText())) {
printTypeNA("Quota");
} else {
- if (parent.isNotValidBucketOrOBSBucket(path)) {
- printBucketReminder();
- }
-
printWithUnderline("Quota", true);
long quotaAllowed = quotaResponse.get("allowed").asLong();
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/SummarySubCommand.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/SummarySubCommand.java
index d2060b8db5..4a28014445 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/SummarySubCommand.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/nssummary/SummarySubCommand.java
@@ -27,7 +27,6 @@
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.makeHttpCall;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.parseInputPath;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printEmptyPathRequest;
-import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printBucketReminder;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printKVSeparator;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printNewLines;
import static
org.apache.hadoop.ozone.admin.nssummary.NSSummaryCLIUtils.printPathNotFound;
@@ -76,10 +75,6 @@ public Void call() throws Exception {
if ("PATH_NOT_FOUND".equals(summaryResponse.path("status").asText())) {
printPathNotFound();
} else {
- if (parent.isNotValidBucketOrOBSBucket(path)) {
- printBucketReminder();
- }
-
printWithUnderline("Entity Type", false);
printKVSeparator();
System.out.println(summaryResponse.get("type"));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]