-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10562. Fix endless loop in ozone fs -ls #6416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2d1d3fa
f64435d
0e16075
4685e86
6d49531
71bd923
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |||||
| 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 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 void testLinkBucketOrphan() throws Exception { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| @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; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adoroszlai I wonder if there is a timeout wrapper on some code block in unit test, so that it can fail fast?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Lines 72 to 73 in 97038ef
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adoroszlai Thanks for the advice. Updated, PTAL. I was also wondering if there is something like
|
||||||
|
|
||||||
| 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 { | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -882,9 +882,9 @@ public List<FileStatusAdapter> listStatus(String pathStr, boolean recursive, | |
| } | ||
| 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); | ||
|
Comment on lines
+885
to
+887
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest changing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, all the following methods are using String as parameter, maybe we can align to use String here or it might confuse people more? |
||
| } | ||
|
|
||
| if (ofsPath.isSnapshotPath()) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.