use of org.apache.cassandra.io.sstable.metadata.StatsMetadata in project cassandra by apache.
the class SSTableMetadataTrackingTest method testTrackMetadata_rangeTombstone.
@Test
public void testTrackMetadata_rangeTombstone() throws Throwable {
createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, b)) WITH gc_grace_seconds = 10000");
ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1 and b = 1");
cfs.forceBlockingFlush();
assertEquals(1, cfs.getLiveSSTables().size());
StatsMetadata metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(9999, metadata.minTimestamp);
assertEquals(9999, metadata.maxTimestamp);
assertEquals(System.currentTimeMillis() / 1000, metadata.maxLocalDeletionTime, 5);
cfs.forceMajorCompaction();
StatsMetadata metadata2 = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(metadata.maxLocalDeletionTime, metadata2.maxLocalDeletionTime);
assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
}
use of org.apache.cassandra.io.sstable.metadata.StatsMetadata in project cassandra by apache.
the class SSTableMetadataTrackingTest method testTrackMetadata_rowMarker.
@Test
public void testTrackMetadata_rowMarker() throws Throwable {
createTable("CREATE TABLE %s (a int, PRIMARY KEY (a))");
ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
execute("INSERT INTO %s (a) VALUES (1) USING TIMESTAMP 9999");
cfs.forceBlockingFlush();
assertEquals(1, cfs.getLiveSSTables().size());
StatsMetadata metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(9999, metadata.minTimestamp);
assertEquals(9999, metadata.maxTimestamp);
assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime);
cfs.forceMajorCompaction();
StatsMetadata metadata2 = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(metadata.maxLocalDeletionTime, metadata2.maxLocalDeletionTime);
assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
}
use of org.apache.cassandra.io.sstable.metadata.StatsMetadata in project cassandra by apache.
the class SSTableMetadataTrackingTest method baseCheck.
@Test
public void baseCheck() 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 9999");
cfs.forceBlockingFlush();
StatsMetadata metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(9999, metadata.minTimestamp);
assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime);
cfs.forceMajorCompaction();
metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(9999, metadata.minTimestamp);
assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime);
}
use of org.apache.cassandra.io.sstable.metadata.StatsMetadata in project cassandra by apache.
the class SSTableMetadataTrackingTest method testTrackMetadata_rowTombstone.
@Test
public void testTrackMetadata_rowTombstone() throws Throwable {
createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, b))");
ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1");
cfs.forceBlockingFlush();
assertEquals(1, cfs.getLiveSSTables().size());
StatsMetadata metadata = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(9999, metadata.minTimestamp);
assertEquals(9999, metadata.maxTimestamp);
assertEquals(System.currentTimeMillis() / 1000, metadata.maxLocalDeletionTime, 5);
cfs.forceMajorCompaction();
StatsMetadata metadata2 = cfs.getLiveSSTables().iterator().next().getSSTableMetadata();
assertEquals(metadata.maxLocalDeletionTime, metadata2.maxLocalDeletionTime);
assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
}
use of org.apache.cassandra.io.sstable.metadata.StatsMetadata in project cassandra by apache.
the class SSTableMetadataTrackingTest method testMinMaxtimestampRange.
@Test
public void testMinMaxtimestampRange() 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 and b = 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);
}
Aggregations