use of org.apache.cassandra.db.ColumnFamilyStore 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);
}
use of org.apache.cassandra.db.ColumnFamilyStore in project cassandra by apache.
the class SSTablesIteratedTest method executeAndCheck.
private void executeAndCheck(String query, int numSSTables, Object[]... rows) throws Throwable {
ColumnFamilyStore cfs = getCurrentColumnFamilyStore(KEYSPACE_PER_TEST);
// resets counts
((ClearableHistogram) cfs.metric.sstablesPerReadHistogram.cf).clear();
assertRows(execute(query), rows);
// max sstables read
long numSSTablesIterated = cfs.metric.sstablesPerReadHistogram.cf.getSnapshot().getMax();
assertEquals(String.format("Expected %d sstables iterated but got %d instead, with %d live sstables", numSSTables, numSSTablesIterated, cfs.getLiveSSTables().size()), numSSTables, numSSTablesIterated);
}
use of org.apache.cassandra.db.ColumnFamilyStore in project cassandra by apache.
the class DeleteTest method isMemtableEmpty.
/**
* Checks if the memtable is empty or not
* @return {@code true} if the memtable is empty, {@code false} otherwise.
*/
private boolean isMemtableEmpty() {
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(currentTable());
return cfs.metric.allMemtablesLiveDataSize.getValue() == 0;
}
use of org.apache.cassandra.db.ColumnFamilyStore in project cassandra by apache.
the class UpdateTest method isMemtableEmpty.
/**
* Checks if the memtable is empty or not
* @return {@code true} if the memtable is empty, {@code false} otherwise.
*/
private boolean isMemtableEmpty() {
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(currentTable());
return cfs.metric.allMemtablesLiveDataSize.getValue() == 0;
}
use of org.apache.cassandra.db.ColumnFamilyStore in project cassandra by apache.
the class AlterTest method testAlterIndexInterval.
@Test
public // tests CASSANDRA-7976
void testAlterIndexInterval() throws Throwable {
String tableName = createTable("CREATE TABLE IF NOT EXISTS %s (id uuid, album text, artist text, data blob, PRIMARY KEY (id))");
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
alterTable("ALTER TABLE %s WITH min_index_interval=256 AND max_index_interval=512");
assertEquals(256, cfs.metadata().params.minIndexInterval);
assertEquals(512, cfs.metadata().params.maxIndexInterval);
alterTable("ALTER TABLE %s WITH caching = {}");
assertEquals(256, cfs.metadata().params.minIndexInterval);
assertEquals(512, cfs.metadata().params.maxIndexInterval);
}
Aggregations