use of org.apache.cassandra.io.sstable.SSTable in project eiger by wlloyd.
the class ColumnFamilyStoreTest method testSliceByNamesCommandOldMetatada.
@Test
public void testSliceByNamesCommandOldMetatada() throws Throwable {
String tableName = "Keyspace1";
String cfName = "Standard1";
DecoratedKey key = Util.dk("slice-name-old-metadata");
ByteBuffer cname = ByteBufferUtil.bytes("c1");
Table table = Table.open(tableName);
ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
cfs.clearUnsafe();
// Create a column a 'high timestamp'
putColsStandard(cfs, key, new Column(cname, ByteBufferUtil.bytes("a"), 2));
cfs.forceBlockingFlush();
// Nuke the metadata and reload that sstable
Collection<SSTableReader> ssTables = cfs.getSSTables();
assertEquals(1, ssTables.size());
cfs.clearUnsafe();
assertEquals(0, cfs.getSSTables().size());
new File(ssTables.iterator().next().descriptor.filenameFor(SSTable.COMPONENT_STATS)).delete();
cfs.loadNewSSTables();
// Add another column with a lower timestamp
putColsStandard(cfs, key, new Column(cname, ByteBufferUtil.bytes("b"), 1));
// Test fetching the column by name returns the first column
SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(tableName, key.key, new QueryPath(cfName), Collections.singletonList(cname));
ColumnFamily cf = cmd.getRow(table).cf;
Column column = (Column) cf.getColumn(cname);
assert column.value().equals(ByteBufferUtil.bytes("a")) : "expecting a, got " + ByteBufferUtil.string(column.value());
}
Aggregations