You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/12/12 07:05:12 UTC
[GitHub] [ozone] chungen0126 opened a new pull request, #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
chungen0126 opened a new pull request, #4065:
URL: https://github.com/apache/ozone/pull/4065
## What changes were proposed in this pull request?
1. Implement list snapshot API pagination.
2. Add some unit test.
3. Add some robot test.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-7507
## How was this patch tested?
Added unit test to `TestOmMetadataManager`.
Added robot test to `basic/ozone-shell-lib.robot.`
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on PR #4065:
URL: https://github.com/apache/ozone/pull/4065#issuecomment-1456780824
Thanks @chungen0126 for the patch. Thanks @DaveTeng0 @prashantpogde for reviewing this.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] prashantpogde commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "prashantpogde (via GitHub)" <gi...@apache.org>.
prashantpogde commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1109076755
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
+ * @param prevSnapshot snapshots will be listed after this snapshot name
Review Comment:
is prev snapshot snapshot chain order based on the snapshot creation time or snapshot name lexicographical order ?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1113689333
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1197,39 +1198,69 @@ public List<SnapshotInfo> listSnapshot(String volumeName, String bucketName)
BUCKET_NOT_FOUND);
}
- String prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
+ String prefix;
+ if (StringUtil.isNotBlank(snapshotPrefix)) {
+ prefix = getOzoneKey(volumeName, bucketName, snapshotPrefix);
+ } else {
+ prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
Review Comment:
or:
```suggestion
prefix = getOzoneKey(volumeName, bucketName, "");
```
?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1113689877
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1197,39 +1198,69 @@ public List<SnapshotInfo> listSnapshot(String volumeName, String bucketName)
BUCKET_NOT_FOUND);
}
- String prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
+ String prefix;
+ if (StringUtil.isNotBlank(snapshotPrefix)) {
+ prefix = getOzoneKey(volumeName, bucketName, snapshotPrefix);
+ } else {
+ prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
Review Comment:
Might be better to write it in:
```suggestion
prefix = getBucketKey(volumeName, bucketName) + OM_KEY_PREFIX;
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] prashantpogde commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "prashantpogde (via GitHub)" <gi...@apache.org>.
prashantpogde commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1109078576
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
Review Comment:
This is helpful to narrow down the list of snapshots if someone has create few thousand snapshots. Another parameter that could be helpful is to return snapshots that were created between two time timestamps. It doesn't have to be in this same PR though. You can file a separate Jira for that.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] DaveTeng0 commented on pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "DaveTeng0 (via GitHub)" <gi...@apache.org>.
DaveTeng0 commented on PR #4065:
URL: https://github.com/apache/ozone/pull/4065#issuecomment-1408290380
Hey @chungen0126 ! Just a heads-up that there are some conflicts~
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] chungen0126 commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1121185517
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
+ * @param prevSnapshot snapshots will be listed after this snapshot name
* @throws IOException
*/
- public List<OzoneSnapshot> listSnapshot(String volumeName, String bucketName)
- throws IOException {
- return proxy.listSnapshot(volumeName, bucketName);
+ public Iterator<? extends OzoneSnapshot> listSnapshot(
+ String volumeName, String bucketName, String snapshotPrefix,
+ String prevSnapshot) throws IOException {
+ return new SnapshotIterator(
+ volumeName, bucketName, snapshotPrefix, prevSnapshot);
+ }
+
+ /**
+ * An Iterator to iterate over {@link OzoneSnapshot} list.
+ */
+ private class SnapshotIterator implements Iterator<OzoneSnapshot> {
Review Comment:
`SnapshotIterator` as well as `OzoneVolume` is used in `ObjectStore`. Why should we move `SnapshotIterator` to `OzoneSnapshot`?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1113689877
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1197,39 +1198,69 @@ public List<SnapshotInfo> listSnapshot(String volumeName, String bucketName)
BUCKET_NOT_FOUND);
}
- String prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
+ String prefix;
+ if (StringUtil.isNotBlank(snapshotPrefix)) {
+ prefix = getOzoneKey(volumeName, bucketName, snapshotPrefix);
+ } else {
+ prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
Review Comment:
Might be clearer to write it in:
```suggestion
prefix = getBucketKey(volumeName, bucketName) + OM_KEY_PREFIX;
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1113597003
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
Review Comment:
> Another parameter that could be helpful is to return snapshots that were created between two time timestamps.
@prashantpogde We could have another overloaded `listSnapshot()` that takes such params in another jira.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1113602685
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
+ * @param prevSnapshot snapshots will be listed after this snapshot name
* @throws IOException
*/
- public List<OzoneSnapshot> listSnapshot(String volumeName, String bucketName)
- throws IOException {
- return proxy.listSnapshot(volumeName, bucketName);
+ public Iterator<? extends OzoneSnapshot> listSnapshot(
+ String volumeName, String bucketName, String snapshotPrefix,
+ String prevSnapshot) throws IOException {
+ return new SnapshotIterator(
+ volumeName, bucketName, snapshotPrefix, prevSnapshot);
+ }
+
+ /**
+ * An Iterator to iterate over {@link OzoneSnapshot} list.
+ */
+ private class SnapshotIterator implements Iterator<OzoneSnapshot> {
Review Comment:
Can we move this `SnapshotIterator` to `OzoneSnapshot`, just like `KeyIterator` in `OzoneBucket`?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] DaveTeng0 commented on pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "DaveTeng0 (via GitHub)" <gi...@apache.org>.
DaveTeng0 commented on PR #4065:
URL: https://github.com/apache/ozone/pull/4065#issuecomment-1408287537
Let's take a look~ (cc. @smengcl @hemantk-12 @swamirishi @aswinshakil @prashantpogde
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1113689877
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1197,39 +1198,69 @@ public List<SnapshotInfo> listSnapshot(String volumeName, String bucketName)
BUCKET_NOT_FOUND);
}
- String prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
+ String prefix;
+ if (StringUtil.isNotBlank(snapshotPrefix)) {
+ prefix = getOzoneKey(volumeName, bucketName, snapshotPrefix);
+ } else {
+ prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
Review Comment:
Logically it is clearer to write it in:
```suggestion
prefix = getBucketKey(volumeName, bucketName) + OM_KEY_PREFIX;
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] chungen0126 commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1121182244
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
+ * @param prevSnapshot snapshots will be listed after this snapshot name
Review Comment:
They are based on lexicographical order.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1122278614
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
+ * @param prevSnapshot snapshots will be listed after this snapshot name
* @throws IOException
*/
- public List<OzoneSnapshot> listSnapshot(String volumeName, String bucketName)
- throws IOException {
- return proxy.listSnapshot(volumeName, bucketName);
+ public Iterator<? extends OzoneSnapshot> listSnapshot(
+ String volumeName, String bucketName, String snapshotPrefix,
+ String prevSnapshot) throws IOException {
+ return new SnapshotIterator(
+ volumeName, bucketName, snapshotPrefix, prevSnapshot);
+ }
+
+ /**
+ * An Iterator to iterate over {@link OzoneSnapshot} list.
+ */
+ private class SnapshotIterator implements Iterator<OzoneSnapshot> {
Review Comment:
I see `VolumeIterator` in `ObjectStore`. Ok we can leave it here.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] prashantpogde commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "prashantpogde (via GitHub)" <gi...@apache.org>.
prashantpogde commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1109081015
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1197,39 +1198,69 @@ public List<SnapshotInfo> listSnapshot(String volumeName, String bucketName)
BUCKET_NOT_FOUND);
}
- String prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
+ String prefix;
+ if (StringUtil.isNotBlank(snapshotPrefix)) {
+ prefix = getOzoneKey(volumeName, bucketName, snapshotPrefix);
+ } else {
+ prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
+ }
+
+ String seek;
+ if (StringUtil.isNotBlank(prevSnapshot)) {
+ // Seek to the specified snapshot.
+ seek = getOzoneKey(volumeName, bucketName, prevSnapshot);
+ } else {
+ // This allows us to seek directly to the first key with the right prefix.
+ seek = getOzoneKey(volumeName, bucketName,
+ StringUtil.isNotBlank(
+ snapshotPrefix) ? snapshotPrefix : OM_KEY_PREFIX);
+ }
+
TreeMap<String, SnapshotInfo> snapshotInfoMap = new TreeMap<>();
- appendSnapshotFromCacheToMap(snapshotInfoMap, prefix);
- appendSnapshotFromDBToMap(snapshotInfoMap, prefix);
+ int count = appendSnapshotFromCacheToMap(
+ snapshotInfoMap, prefix, seek, maxListResult);
+ appendSnapshotFromDBToMap(
+ snapshotInfoMap, prefix, seek, count, maxListResult);
return new ArrayList<>(snapshotInfoMap.values());
}
- private void appendSnapshotFromCacheToMap(
- TreeMap snapshotInfoMap, String prefix) {
+ private int appendSnapshotFromCacheToMap(
+ TreeMap snapshotInfoMap, String prefix,
+ String previous, int maxListResult) {
+ int count = 0;
Iterator<Map.Entry<CacheKey<String>, CacheValue<SnapshotInfo>>> iterator =
snapshotInfoTable.cacheIterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext() && count < maxListResult) {
Map.Entry<CacheKey<String>, CacheValue<SnapshotInfo>> entry =
iterator.next();
String snapshotKey = entry.getKey().getCacheKey();
SnapshotInfo snapshotInfo = entry.getValue().getCacheValue();
- if (snapshotInfo != null && snapshotKey.startsWith(prefix)) {
+ if (snapshotInfo != null && snapshotKey.startsWith(prefix) &&
+ snapshotKey.compareTo(previous) > 0) {
snapshotInfoMap.put(snapshotKey, snapshotInfo);
+ count++;
}
}
+ return count;
}
- private void appendSnapshotFromDBToMap(TreeMap snapshotInfoMap, String prefix)
+ private void appendSnapshotFromDBToMap(TreeMap snapshotInfoMap,
+ String prefix, String previous,
+ int count, int maxListResult)
Review Comment:
We are just reading from the SnapshotInfo Table here. This may not necessarily be Snapshot creation order/. Can you please check this ?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] prashantpogde commented on a diff in pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "prashantpogde (via GitHub)" <gi...@apache.org>.
prashantpogde commented on code in PR #4065:
URL: https://github.com/apache/ozone/pull/4065#discussion_r1126883192
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/ObjectStore.java:
##########
@@ -551,14 +551,81 @@ public void deleteSnapshot(String volumeName,
/**
* List snapshots in a volume/bucket.
- * @param volumeName volume name
- * @param bucketName bucket name
- * @return list of snapshots for volume/bucket snapshotpath.
+ * @param volumeName volume name
+ * @param bucketName bucket name
+ * @param snapshotPrefix snapshot prefix to match
Review Comment:
Yup.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl merged pull request #4065: HDDS-7507. [Snapshot] Implement List Snapshot API Pagination
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl merged PR #4065:
URL: https://github.com/apache/ozone/pull/4065
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org