HDFS-15496. Add UI for deleted snapshots (#2212)
This commit is contained in:
parent
4a400d3193
commit
cb50e3fcf7
@ -174,60 +174,6 @@ private static int maxLength(int n, Object value) {
|
|||||||
return Math.max(n, String.valueOf(value).length());
|
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,
|
static String getSnapshotPath(String snapshottableDir,
|
||||||
String snapshotRelativePath) {
|
String snapshotRelativePath) {
|
||||||
String parentFullPathStr =
|
String parentFullPathStr =
|
||||||
|
@ -82,18 +82,20 @@ public String toString() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Bean {
|
public static class Bean {
|
||||||
private final String snapshotID;
|
private final int snapshotID;
|
||||||
private final String snapshotDirectory;
|
private final String snapshotDirectory;
|
||||||
private final long modificationTime;
|
private final long modificationTime;
|
||||||
|
private final String status;
|
||||||
|
|
||||||
public Bean(String snapshotID, String snapshotDirectory,
|
public Bean(int snapshotID, String snapshotDirectory,
|
||||||
long modificationTime) {
|
long modificationTime, boolean isMarkedAsDeleted) {
|
||||||
this.snapshotID = snapshotID;
|
this.snapshotID = snapshotID;
|
||||||
this.snapshotDirectory = snapshotDirectory;
|
this.snapshotDirectory = snapshotDirectory;
|
||||||
this.modificationTime = modificationTime;
|
this.modificationTime = modificationTime;
|
||||||
|
this.status = isMarkedAsDeleted ? "DELETED" : "ACTIVE";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSnapshotID() {
|
public int getSnapshotID() {
|
||||||
return snapshotID;
|
return snapshotID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,5 +106,9 @@ public String getSnapshotDirectory() {
|
|||||||
public long getModificationTime() {
|
public long getModificationTime() {
|
||||||
return modificationTime;
|
return modificationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -746,16 +746,19 @@ public static SnapshottableDirectoryStatus.Bean toBean(INodeDirectory d) {
|
|||||||
d.getDirectorySnapshottableFeature().getNumSnapshots(),
|
d.getDirectorySnapshottableFeature().getNumSnapshots(),
|
||||||
d.getDirectorySnapshottableFeature().getSnapshotQuota(),
|
d.getDirectorySnapshottableFeature().getSnapshotQuota(),
|
||||||
d.getModificationTime(),
|
d.getModificationTime(),
|
||||||
Short.valueOf(Integer.toOctalString(
|
Short.parseShort(Integer.toOctalString(d.getFsPermissionShort())),
|
||||||
d.getFsPermissionShort())),
|
|
||||||
d.getUserName(),
|
d.getUserName(),
|
||||||
d.getGroupName());
|
d.getGroupName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SnapshotInfo.Bean toBean(Snapshot s) {
|
public static SnapshotInfo.Bean toBean(Snapshot s) {
|
||||||
|
Snapshot.Root dir = s.getRoot();
|
||||||
return new SnapshotInfo.Bean(
|
return new SnapshotInfo.Bean(
|
||||||
s.getRoot().getLocalName(), s.getRoot().getFullPathName(),
|
s.getId(),
|
||||||
s.getRoot().getModificationTime());
|
dir.getFullPathName(),
|
||||||
|
dir.getModificationTime(),
|
||||||
|
dir.isMarkedAsDeleted()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<INodeDirectory> getSnapshottableDirsForGc() {
|
private List<INodeDirectory> getSnapshottableDirsForGc() {
|
||||||
|
@ -287,6 +287,7 @@
|
|||||||
<th>Snapshot ID</th>
|
<th>Snapshot ID</th>
|
||||||
<th>Snapshot Directory</th>
|
<th>Snapshot Directory</th>
|
||||||
<th>Modification Time</th>
|
<th>Modification Time</th>
|
||||||
|
<th>Status</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{#Snapshots}
|
{#Snapshots}
|
||||||
@ -294,6 +295,7 @@
|
|||||||
<td>{snapshotID}</td>
|
<td>{snapshotID}</td>
|
||||||
<td>{snapshotDirectory}</td>
|
<td>{snapshotDirectory}</td>
|
||||||
<td>{modificationTime|date_tostring}</td>
|
<td>{modificationTime|date_tostring}</td>
|
||||||
|
<td>{status}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/Snapshots}
|
{/Snapshots}
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user