tests/sstable_datafile_test: Add test for incorrect promoted index

Ensure we don't load incorrectly generated promoted indexes.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2017-11-21 21:58:54 +00:00
parent f9a76084e9
commit 766ca8dff4
10 changed files with 36 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
#include "cell_locking.hh"
#include "simple_schema.hh"
#include "memtable-sstable.hh"
#include "tests/sstable_assertions.hh"
#include <stdio.h>
#include <ftw.h>
@@ -4343,3 +4344,28 @@ SEASTAR_TEST_CASE(compaction_correctness_with_partitioned_sstable_set) {
.produces_end_of_stream();
});
}
SEASTAR_TEST_CASE(test_broken_promoted_index_is_skipped) {
// create table ks.test (pk int, ck int, v int, primary key(pk, ck)) with compact storage;
//
// Populated with:
//
// insert into ks.test (pk, ck, v) values (1, 1, 1);
// insert into ks.test (pk, ck, v) values (1, 2, 1);
// insert into ks.test (pk, ck, v) values (1, 3, 1);
// delete from ks.test where pk = 1 and ck = 2;
return seastar::async([] {
auto s = schema_builder("ks", "test")
.with_column("pk", int32_type, column_kind::partition_key)
.with_column("ck", int32_type, column_kind::clustering_key)
.with_column("v", int32_type)
.build(schema_builder::compact_storage::yes);
auto sst = sstables::make_sstable(s, "tests/sstables/broken_non_compound_pi_and_range_tombstone", 1, sstables::sstable::version_types::ka, big);
sst->load().get0();
{
assert_that(sst->get_index_reader(default_priority_class())).is_empty(*s);
}
});
}

View File

@@ -0,0 +1,9 @@
Scylla.db
CompressionInfo.db
Filter.db
Statistics.db
TOC.txt
Digest.sha1
Index.db
Summary.db
Data.db