// 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));
assert CacheService.instance.keyCache.size() == 2;
Util.compactAll(cfs).get();
keyCacheSize = CacheService.instance.keyCache.size();
// after compaction cache should have entries for
// new SSTables, if we had 2 keys in cache previously it should become 4
assert keyCacheSize == 4 : keyCacheSize;
// 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));