Skip to content

Commit

Permalink
test: sstable_3_x_test: add test_compression_premature_eof
Browse files Browse the repository at this point in the history
Reproduces #13599 and verifies the fix.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes #13903
  • Loading branch information
bhalevy authored and denesb committed May 17, 2023
1 parent 605e53e commit 302a894
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/boost/sstable_3_x_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5514,3 +5514,26 @@ SEASTAR_TEST_CASE(test_legacy_udt_in_collection_table) {
assert_that(sst.make_reader()).produces(mut).produces_end_of_stream();
});
}

SEASTAR_TEST_CASE(test_compression_premature_eof) {
return test_env::do_with_async([] (test_env& env) {
auto stable_dir = "./test/resource/sstables/compression-premature-eof";
sstable_assertions sst(env, ZSTD_MULTIPLE_CHUNKS_SCHEMA, stable_dir);
sst.load();

auto to_key = [] (int key) {
auto bytes = int32_type->decompose(int32_t(key));
auto pk = partition_key::from_single_value(*ZSTD_MULTIPLE_CHUNKS_SCHEMA, bytes);
return dht::decorate_key(*ZSTD_MULTIPLE_CHUNKS_SCHEMA, pk);
};

flat_reader_assertions_v2 assertions(sst.make_reader());
try {
assertions.produces_partition_start(to_key(0));
BOOST_FAIL("produces_partition_start unexpectedly");
} catch (const sstables::malformed_sstable_exception& e) {
std::string what = e.what();
BOOST_REQUIRE(what.find("compressed reader hit premature end-of-file") != std::string::npos);
}
});
}
Binary file not shown.
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2941476576
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Index.db
Digest.crc32
CompressionInfo.db
Data.db
Summary.db
Filter.db
Statistics.db
TOC.txt

0 comments on commit 302a894

Please sign in to comment.