cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject git commit: Account for range and row tombstones in tombstone drop time histogram.
Date Thu, 06 Feb 2014 07:58:51 GMT
Updated Branches:
  refs/heads/cassandra-2.0 e59ef16bf -> 9fb44ee55


Account for range and row tombstones in tombstone drop time histogram.

Patch by marcuse, reviewed by jbellis for CASSANDRA-6522


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9fb44ee5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9fb44ee5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9fb44ee5

Branch: refs/heads/cassandra-2.0
Commit: 9fb44ee55bd14043f307cc320ecc277010a42953
Parents: e59ef16
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Thu Feb 6 08:13:24 2014 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Thu Feb 6 08:52:07 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/db/ColumnFamily.java   | 10 ++++++
 .../db/compaction/LazilyCompactedRow.java       | 10 +++++-
 .../cassandra/io/sstable/SSTableWriter.java     | 10 ++++++
 .../cassandra/tools/SSTableMetadataViewer.java  | 36 ++++++++++++++------
 4 files changed, 54 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb44ee5/src/java/org/apache/cassandra/db/ColumnFamily.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamily.java b/src/java/org/apache/cassandra/db/ColumnFamily.java
index 2c00071..ec6a395 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamily.java
@@ -418,6 +418,16 @@ public abstract class ColumnFamily implements Iterable<Column>,
IRowCacheEntry
         int maxLocalDeletionTime = Integer.MIN_VALUE;
         List<ByteBuffer> minColumnNamesSeen = Collections.emptyList();
         List<ByteBuffer> maxColumnNamesSeen = Collections.emptyList();
+
+        if (deletionInfo().getTopLevelDeletion().localDeletionTime < Integer.MAX_VALUE)
+            tombstones.update(deletionInfo().getTopLevelDeletion().localDeletionTime);
+        Iterator<RangeTombstone> it = deletionInfo().rangeIterator();
+        while (it.hasNext())
+        {
+            RangeTombstone rangeTombstone = it.next();
+            tombstones.update(rangeTombstone.getLocalDeletionTime());
+        }
+
         for (Column column : this)
         {
             minTimestampSeen = Math.min(minTimestampSeen, column.minTimestamp());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb44ee5/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
index 998f8cc..e10fb2c 100644
--- a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
+++ b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
@@ -275,7 +275,15 @@ public class LazilyCompactedRow extends AbstractCompactedRow implements
Iterable
                     indexer.remove(reduced);
                     return null;
                 }
-
+                int localDeletionTime = purged.deletionInfo().getTopLevelDeletion().localDeletionTime;
+                if (localDeletionTime < Integer.MAX_VALUE)
+                    tombstones.update(localDeletionTime);
+                Iterator<RangeTombstone> rangeTombstoneIterator = purged.deletionInfo().rangeIterator();
+                while (rangeTombstoneIterator.hasNext())
+                {
+                    RangeTombstone rangeTombstone = rangeTombstoneIterator.next();
+                    tombstones.update(rangeTombstone.getLocalDeletionTime());
+                }
                 columns++;
                 minTimestampSeen = Math.min(minTimestampSeen, reduced.minTimestamp());
                 maxTimestampSeen = Math.max(maxTimestampSeen, reduced.maxTimestamp());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb44ee5/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index 81b3c27..6528ced 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -235,6 +235,16 @@ public class SSTableWriter extends SSTable
         if (version.hasRowSizeAndColumnCount)
             columnCount = in.readInt();
 
+        if (cf.deletionInfo().getTopLevelDeletion().localDeletionTime < Integer.MAX_VALUE)
+            tombstones.update(cf.deletionInfo().getTopLevelDeletion().localDeletionTime);
+
+        Iterator<RangeTombstone> rangeTombstoneIterator = cf.deletionInfo().rangeIterator();
+        while (rangeTombstoneIterator.hasNext())
+        {
+            RangeTombstone rangeTombstone = rangeTombstoneIterator.next();
+            tombstones.update(rangeTombstone.getLocalDeletionTime());
+        }
+
         Iterator<OnDiskAtom> iter = metadata.getOnDiskIterator(in, columnCount, ColumnSerializer.Flag.PRESERVE_SIZE,
Integer.MIN_VALUE, version);
         try
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb44ee5/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
index 5cfd778..64720b5 100644
--- a/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
+++ b/src/java/org/apache/cassandra/tools/SSTableMetadataViewer.java
@@ -17,8 +17,10 @@
  */
 package org.apache.cassandra.tools;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.util.Map;
 
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTableMetadata;
@@ -42,18 +44,30 @@ public class SSTableMetadataViewer
 
         for (String fname : args)
         {
-            Descriptor descriptor = Descriptor.fromFilename(fname);
-            SSTableMetadata metadata = SSTableMetadata.serializer.deserialize(descriptor).left;
+            if (new File(fname).exists())
+            {
+                Descriptor descriptor = Descriptor.fromFilename(fname);
+                SSTableMetadata metadata = SSTableMetadata.serializer.deserialize(descriptor).left;
 
-            out.printf("SSTable: %s%n", descriptor);
-            out.printf("Partitioner: %s%n", metadata.partitioner);
-            out.printf("Maximum timestamp: %s%n", metadata.maxTimestamp);
-            out.printf("SSTable max local deletion time: %s%n", metadata.maxLocalDeletionTime);
-            out.printf("Compression ratio: %s%n", metadata.compressionRatio);
-            out.printf("Estimated droppable tombstones: %s%n", metadata.getEstimatedDroppableTombstoneRatio((int)
(System.currentTimeMillis() / 1000)));
-            out.printf("SSTable Level: %d%n", metadata.sstableLevel);
-            out.println(metadata.replayPosition);
-            printHistograms(metadata, out);
+                out.printf("SSTable: %s%n", descriptor);
+                out.printf("Partitioner: %s%n", metadata.partitioner);
+                out.printf("Maximum timestamp: %s%n", metadata.maxTimestamp);
+                out.printf("SSTable max local deletion time: %s%n", metadata.maxLocalDeletionTime);
+                out.printf("Compression ratio: %s%n", metadata.compressionRatio);
+                out.printf("Estimated droppable tombstones: %s%n", metadata.getEstimatedDroppableTombstoneRatio((int)
(System.currentTimeMillis() / 1000)));
+                out.printf("SSTable Level: %d%n", metadata.sstableLevel);
+                out.println(metadata.replayPosition);
+                printHistograms(metadata, out);
+                out.println("Estimated tombstone drop times:");
+                for (Map.Entry<Double, Long> entry : metadata.estimatedTombstoneDropTime.getAsMap().entrySet())
+                {
+                    out.printf("%-10s:%10s%n",entry.getKey().intValue(), entry.getValue());
+                }
+            }
+            else
+            {
+                out.println("No such file: " + fname);
+            }
         }
     }
 


Mime
View raw message