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 4ca8edb64a HDDS-10562. Fix infinite loop in ozone fs -ls /volume
(#6416)
4ca8edb64a is described below
commit 4ca8edb64aef0dcab39272aa156b2106be83d7c7
Author: Symious <[email protected]>
AuthorDate: Sun Mar 24 18:13:43 2024 +0800
HDDS-10562. Fix infinite loop in ozone fs -ls /volume (#6416)
---
.../hadoop/ozone/shell/TestOzoneShellHA.java | 30 ++++++++++++++++++++++
.../ozone/BasicRootedOzoneClientAdapterImpl.java | 4 +--
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
index ba36fa1d97..f86fd46946 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
@@ -23,6 +23,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -76,6 +77,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static
org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY;
import static org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY;
import static org.apache.hadoop.fs.FileSystem.TRASH_PREFIX;
+import static
org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_LISTING_PAGE_SIZE;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
@@ -753,6 +755,34 @@ public class TestOzoneShellHA {
}
}
+ @Test
+ @Timeout(10)
+ public void testListBucket() throws Exception {
+ final String hostPrefix = OZONE_OFS_URI_SCHEME + "://" + omServiceId;
+ OzoneConfiguration clientConf =
+ getClientConfForOFS(hostPrefix, cluster.getConf());
+ int pageSize = 20;
+ clientConf.setInt(OZONE_FS_LISTING_PAGE_SIZE, pageSize);
+ URI uri = FileSystem.getDefaultUri(clientConf);
+ clientConf.setBoolean(String.format("fs.%s.impl.disable.cache",
uri.getScheme()), true);
+ OzoneFsShell shell = new OzoneFsShell(clientConf);
+
+ String volName = "testlistbucket";
+ int numBuckets = pageSize;
+
+ try {
+ generateBuckets("/" + volName, numBuckets);
+ out.reset();
+ int res = ToolRunner.run(shell, new String[]{"-ls", "/" + volName});
+ assertEquals(0, res);
+ String r = out.toString(DEFAULT_ENCODING);
+ assertThat(r).matches("(?s)^Found " + numBuckets + " items.*");
+
+ } finally {
+ shell.close();
+ }
+ }
+
@Test
public void testDeleteTrashNoSkipTrash() throws Exception {
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 ce27fce8c1..3bbae134db 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
@@ -882,9 +882,9 @@ public class BasicRootedOzoneClientAdapterImpl
}
OFSPath ofsStartPath = new OFSPath(startPath, config);
if (ofsPath.isVolume()) {
- String startBucket = ofsStartPath.getBucketName();
+ String startBucketPath = ofsStartPath.getNonKeyPath();
return listStatusVolume(ofsPath.getVolumeName(),
- recursive, startBucket, numEntries, uri, workingDir, username);
+ recursive, startBucketPath, numEntries, uri, workingDir, username);
}
if (ofsPath.isSnapshotPath()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]