sstables 3: add test for reading big dense subset of columns

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
This commit is contained in:
Piotr Jastrzebski
2018-05-31 00:24:21 +02:00
parent 829f0c5f80
commit 2fd0566eb7
9 changed files with 242 additions and 0 deletions

View File

@@ -874,6 +874,239 @@ SEASTAR_TEST_CASE(test_uncompressed_large_subset_of_columns_sparse_read) {
});
}
// Following tests run on files in tests/sstables/3.x/uncompressed/large_subset_of_columns_dense
// They were created using following CQL statements:
//
// CREATE KEYSPACE test_ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
//
// CREATE TABLE test_ks.test_table ( pk INT,
// val1 INT, val2 INT, val3 INT, val4 INT, val5 INT, val6 INT, val7 INT, val8 INT,
// val9 INT,
// val10 INT, val11 INT, val12 INT, val13 INT, val14 INT, val15 INT, val16 INT,
// val17 INT, val18 INT, val19 INT,
// val20 INT, val21 INT, val22 INT, val23 INT, val24 INT, val25 INT, val26 INT,
// val27 INT, val28 INT, val29 INT,
// val30 INT, val31 INT, val32 INT, val33 INT, val34 INT, val35 INT, val36 INT,
// val37 INT, val38 INT, val39 INT,
// val40 INT, val41 INT, val42 INT, val43 INT, val44 INT, val45 INT, val46 INT,
// val47 INT, val48 INT, val49 INT,
// val50 INT, val51 INT, val52 INT, val53 INT, val54 INT, val55 INT, val56 INT,
// val57 INT, val58 INT, val59 INT,
// val60 INT, val61 INT, val62 INT, val63 INT, val64 INT,
// PRIMARY KEY(pk))
// WITH compression = { 'enabled' : false };
//
// INSERT INTO test_ks.test_table(pk, val1, val2, val3, val4, val5, val6, val7, val8, val9,
// val10, val11, val12, val13, val14, val15, val16, val17, val18, val19,
// val20, val21, val22, val23, val24, val25, val26, val27, val28,
// val30, val31, val32, val33, val34, val35, val36, val37, val38, val39,
// val40, val41, val42, val43, val44, val45, val46, val47, val48, val49,
// val50, val51, val52, val53, val54, val55, val56, val57, val58, val59,
// val60, val61, val62, val63, val64)
// VALUES(1, 1, 2, 3, 4, 5, 6, 7, 8, 9,
// 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 21, 22, 23, 24, 25, 26, 27, 28,
// 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
// 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
// 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
// 60, 61, 62, 63, 64);
// INSERT INTO test_ks.test_table(pk, val2, val3, val4, val5, val6, val7, val8, val9,
// val10, val11, val12, val13, val14, val15, val16, val17, val18, val19,
// val20, val21, val22, val23, val24, val25, val26, val27, val28, val29,
// val30, val31, val32, val33, val34, val35, val36, val37, val38, val39,
// val40, val41, val42, val43, val44, val45, val46, val47, val48, val49,
// val50, val51, val52, val53, val54, val55, val56, val57, val58, val59,
// val60, val61, val62, val63, val64)
// VALUES(2, 2, 3, 4, 5, 6, 7, 8, 9,
// 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
// 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
// 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
// 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
// 60, 61, 62, 63, 64);
// INSERT INTO test_ks.test_table(pk, val1, val2, val3, val4, val5, val6, val7, val8, val9,
// val10, val11, val12, val13, val14, val15, val16, val17, val18, val19,
// val20, val21, val22, val23, val24, val25, val26, val27, val28, val29,
// val30, val31, val32, val33, val34, val35, val36, val37, val38, val39,
// val40, val41, val42, val43, val44, val45, val46, val47, val48, val49,
// val50, val51, val52, val53, val54, val55, val56, val57, val58, val59,
// val60, val61, val62, val63)
// VALUES(3, 1, 2, 3, 4, 5, 6, 7, 8, 9,
// 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
// 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
// 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
// 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
// 60, 61, 62, 63);
// INSERT INTO test_ks.test_table(pk, val1, val2, val3, val4, val5, val6, val7, val8, val9,
// val10, val11, val12, val13, val14, val15, val16, val17, val18, val19,
// val20, val21, val22, val23, val24, val25, val26, val27, val28, val29,
// val30, val31, val32)
// VALUES(4, 1, 2, 3, 4, 5, 6, 7, 8, 9,
// 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
// 30, 31, 32);
// INSERT INTO test_ks.test_table(pk, val33, val34, val35, val36, val37, val38, val39, val40, val41, val42,
// val43, val44, val45, val46, val47, val48, val49, val50, val51, val52,
// val53, val54, val55, val56, val57, val58, val59, val60, val61, val62,
// val63, val64)
// VALUES(5, 1, 2, 3, 4, 5, 6, 7, 8, 9,
// 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
// 30, 31, 32);
//
// IMPORTANT: each column has to be covered by at least one insert otherwise it won't be present in the sstable
static thread_local const sstring UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_PATH =
"tests/sstables/3.x/uncompressed/large_subset_of_columns_dense";
static thread_local const schema_ptr UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_SCHEMA =
schema_builder("test_ks", "test_table")
.with_column("pk", int32_type, column_kind::partition_key)
.with_column("val1", int32_type)
.with_column("val2", int32_type)
.with_column("val3", int32_type)
.with_column("val4", int32_type)
.with_column("val5", int32_type)
.with_column("val6", int32_type)
.with_column("val7", int32_type)
.with_column("val8", int32_type)
.with_column("val9", int32_type)
.with_column("val10", int32_type)
.with_column("val11", int32_type)
.with_column("val12", int32_type)
.with_column("val13", int32_type)
.with_column("val14", int32_type)
.with_column("val15", int32_type)
.with_column("val16", int32_type)
.with_column("val17", int32_type)
.with_column("val18", int32_type)
.with_column("val19", int32_type)
.with_column("val20", int32_type)
.with_column("val21", int32_type)
.with_column("val22", int32_type)
.with_column("val23", int32_type)
.with_column("val24", int32_type)
.with_column("val25", int32_type)
.with_column("val26", int32_type)
.with_column("val27", int32_type)
.with_column("val28", int32_type)
.with_column("val29", int32_type)
.with_column("val30", int32_type)
.with_column("val31", int32_type)
.with_column("val32", int32_type)
.with_column("val33", int32_type)
.with_column("val34", int32_type)
.with_column("val35", int32_type)
.with_column("val36", int32_type)
.with_column("val37", int32_type)
.with_column("val38", int32_type)
.with_column("val39", int32_type)
.with_column("val40", int32_type)
.with_column("val41", int32_type)
.with_column("val42", int32_type)
.with_column("val43", int32_type)
.with_column("val44", int32_type)
.with_column("val45", int32_type)
.with_column("val46", int32_type)
.with_column("val47", int32_type)
.with_column("val48", int32_type)
.with_column("val49", int32_type)
.with_column("val50", int32_type)
.with_column("val51", int32_type)
.with_column("val52", int32_type)
.with_column("val53", int32_type)
.with_column("val54", int32_type)
.with_column("val55", int32_type)
.with_column("val56", int32_type)
.with_column("val57", int32_type)
.with_column("val58", int32_type)
.with_column("val59", int32_type)
.with_column("val60", int32_type)
.with_column("val61", int32_type)
.with_column("val62", int32_type)
.with_column("val63", int32_type)
.with_column("val64", int32_type)
.build();
SEASTAR_TEST_CASE(test_uncompressed_large_subset_of_columns_dense_read) {
return seastar::async([] {
sstable_assertions sst(UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_SCHEMA,
UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_PATH);
sst.load();
auto to_key = [] (int key) {
auto bytes = int32_type->decompose(int32_t(key));
auto pk = partition_key::from_single_value(*UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_SCHEMA, bytes);
return dht::global_partitioner().decorate_key(*UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_SCHEMA, pk);
};
std::vector<const column_definition*> column_defs(64);
for (int i = 0; i < 64; ++i) {
column_defs[i] = UNCOMPRESSED_LARGE_SUBSET_OF_COLUMNS_DENSE_SCHEMA->get_column_definition(to_bytes(sprint("val%d", (i + 1))));
BOOST_REQUIRE(column_defs[i]);
}
auto generate = [&] (const std::vector<std::pair<int, int>>& column_values) {
std::vector<flat_reader_assertions::expected_column> columns;
for (auto& p : column_values) {
columns.push_back({column_defs[p.first - 1], int32_type->decompose(p.second)});
}
return columns;
};
assert_that(sst.read_rows_flat())
.produces_partition_start(to_key(5))
.produces_row(clustering_key_prefix::make_empty(),
generate({{33, 1}, {34, 2}, {35, 3}, {36, 4}, {37, 5}, {38, 6}, {39, 7}, {40, 8}, {41, 9},
{42, 10}, {43, 11}, {44, 12}, {45, 13}, {46, 14}, {47, 15}, {48, 16}, {49, 17},
{50, 18}, {51, 19}, {52, 20}, {53, 21}, {54, 22}, {55, 23}, {56, 24}, {57, 25},
{58, 26}, {59, 27}, {60, 28}, {61, 29}, {62, 30}, {63, 31}, {64, 32}}))
.produces_partition_end()
.produces_partition_start(to_key(1))
.produces_row(clustering_key_prefix::make_empty(),
generate({{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9},
{10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}, {17, 17},
{18, 18}, {19, 19}, {20, 20}, {21, 21}, {22, 22}, {23, 23}, {24, 24}, {25, 25},
{26, 26}, {27, 27}, {28, 28}, {30, 30}, {31, 31}, {32, 32}, {33, 33},
{34, 34}, {35, 35}, {36, 36}, {37, 37}, {38, 38}, {39, 39}, {40, 40}, {41, 41},
{42, 42}, {43, 43}, {44, 44}, {45, 45}, {46, 46}, {47, 47}, {48, 48}, {49, 49},
{50, 50}, {51, 51}, {52, 52}, {53, 53}, {54, 54}, {55, 55}, {56, 56}, {57, 57},
{58, 58}, {59, 59}, {60, 60}, {61, 61}, {62, 62}, {63, 63}, {64, 64}}))
.produces_partition_end()
.produces_partition_start(to_key(2))
.produces_row(clustering_key_prefix::make_empty(),
generate({{2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9},
{10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}, {17, 17},
{18, 18}, {19, 19}, {20, 20}, {21, 21}, {22, 22}, {23, 23}, {24, 24}, {25, 25},
{26, 26}, {27, 27}, {28, 28}, {29, 29}, {30, 30}, {31, 31}, {32, 32}, {33, 33},
{34, 34}, {35, 35}, {36, 36}, {37, 37}, {38, 38}, {39, 39}, {40, 40}, {41, 41},
{42, 42}, {43, 43}, {44, 44}, {45, 45}, {46, 46}, {47, 47}, {48, 48}, {49, 49},
{50, 50}, {51, 51}, {52, 52}, {53, 53}, {54, 54}, {55, 55}, {56, 56}, {57, 57},
{58, 58}, {59, 59}, {60, 60}, {61, 61}, {62, 62}, {63, 63}, {64, 64}}))
.produces_partition_end()
.produces_partition_start(to_key(4))
.produces_row(clustering_key_prefix::make_empty(),
generate({{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9},
{10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}, {17, 17},
{18, 18}, {19, 19}, {20, 20}, {21, 21}, {22, 22}, {23, 23}, {24, 24}, {25, 25},
{26, 26}, {27, 27}, {28, 28}, {29, 29}, {30, 30}, {31, 31}, {32, 32}}))
.produces_partition_end()
.produces_partition_start(to_key(3))
.produces_row(clustering_key_prefix::make_empty(),
generate({{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9},
{10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}, {17, 17},
{18, 18}, {19, 19}, {20, 20}, {21, 21}, {22, 22}, {23, 23}, {24, 24}, {25, 25},
{26, 26}, {27, 27}, {28, 28}, {29, 29}, {30, 30}, {31, 31}, {32, 32}, {33, 33},
{34, 34}, {35, 35}, {36, 36}, {37, 37}, {38, 38}, {39, 39}, {40, 40}, {41, 41},
{42, 42}, {43, 43}, {44, 44}, {45, 45}, {46, 46}, {47, 47}, {48, 48}, {49, 49},
{50, 50}, {51, 51}, {52, 52}, {53, 53}, {54, 54}, {55, 55}, {56, 56}, {57, 57},
{58, 58}, {59, 59}, {60, 60}, {61, 61}, {62, 62}, {63, 63}}))
.produces_partition_end()
.produces_end_of_stream();
});
}
// Following tests run on files in tests/sstables/3.x/uncompressed/simple
// They were created using following CQL statements:
//

View File

@@ -0,0 +1,8 @@
Index.db
TOC.txt
Statistics.db
Digest.crc32
CRC.db
Data.db
Summary.db
Filter.db