swamirishi commented on code in PR #7431:
URL: https://github.com/apache/ozone/pull/7431#discussion_r1846937353
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java:
##########
@@ -938,25 +938,27 @@ private List<FileStatusAdapter> listStatusAdapter(Path f,
boolean lite) throws I
LinkedList<FileStatusAdapter> statuses = new LinkedList<>();
List<FileStatusAdapter> tmpStatusList;
String startPath = "";
-
+ int entriesAdded;
do {
tmpStatusList =
adapter.listStatus(pathToKey(f), false, startPath,
numEntries, uri, workingDir, getUsername(), lite);
-
+ entriesAdded = 0;
if (!tmpStatusList.isEmpty()) {
if (startPath.isEmpty() || !statuses.getLast().getPath().toString()
.equals(tmpStatusList.get(0).getPath().toString())) {
statuses.addAll(tmpStatusList);
+ entriesAdded += tmpStatusList.size();
} else {
statuses.addAll(tmpStatusList.subList(1, tmpStatusList.size()));
+ entriesAdded += tmpStatusList.size() - 1;
}
startPath = pathToKey(statuses.getLast().getPath());
}
// listStatus returns entries numEntries in size if available.
// Any lesser number of entries indicate that the required entries have
// exhausted.
- } while (tmpStatusList.size() == numEntries);
+ } while (entriesAdded > 0);
Review Comment:
Consider another case where we are passing startKey and that is the last
key. We would get that in the result and we would be stuck in an infinite loop.
--
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]