Search in sources :

Example 16 with StatsMetadata

use of org.apache.cassandra.io.sstable.metadata.StatsMetadata in project cassandra by apache.

the class SSTableMetadataTrackingTest method testMinMaxtimestampRow.

@Test
public void testMinMaxtimestampRow() throws Throwable {
    createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, b))");
    ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
    execute("INSERT INTO %s (a,b,c) VALUES (1,1,'1') using timestamp 10000");
    execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1");
    cfs.forceBlockingFlush();
    StatsMetadata metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
    assertEquals(9999, metadata.minTimestamp);
    assertEquals(10000, metadata.maxTimestamp);
    assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime, 5);
    cfs.forceMajorCompaction();
    metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
    assertEquals(9999, metadata.minTimestamp);
    assertEquals(10000, metadata.maxTimestamp);
    assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime, 5);
}
Also used : StatsMetadata(org.apache.cassandra.io.sstable.metadata.StatsMetadata) ColumnFamilyStore(org.apache.cassandra.db.ColumnFamilyStore) Test(org.junit.Test)

Aggregations

StatsMetadata (org.apache.cassandra.io.sstable.metadata.StatsMetadata)16 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)8 Test (org.junit.Test)7 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)6 File (java.io.File)3 RandomAccessFile (java.io.RandomAccessFile)2 ByteBuffer (java.nio.ByteBuffer)2 CompressedSequentialWriter (org.apache.cassandra.io.compress.CompressedSequentialWriter)2 Descriptor (org.apache.cassandra.io.sstable.Descriptor)2 MetadataCollector (org.apache.cassandra.io.sstable.metadata.MetadataCollector)2 AlwaysPresentFilter (org.apache.cassandra.utils.AlwaysPresentFilter)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Throwables (com.google.common.base.Throwables)1 java.io (java.io)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1 java.util (java.util)1 Map (java.util.Map)1 Set (java.util.Set)1 DatabaseDescriptor (org.apache.cassandra.config.DatabaseDescriptor)1