use of org.apache.cassandra.db.compaction.Verifier in project cassandra by apache.
the class LegacySSTableTest method testVerifyOldSSTables.
@Test
public void testVerifyOldSSTables() throws IOException {
for (String legacyVersion : legacyVersions) {
ColumnFamilyStore cfs = Keyspace.open("legacy_tables").getColumnFamilyStore(String.format("legacy_%s_simple", legacyVersion));
loadLegacyTable("legacy_%s_simple", legacyVersion);
for (SSTableReader sstable : cfs.getLiveSSTables()) {
try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().checkVersion(true).build())) {
verifier.verify();
if (!sstable.descriptor.version.isLatestVersion())
fail("Verify should throw RuntimeException for old sstables " + sstable);
} catch (RuntimeException e) {
}
}
// make sure we don't throw any exception if not checking version:
for (SSTableReader sstable : cfs.getLiveSSTables()) {
try (Verifier verifier = new Verifier(cfs, sstable, false, Verifier.options().checkVersion(false).build())) {
verifier.verify();
} catch (Throwable e) {
fail("Verify should throw RuntimeException for old sstables " + sstable);
}
}
}
}
Aggregations