diff --git hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index 4b1c192..47acf51 100644 --- hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -477,7 +477,7 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<% snapshots.size() %> snapshot(s) in set.
+<% snapshots.size() %> snapshot(s) in set. [Snapshot Storefile stats]
%if> %def> diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java index c944fc4..cda4f64 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java @@ -23,10 +23,14 @@ import java.io.FileNotFoundException; import java.net.URI; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -126,6 +130,7 @@ public final class SnapshotInfo extends Configured implements Tool { private AtomicLong hfilesArchiveSize = new AtomicLong(); private AtomicLong hfilesSize = new AtomicLong(); private AtomicLong hfilesMobSize = new AtomicLong(); + private AtomicLong nonSharedHfilesArchiveSize = new AtomicLong(); private AtomicLong logSize = new AtomicLong(); private final HBaseProtos.SnapshotDescription snapshot; @@ -142,6 +147,16 @@ public final class SnapshotInfo extends Configured implements Tool { this.fs = fs; } + SnapshotStats(final Configuration conf, final FileSystem fs, + final HBaseProtos.SnapshotDescription snapshot) + { + this.snapshot = snapshot; + this.snapshotTable = TableName.valueOf(snapshot.getTable()); + this.conf = conf; + this.fs = fs; + } + + /** @return the snapshot descriptor */ public SnapshotDescription getSnapshotDescription() { return new SnapshotDescription(this.snapshot.getName(), this.snapshot.getTable(), @@ -207,6 +222,17 @@ public final class SnapshotInfo extends Configured implements Tool { /** @return the total size of the store files in the mob store*/ public long getMobStoreFilesSize() { return hfilesMobSize.get(); } + /** @return the total size of the store files in the archive which is not shared + * with other snapshots and tables + * + * This is only calculated when + * {@link #getSnapshotStats(Configuration, HBaseProtos.SnapshotDescription, Map)} + * is called with a non-null Map + */ + public long getNonSharedArchivedStoreFilesSize() { + return nonSharedHfilesArchiveSize.get(); + } + /** @return the percentage of the shared store files */ public float getSharedStoreFilePercentage() { return ((float) hfilesSize.get() / (getStoreFilesSize())) * 100; @@ -222,15 +248,46 @@ public final class SnapshotInfo extends Configured implements Tool { return logSize.get(); } + /** Check if for a give file in archive, if there are other snapshots/tables still + * reference it. + * @param filePath file path in archive + * @param snapshotFilesMap a map for store files in snapshots about how many snapshots refer + * to it. + * @return true or false + */ + private boolean isArchivedFileStillReferenced(final Path filePath, + final Map| Snapshot Name | +Table | +Creation Time | +Shared Storefile Size | +Mob Storefile Size | +Archived Storefile Size | +
|---|---|---|---|---|---|
| + <%= snapshotDesc.getName() %> | + <% + TableName snapshotTable = TableName.valueOf(snapshotDesc.getTable()); + SnapshotInfo.SnapshotStats stats = SnapshotInfo.getSnapshotStats(master.getConfiguration(), + snapshotDesc, filesMap); + totalUnsharedArchivedSize += stats.getNonSharedArchivedStoreFilesSize(); + %> ++ <%= snapshotTable.getNameAsString() %> | +<%= new Date(snapshotDesc.getCreationTime()) %> | +<%= StringUtils.humanReadableInt(stats.getSharedStoreFilesSize()) %> | +<%= StringUtils.humanReadableInt(stats.getMobStoreFilesSize()) %> | +<%= StringUtils.humanReadableInt(stats.getArchivedStoreFileSize()) %> + (<%= StringUtils.humanReadableInt(stats.getNonSharedArchivedStoreFilesSize()) %>) | +