-
Notifications
You must be signed in to change notification settings - Fork 502
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
HDDS-2779. Fix list volume for --start parameter #385
Conversation
if(!currentIterator.hasNext()) { | ||
currentIterator = getNextListOfVolumes( | ||
currentValue != null ? currentValue.getName() : null) | ||
.iterator(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this logic, remote iteration will not work. Removing this will break the listVolume
call if we try to list more than 1000 (ozone.client.list.cache
) volumes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nandakumar131 for this important info.
I deleted the block cause it would lead infinitely loop when I test listVolumes
on my cluster.
I'm going to fix it. (without deleting it.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with checking existed volume.
And work well in listing more than 1000 volumes with the same user.
boolean startKeyFound = Strings.isNullOrEmpty(startKey); | ||
if (!startKeyFound) { | ||
OmVolumeArgs startVolArgs = getVolumeTable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break the case where the user provides "/" at the start of volume name, we should also handle that case.
if (startVolArgs == null) { | ||
throw new OMException("StartVolume info not found for " + startKey, | ||
ResultCodes.VOLUME_NOT_FOUND); | ||
} else if (!startKey.startsWith(prefix)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also handle cases where the startKey
doesn't match the given prefix.
Thanks @cxorm for working on this. Suggestion:
|
Thanks @nandakumar131 for the suggestion. |
Sorry, there is something wrong when I test. |
This reverts commit 1925ffb.
After fixing So here we let the Fixed, and ran on my standalone cluster. |
The proper fix is to not return the |
index = volumes.indexOf( | ||
startKey.startsWith(OzoneConsts.OM_KEY_PREFIX) ? | ||
startKey.substring(1) : | ||
startKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add index = index != -1 ? index + 1 : index;
at line 826 to make sure that the startKey
is not part of the returned result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, hopefully we don't need the changes made in ObjectStore
class. Things should work as expected.
Thanks @nandakumar131 for the review.
Sorry about a little question, |
Thanks @cxorm for digging it. Yes, we should fix it. |
Thanks @nandakumar131 for the comment. I think the The first round of So fix was addressed this part. (The same as listing buckets, I'm going to create a Jira for it.) |
Let's discuss the list --start behavior on slack. |
Thanks @xiaoyuyao for the comment. |
Makes sense, thanks for fixing it. |
Thanks @cxorm for the contribution and thanks @xiaoyuyao for the review. I will merge this shortly. |
Thanks @nandakumar131 and @xiaoyuyao for the reviews. |
What changes were proposed in this pull request?
This PR was created to let
--start
work well in listing volume.(In command
ozone sh vol list --start=<startVolume>
)What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-2779
How was this patch tested?