Search in sources :

Example 1 with LocalToken

use of org.apache.cassandra.dht.LocalPartitioner.LocalToken in project cassandra by apache.

the class SSTableReaderTest method testLoadingSummaryUsesCorrectPartitioner.

@Test
public void testLoadingSummaryUsesCorrectPartitioner() throws Exception {
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    ColumnFamilyStore store = keyspace.getColumnFamilyStore("Indexed1");
    new RowUpdateBuilder(store.metadata(), System.currentTimeMillis(), "k1").clustering("0").add("birthdate", 1L).build().applyUnsafe();
    store.forceBlockingFlush();
    for (ColumnFamilyStore indexCfs : store.indexManager.getAllIndexColumnFamilyStores()) {
        assert indexCfs.isIndex();
        SSTableReader sstable = indexCfs.getLiveSSTables().iterator().next();
        assert sstable.first.getToken() instanceof LocalToken;
        sstable.saveSummary();
        SSTableReader reopened = SSTableReader.open(sstable.descriptor);
        assert reopened.first.getToken() instanceof LocalToken;
        reopened.selfRef().release();
    }
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) LocalToken(org.apache.cassandra.dht.LocalPartitioner.LocalToken) Test(org.junit.Test)

Aggregations

LocalToken (org.apache.cassandra.dht.LocalPartitioner.LocalToken)1 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)1 Test (org.junit.Test)1