This is an automated email from the ASF dual-hosted git repository.
shashikant pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new cb50e3f HDFS-15496. Add UI for deleted snapshots (#2212)
cb50e3f is described below
commit cb50e3fcf70f8d5cb30238e96f87f9d6e2f2260a
Author: Vivek Ratnavel Subramanian <[email protected]>
AuthorDate: Thu Aug 13 10:06:15 2020 -0700
HDFS-15496. Add UI for deleted snapshots (#2212)
---
.../hadoop/hdfs/protocol/SnapshotStatus.java | 54 ----------------------
.../apache/hadoop/hdfs/protocol/SnapshotInfo.java | 14 ++++--
.../server/namenode/snapshot/SnapshotManager.java | 11 +++--
.../src/main/webapps/hdfs/dfshealth.html | 2 +
4 files changed, 19 insertions(+), 62 deletions(-)
diff --git
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotStatus.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotStatus.java
index 8c0dabd..3e2a7ae 100644
---
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotStatus.java
+++
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotStatus.java
@@ -174,60 +174,6 @@ public class SnapshotStatus {
return Math.max(n, String.valueOf(value).length());
}
- /**
- * To be used to for collection of snapshot jmx.
- */
- public static class Bean {
- private final String path;
- private final int snapshotID;
- private final long modificationTime;
- private final short permission;
- private final String owner;
- private final String group;
- private final boolean isDeleted;
-
-
- public Bean(String path, int snapshotID, long
- modificationTime, short permission, String owner, String group,
- boolean isDeleted) {
- this.path = path;
- this.snapshotID = snapshotID;
- this.modificationTime = modificationTime;
- this.permission = permission;
- this.owner = owner;
- this.group = group;
- this.isDeleted = isDeleted;
- }
-
- public String getPath() {
- return path;
- }
-
- public int getSnapshotID() {
- return snapshotID;
- }
-
- public long getModificationTime() {
- return modificationTime;
- }
-
- public short getPermission() {
- return permission;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public String getGroup() {
- return group;
- }
-
- public boolean isDeleted() {
- return isDeleted;
- }
- }
-
static String getSnapshotPath(String snapshottableDir,
String snapshotRelativePath) {
String parentFullPathStr =
diff --git
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotInfo.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotInfo.java
index 676e827..ef54778 100644
---
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotInfo.java
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/SnapshotInfo.java
@@ -82,18 +82,20 @@ public class SnapshotInfo {
}
public static class Bean {
- private final String snapshotID;
+ private final int snapshotID;
private final String snapshotDirectory;
private final long modificationTime;
+ private final String status;
- public Bean(String snapshotID, String snapshotDirectory,
- long modificationTime) {
+ public Bean(int snapshotID, String snapshotDirectory,
+ long modificationTime, boolean isMarkedAsDeleted) {
this.snapshotID = snapshotID;
this.snapshotDirectory = snapshotDirectory;
this.modificationTime = modificationTime;
+ this.status = isMarkedAsDeleted ? "DELETED" : "ACTIVE";
}
- public String getSnapshotID() {
+ public int getSnapshotID() {
return snapshotID;
}
@@ -104,5 +106,9 @@ public class SnapshotInfo {
public long getModificationTime() {
return modificationTime;
}
+
+ public String getStatus() {
+ return status;
+ }
}
}
diff --git
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java
index 7569fc6..3866125 100644
---
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java
+++
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java
@@ -746,16 +746,19 @@ public class SnapshotManager implements
SnapshotStatsMXBean {
d.getDirectorySnapshottableFeature().getNumSnapshots(),
d.getDirectorySnapshottableFeature().getSnapshotQuota(),
d.getModificationTime(),
- Short.valueOf(Integer.toOctalString(
- d.getFsPermissionShort())),
+ Short.parseShort(Integer.toOctalString(d.getFsPermissionShort())),
d.getUserName(),
d.getGroupName());
}
public static SnapshotInfo.Bean toBean(Snapshot s) {
+ Snapshot.Root dir = s.getRoot();
return new SnapshotInfo.Bean(
- s.getRoot().getLocalName(), s.getRoot().getFullPathName(),
- s.getRoot().getModificationTime());
+ s.getId(),
+ dir.getFullPathName(),
+ dir.getModificationTime(),
+ dir.isMarkedAsDeleted()
+ );
}
private List<INodeDirectory> getSnapshottableDirsForGc() {
diff --git
a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
index fcf4e0d..8b03185 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
@@ -287,6 +287,7 @@
<th>Snapshot ID</th>
<th>Snapshot Directory</th>
<th>Modification Time</th>
+ <th>Status</th>
</tr>
</thead>
{#Snapshots}
@@ -294,6 +295,7 @@
<td>{snapshotID}</td>
<td>{snapshotDirectory}</td>
<td>{modificationTime|date_tostring}</td>
+ <td>{status}</td>
</tr>
{/Snapshots}
</table>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]