guluo2016 commented on code in PR #8403:
URL: https://github.com/apache/hbase/pull/8403#discussion_r3466295670
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java:
##########
@@ -391,11 +397,17 @@ public int doWork() throws IOException,
InterruptedException {
// List Available Snapshots
if (listSnapshots) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- System.out.printf("%-20s | %-20s | %-20s | %s%n", "SNAPSHOT", "CREATION
TIME", "TTL IN SEC",
- "TABLE NAME");
- for (SnapshotDescription desc : getSnapshotList(conf)) {
- System.out.printf("%-20s | %20s | %20s | %s%n", desc.getName(),
- df.format(new Date(desc.getCreationTime())), desc.getTtl(),
desc.getTableNameAsString());
+ List<SnapshotDescription> snapshotDescriptions = getSnapshotList(conf);
+ System.out.printf("%-20s | %-20s | %-20s | %-20s | %s%n", "SNAPSHOT",
"CREATION TIME",
+ "TTL(Sec)", "EXPIRED", "TABLE NAME");
+ for (SnapshotDescription desc : snapshotDescriptions) {
+ String ttlInfo =
+ desc.getTtl() == DEFAULT_SNAPSHOT_TTL ? TTL_FOREVER :
String.valueOf(desc.getTtl());
+ String expired =
SnapshotDescriptionUtils.isExpiredSnapshot(desc.getTtl(),
+ desc.getCreationTime(), System.currentTimeMillis()) ? EXPIRED_LABEL
: NOT_EXPIRED_LABEL;
Review Comment:
Good catch. Let me move it outside the loop, thanks
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]