Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Tyler Hobbs 2014-11-04 09:42:59 -06:00
commit 72d187c0f3
3 changed files with 30 additions and 0 deletions

View File

@ -32,6 +32,7 @@
2.1.2
* Fix read-rate tracking of sstables for some queries (CASSANDRA-8239)
* Fix default timestamp in QueryOptions (CASSANDRA-8246)
* Set socket timeout when reading remote version (CASSANDRA-8188)
* Refactor how we track live size (CASSANDRA-7852)

View File

@ -124,6 +124,7 @@ public class CollationController
break;
Tracing.trace("Merging data from sstable {}", sstable.descriptor.generation);
sstable.incrementReadCount();
OnDiskAtomIterator iter = reducedFilter.getSSTableColumnIterator(sstable);
iterators.add(iter);
isEmpty = false;

View File

@ -210,6 +210,34 @@ public class SSTableReaderTest
cfs.loadNewSSTables();
}
@Test
public void testReadRateTracking()
{
// try to make sure CASSANDRA-8239 never happens again
Keyspace keyspace = Keyspace.open("Keyspace1");
ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
for (int j = 0; j < 10; j++)
{
ByteBuffer key = ByteBufferUtil.bytes(String.valueOf(j));
Mutation rm = new Mutation("Keyspace1", key);
rm.add("Standard1", cellname("0"), ByteBufferUtil.EMPTY_BYTE_BUFFER, j);
rm.apply();
}
store.forceBlockingFlush();
SSTableReader sstable = store.getSSTables().iterator().next();
assertEquals(0, sstable.readMeter.count());
DecoratedKey key = sstable.partitioner.decorateKey(ByteBufferUtil.bytes("4"));
store.getColumnFamily(key, Composites.EMPTY, Composites.EMPTY, false, 100, 100);
assertEquals(1, sstable.readMeter.count());
store.getColumnFamily(key, cellname("0"), cellname("0"), false, 100, 100);
assertEquals(2, sstable.readMeter.count());
store.getColumnFamily(Util.namesQueryFilter(store, key, cellname("0")));
assertEquals(3, sstable.readMeter.count());
}
@Test
public void testGetPositionsForRangesWithKeyCache() throws ExecutionException, InterruptedException
{