use of org.apache.cassandra.db.compaction.writers.DefaultCompactionWriter in project cassandra by apache.
the class CompactionAwareWriterTest method testDefaultCompactionWriter.
@Test
public void testDefaultCompactionWriter() throws Throwable {
Keyspace ks = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = ks.getColumnFamilyStore(TABLE);
int rowCount = 1000;
cfs.disableAutoCompaction();
populate(rowCount);
LifecycleTransaction txn = cfs.getTracker().tryModify(cfs.getLiveSSTables(), OperationType.COMPACTION);
long beforeSize = txn.originals().iterator().next().onDiskLength();
CompactionAwareWriter writer = new DefaultCompactionWriter(cfs, cfs.getDirectories(), txn, txn.originals());
int rows = compact(cfs, txn, writer);
assertEquals(1, cfs.getLiveSSTables().size());
assertEquals(rowCount, rows);
assertEquals(beforeSize, cfs.getLiveSSTables().iterator().next().onDiskLength());
validateData(cfs, rowCount);
cfs.truncateBlocking();
}
Aggregations