sstables: add tests for dense tables

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-07-21 23:52:07 -04:00
parent 96f7c77a04
commit cd91f2ecdc
18 changed files with 96 additions and 0 deletions

View File

@@ -462,3 +462,39 @@ SEASTAR_TEST_CASE(compact_storage_sparse_read) {
});
});
}
SEASTAR_TEST_CASE(compact_storage_simple_dense_read) {
return reusable_sst("tests/urchin/sstables/compact_simple_dense", 1).then([] (auto sstp) {
return do_with(sstables::key("first_row"), [sstp] (auto& key) {
auto s = compact_simple_dense_schema();
return sstp->read_row(s, key).then([sstp, s, &key] (auto mutation) {
auto& mp = mutation->partition();
auto exploded = exploded_clustering_prefix({"cl1"});
auto clustering = clustering_key::from_clustering_prefix(*s, exploded);
auto row = mp.clustered_row(clustering);
match_live_cell(row.cells(), *s, "cl2", boost::any(to_bytes("cl2")));
return make_ready_future<>();
});
});
});
}
SEASTAR_TEST_CASE(compact_storage_dense_read) {
return reusable_sst("tests/urchin/sstables/compact_dense", 1).then([] (auto sstp) {
return do_with(sstables::key("first_row"), [sstp] (auto& key) {
auto s = compact_dense_schema();
return sstp->read_row(s, key).then([sstp, s, &key] (auto mutation) {
auto& mp = mutation->partition();
auto exploded = exploded_clustering_prefix({"cl1", "cl2"});
auto clustering = clustering_key::from_clustering_prefix(*s, exploded);
auto row = mp.clustered_row(clustering);
match_live_cell(row.cells(), *s, "cl3", boost::any(to_bytes("cl3")));
return make_ready_future<>();
});
});
});
}

View File

@@ -249,6 +249,48 @@ inline schema_ptr columns_schema() {
return columns;
}
inline schema_ptr compact_simple_dense_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "compact_simple_dense",
// partition key
{{"ks", bytes_type}},
// clustering key
{{"cl1", bytes_type}},
// regular columns
{{"cl2", bytes_type}},
// static columns
{},
// regular column name type
utf8_type,
// comment
"Table with a compact storage, and a single clustering key"
)));
return builder.build(schema_builder::compact_storage::yes);
}();
return s;
}
inline schema_ptr compact_dense_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "compact_simple_dense",
// partition key
{{"ks", bytes_type}},
// clustering key
{{"cl1", bytes_type}, {"cl2", bytes_type}},
// regular columns
{{"cl3", bytes_type}},
// static columns
{},
// regular column name type
utf8_type,
// comment
"Table with a compact storage, and a compound clustering key"
)));
return builder.build(schema_builder::compact_storage::yes);
}();
return s;
}
inline schema_ptr compact_sparse_schema() {
static thread_local auto s = [] {
schema_builder builder(make_lw_shared(schema({}, "tests", "compact_sparse",

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
3216903601

Binary file not shown.

Binary file not shown.

View File

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

View File

@@ -0,0 +1 @@
1513167530

View File

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