[ 
https://issues.apache.org/jira/browse/HDFS-5196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13946835#comment-13946835
 ] 

Haohui Mai commented on HDFS-5196:
----------------------------------

{code}
+public interface SnapshotStatsMXBean {
+
+  /**
+   * Return the list of snapshottable directories
+   * 
+   * @return the list of snapshottable directories
+   */
+  public SnapshotDirectoryMXBean getSnapshotStats();
+}

+  public class SnapshotDirectoryMXBean {
+    private List<SnapshottableDirectoryStatus.Bean> directory =
+        new ArrayList<SnapshottableDirectoryStatus.Bean>();
+    private List<SnapshotInfo.Bean> snapshots =
+        new ArrayList<SnapshotInfo.Bean>();
+    
+    public SnapshotDirectoryMXBean(SnapshottableDirectoryStatus[] stats) {
+      set(stats);
+    }
+    
+    public void set(SnapshottableDirectoryStatus[] stats) {
+      for (SnapshottableDirectoryStatus s : stats) {
+        directory.add(new SnapshottableDirectoryStatus.Bean(s));
+        try {
+          for (Snapshot shot : getSnapshottableRoot(
+              s.getFullPath().toString()).getSnapshotList()) {
+            snapshots.add(new SnapshotInfo.Bean(shot));
+          }
+        } catch (IOException e) {
+          continue;
+        }
+      }
+    }
+    
+    public List<SnapshottableDirectoryStatus.Bean> getDirectory() {
+      return directory;
+    }
+    
+    public List<SnapshotInfo.Bean> getSnapshots() {
+      return snapshots;
+    }
+  }
{code}

I guess I didn't explain it clearly. What I was saying was to move 
{{SnapshotInfo.Bean}} and {{SnapshottableDirectoryStatus.Bean}} into 
{{SnapshotStatsMXBean}}, not to create a new layer of indirection by putting 
{{SnapshotDirectoryMXBean}} in {{SnapshotStatsMXBean}}. However, I think we can 
address it in a separate jira. I'll file a new jira to track it.

+1. I'll commit it shortly.

> Provide more snapshot information in WebUI
> ------------------------------------------
>
>                 Key: HDFS-5196
>                 URL: https://issues.apache.org/jira/browse/HDFS-5196
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: snapshots
>    Affects Versions: 3.0.0
>            Reporter: Haohui Mai
>            Assignee: Shinichi Yamashita
>            Priority: Minor
>         Attachments: HDFS-5196-2.patch, HDFS-5196-3.patch, HDFS-5196-4.patch, 
> HDFS-5196-5.patch, HDFS-5196-6.patch, HDFS-5196-7.patch, HDFS-5196-8.patch, 
> HDFS-5196-9.patch, HDFS-5196-9.patch, HDFS-5196.patch, HDFS-5196.patch, 
> HDFS-5196.patch, snapshot-new-webui.png, snapshottable-directoryList.png, 
> snapshotteddir.png
>
>
> The WebUI should provide more detailed information about snapshots, such as 
> all snapshottable directories and corresponding number of snapshots 
> (suggested in HDFS-4096).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to