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");
}
}
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");
}
}
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) {
}
}
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");
}
}
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");
}
}
Aggregations