// to make sure we have SSTable
cfs.forceBlockingFlush();
// reads to cache key position
cfs.getColumnFamily(QueryFilter.getSliceFilter(key1,
new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
false,
10));
cfs.getColumnFamily(QueryFilter.getSliceFilter(key2,
new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
false,
10));
assertKeyCacheSize(2, TABLE1, COLUMN_FAMILY1);
Util.compactAll(cfs).get();
// after compaction cache should have entries for
// new SSTables, if we had 2 keys in cache previously it should become 4
assertKeyCacheSize(4, TABLE1, COLUMN_FAMILY1);
// re-read same keys to verify that key cache didn't grow further
cfs.getColumnFamily(QueryFilter.getSliceFilter(key1,
new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
false,
10));
cfs.getColumnFamily(QueryFilter.getSliceFilter(key2,
new QueryPath(new ColumnParent(COLUMN_FAMILY1)),
ByteBufferUtil.EMPTY_BYTE_BUFFER,
ByteBufferUtil.EMPTY_BYTE_BUFFER,
false,
10));