[
https://issues.apache.org/jira/browse/HDFS-15611?focusedWorklogId=493809&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-493809
]
ASF GitHub Bot logged work on HDFS-15611:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Oct/20 03:43
Start Date: 02/Oct/20 03:43
Worklog Time Spent: 10m
Work Description: szetszwo commented on a change in pull request #2355:
URL: https://github.com/apache/hadoop/pull/2355#discussion_r498605120
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
##########
@@ -1459,6 +1460,19 @@ SnapshotDiffReport decodeResponse(Map<?, ?> json) {
}.run();
}
+ public SnapshotStatus[] getSnapshotList(final Path snapshotDir)
Review comment:
In DistributedFileSystem, it is called
` public SnapshotStatus[] getSnapshotListing(Path snapshotRoot)`
Let's use the same name?
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotStatus.java
##########
@@ -25,6 +25,7 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hdfs.DFSUtilClient;
+import org.apache.hadoop.util.StringUtils;
Review comment:
Unused import.
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java
##########
@@ -1582,6 +1584,18 @@ public SnapshotDiffReport getSnapshotDiffReport(Path
path,
return JsonUtilClient.toSnapshottableDirectoryList(json);
}
+ public SnapshotStatus[] getSnapshotList(Path snapshotRoot)
Review comment:
It should call getSnapshotListing.
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java
##########
@@ -872,4 +873,39 @@ private static SnapshottableDirectoryStatus
toSnapshottableDirectoryStatus(
snapshotQuota, parentFullPath);
return snapshottableDirectoryStatus;
}
+
+ public static SnapshotStatus[] toSnapshotList(final Map<?, ?> json) {
+ if (json == null) {
+ return null;
+ }
+ List<?> list = (List<?>) json.get("SnapshotList");
+ if (list == null) {
+ return null;
+ }
+ SnapshotStatus[] statuses =
+ new SnapshotStatus[list.size()];
+ for (int i = 0; i < list.size(); i++) {
+ statuses[i] = toSnapshotStatus((Map<?, ?>) list.get(i));
+ }
+ return statuses;
+ }
+
+ private static SnapshotStatus toSnapshotStatus(
+ Map<?, ?> json) {
+ if (json == null) {
+ return null;
+ }
+ int snapshotID = getInt(json, "snapshotID", 0);
+ boolean isDeleted = ((String)json.get("deletionStatus")).
+ contentEquals("DELETED");
Review comment:
Use "DELETED".equal(..) in order to avoid NPE?
` final boolean isDeleted = "DELETED".equals(json.get("deletionStatus"));`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 493809)
Time Spent: 20m (was: 10m)
> Add list Snapshot command in WebHDFS
> ------------------------------------
>
> Key: HDFS-15611
> URL: https://issues.apache.org/jira/browse/HDFS-15611
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: snapshots
> Reporter: Shashikant Banerjee
> Assignee: Shashikant Banerjee
> Priority: Major
> Labels: pull-request-available
> Fix For: 3.4.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Idea here is to expose lsSnapshot cmd over WebHdfs.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]