From dbebcc9e2a3b15b075626b3a8c38057c674afb10 Mon Sep 17 00:00:00 2001 From: Cameron Zemek Date: Tue, 28 Aug 2018 15:44:11 +1000 Subject: [PATCH] Added deletion times to ic-sstables --- README.md | 1 + src/com/instaclustr/sstabletools/SSTableMetadata.java | 2 ++ src/com/instaclustr/sstabletools/SSTableMetadataCollector.java | 2 ++ .../instaclustr/sstabletools/cassandra/CassandraBackend.java | 1 + 4 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 0773109..10e770e 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ Print out sstable metadata for a column family. Useful in helping to tune compac | Min Timestamp | Minimum cell timestamp contained in the sstable | | Max Timestamp | Maximum cell timestamp contained in the sstable | | Duration | The time span between minimum and maximum cell timestamps | +| Max Deletion Time | The maximum deletion time | | Level | Leveled Tiered Compaction sstable level | | Keys | Number of partition keys | | Avg Partition Size | Average partition size | diff --git a/src/com/instaclustr/sstabletools/SSTableMetadata.java b/src/com/instaclustr/sstabletools/SSTableMetadata.java index 4995e8b..43f21fc 100644 --- a/src/com/instaclustr/sstabletools/SSTableMetadata.java +++ b/src/com/instaclustr/sstabletools/SSTableMetadata.java @@ -35,6 +35,8 @@ public int compare(SSTableMetadata o1, SSTableMetadata o2) { public long maxTimestamp; + public int maxLocalDeletionTime; + public long fileTimestamp; public long diskLength; diff --git a/src/com/instaclustr/sstabletools/SSTableMetadataCollector.java b/src/com/instaclustr/sstabletools/SSTableMetadataCollector.java index c1acd0c..1de9e68 100644 --- a/src/com/instaclustr/sstabletools/SSTableMetadataCollector.java +++ b/src/com/instaclustr/sstabletools/SSTableMetadataCollector.java @@ -53,6 +53,7 @@ public static void main(String[] args) { "Max Timestamp", "File Timestamp", "Duration", + "Max Deletion Time", "Level", "Keys", "Avg Partition Size", @@ -73,6 +74,7 @@ public static void main(String[] args) { Util.UTC_DATE_FORMAT.format(new Date(metadata.maxTimestamp / 1000)), Util.UTC_DATE_FORMAT.format(new Date(metadata.fileTimestamp)), Util.humanReadableDateDiff(metadata.minTimestamp / 1000, metadata.maxTimestamp / 1000), + metadata.maxLocalDeletionTime != Integer.MAX_VALUE ? Util.UTC_DATE_FORMAT.format(new Date(metadata.maxLocalDeletionTime * 1000L)) : "", Integer.toString(metadata.level), Long.toString(metadata.keys), Util.humanReadableByteCount(metadata.avgRowSize), diff --git a/src/com/instaclustr/sstabletools/cassandra/CassandraBackend.java b/src/com/instaclustr/sstabletools/cassandra/CassandraBackend.java index 205a3db..2f18871 100644 --- a/src/com/instaclustr/sstabletools/cassandra/CassandraBackend.java +++ b/src/com/instaclustr/sstabletools/cassandra/CassandraBackend.java @@ -91,6 +91,7 @@ public List getSSTableMetadata(String ksName, String cfName) { } tableMetadata.minTimestamp = table.getMinTimestamp(); tableMetadata.maxTimestamp = table.getMaxTimestamp(); + tableMetadata.maxLocalDeletionTime = table.getSSTableMetadata().maxLocalDeletionTime; tableMetadata.diskLength = table.onDiskLength(); tableMetadata.uncompressedLength = table.uncompressedLength(); tableMetadata.keys = table.estimatedKeys();