Search in sources :

Example 16 with Verifier

use of org.apache.cassandra.db.compaction.Verifier in project cassandra by apache.

the class VerifyTest method testVerifyCounterCorrectUncompressed.

@Test
public void testVerifyCounterCorrectUncompressed() {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(COUNTER_CF3);
    fillCounterCF(cfs, 2);
    SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
    try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().invokeDiskFailurePolicy(true).build())) {
        verifier.verify();
    } catch (CorruptSSTableException err) {
        fail("Unexpected CorruptSSTableException");
    }
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) SchemaLoader.createKeyspace(org.apache.cassandra.SchemaLoader.createKeyspace) Verifier(org.apache.cassandra.db.compaction.Verifier) CorruptSSTableException(org.apache.cassandra.io.sstable.CorruptSSTableException) Test(org.junit.Test)

Example 17 with Verifier

use of org.apache.cassandra.db.compaction.Verifier in project cassandra by apache.

the class VerifyTest method testNoFilterFile.

@Test
public void testNoFilterFile() {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(BF_ALWAYS_PRESENT);
    fillCF(cfs, 100);
    assertEquals(1.0, cfs.metadata().params.bloomFilterFpChance, 0.0);
    for (SSTableReader sstable : cfs.getLiveSSTables()) {
        File f = new File(sstable.descriptor.filenameFor(Component.FILTER));
        assertFalse(f.exists());
        try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().build())) {
            verifier.verify();
        }
    }
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) SchemaLoader.createKeyspace(org.apache.cassandra.SchemaLoader.createKeyspace) Verifier(org.apache.cassandra.db.compaction.Verifier) File(org.apache.cassandra.io.util.File) Test(org.junit.Test)

Example 18 with Verifier

use of org.apache.cassandra.db.compaction.Verifier in project cassandra by apache.

the class VerifyTest method testVerifyCounterCorrect.

@Test
public void testVerifyCounterCorrect() {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(COUNTER_CF);
    fillCounterCF(cfs, 2);
    SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
    try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().invokeDiskFailurePolicy(true).build())) {
        verifier.verify();
    } catch (CorruptSSTableException err) {
        fail("Unexpected CorruptSSTableException");
    }
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) SchemaLoader.createKeyspace(org.apache.cassandra.SchemaLoader.createKeyspace) Verifier(org.apache.cassandra.db.compaction.Verifier) CorruptSSTableException(org.apache.cassandra.io.sstable.CorruptSSTableException) Test(org.junit.Test)

Example 19 with Verifier

use of org.apache.cassandra.db.compaction.Verifier in project cassandra by apache.

the class VerifyTest method testExtendedVerifyCounterCorrect.

@Test
public void testExtendedVerifyCounterCorrect() {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(COUNTER_CF2);
    fillCounterCF(cfs, 2);
    SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
    try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().invokeDiskFailurePolicy(true).extendedVerification(true).build())) {
        verifier.verify();
    } catch (CorruptSSTableException err) {
        fail("Unexpected CorruptSSTableException");
    }
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) SchemaLoader.createKeyspace(org.apache.cassandra.SchemaLoader.createKeyspace) Verifier(org.apache.cassandra.db.compaction.Verifier) CorruptSSTableException(org.apache.cassandra.io.sstable.CorruptSSTableException) Test(org.junit.Test)

Example 20 with Verifier

use of org.apache.cassandra.db.compaction.Verifier in project cassandra by apache.

the class VerifyTest method testExtendedVerifyCorrectUncompressed.

@Test
public void testExtendedVerifyCorrectUncompressed() {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF4);
    fillCF(cfs, 2);
    SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
    try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().extendedVerification(true).invokeDiskFailurePolicy(true).build())) {
        verifier.verify();
    } catch (CorruptSSTableException err) {
        fail("Unexpected CorruptSSTableException");
    }
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.format.SSTableReader) SchemaLoader.createKeyspace(org.apache.cassandra.SchemaLoader.createKeyspace) Verifier(org.apache.cassandra.db.compaction.Verifier) CorruptSSTableException(org.apache.cassandra.io.sstable.CorruptSSTableException) Test(org.junit.Test)

Aggregations

Verifier (org.apache.cassandra.db.compaction.Verifier)21 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)21 Test (org.junit.Test)18 SchemaLoader.createKeyspace (org.apache.cassandra.SchemaLoader.createKeyspace)17 CorruptSSTableException (org.apache.cassandra.io.sstable.CorruptSSTableException)15 File (org.apache.cassandra.io.util.File)8 RandomAccessReader (org.apache.cassandra.io.util.RandomAccessReader)4 FileChannel (java.nio.channels.FileChannel)3 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)2 ByteOrderedPartitioner (org.apache.cassandra.dht.ByteOrderedPartitioner)2 TokenMetadata (org.apache.cassandra.locator.TokenMetadata)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1