Search in sources :

Example 11 with CorruptSSTableException

use of org.apache.cassandra.io.sstable.CorruptSSTableException in project cassandra by apache.

the class VerifyTest method testVerifyCounterCorrect.

@Test
public void testVerifyCounterCorrect() throws IOException {
    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.verify(false);
    } 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 12 with CorruptSSTableException

use of org.apache.cassandra.io.sstable.CorruptSSTableException in project cassandra by apache.

the class VerifyTest method testExtendedVerifyCounterCorrect.

@Test
public void testExtendedVerifyCounterCorrect() throws IOException {
    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.verify(true);
    } 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 13 with CorruptSSTableException

use of org.apache.cassandra.io.sstable.CorruptSSTableException in project cassandra by apache.

the class VerifyTest method testVerifyIncorrectDigest.

@Test
public void testVerifyIncorrectDigest() throws IOException, WriteTimeoutException {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CORRUPT_CF);
    fillCF(cfs, 2);
    Util.getAll(Util.cmd(cfs).build());
    SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
    try (RandomAccessFile file = new RandomAccessFile(sstable.descriptor.filenameFor(Component.DIGEST), "rw")) {
        Long correctChecksum = Long.valueOf(file.readLine());
        writeChecksum(++correctChecksum, sstable.descriptor.filenameFor(Component.DIGEST));
    }
    try (Verifier verifier = new Verifier(cfs, sstable, false)) {
        verifier.verify(false);
        fail("Expected a CorruptSSTableException to be thrown");
    } catch (CorruptSSTableException err) {
    }
}
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 14 with CorruptSSTableException

use of org.apache.cassandra.io.sstable.CorruptSSTableException in project cassandra by apache.

the class VerifyTest method testExtendedVerifyCorrectUncompressed.

@Test
public void testExtendedVerifyCorrectUncompressed() throws IOException {
    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.verify(true);
    } 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 15 with CorruptSSTableException

use of org.apache.cassandra.io.sstable.CorruptSSTableException in project cassandra by apache.

the class VerifyTest method testExtendedVerifyCorrect.

@Test
public void testExtendedVerifyCorrect() throws IOException {
    CompactionManager.instance.disableAutoCompaction();
    Keyspace keyspace = Keyspace.open(KEYSPACE);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF2);
    fillCF(cfs, 2);
    SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
    try (Verifier verifier = new Verifier(cfs, sstable, false)) {
        verifier.verify(true);
    } 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

CorruptSSTableException (org.apache.cassandra.io.sstable.CorruptSSTableException)16 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)11 SchemaLoader.createKeyspace (org.apache.cassandra.SchemaLoader.createKeyspace)10 Verifier (org.apache.cassandra.db.compaction.Verifier)10 Test (org.junit.Test)10 IOException (java.io.IOException)4 EOFException (java.io.EOFException)3 FSReadError (org.apache.cassandra.io.FSReadError)2 BufferPoolMetricSet (com.codahale.metrics.jvm.BufferPoolMetricSet)1 FileDescriptorRatioGauge (com.codahale.metrics.jvm.FileDescriptorRatioGauge)1 GarbageCollectorMetricSet (com.codahale.metrics.jvm.GarbageCollectorMetricSet)1 MemoryUsageGaugeSet (com.codahale.metrics.jvm.MemoryUsageGaugeSet)1 URL (java.net.URL)1 UnknownHostException (java.net.UnknownHostException)1 CRC32 (java.util.zip.CRC32)1 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)1 Directories (org.apache.cassandra.db.Directories)1 Keyspace (org.apache.cassandra.db.Keyspace)1 ConfigurationException (org.apache.cassandra.exceptions.ConfigurationException)1 StartupException (org.apache.cassandra.exceptions.StartupException)1