From 07d61683b6db1ade058eea2df64479477ffc836a Mon Sep 17 00:00:00 2001 From: Vladimir Krivopalov Date: Fri, 5 Oct 2018 19:15:23 -0700 Subject: [PATCH] tests: Add test for reading rows after multiple fast-forwarding with SSTables 3.x. Signed-off-by: Vladimir Krivopalov --- tests/sstable_3_x_test.cc | 58 ++++++++++++++++++ .../mc-1-big-CRC.db | Bin 0 -> 8 bytes .../mc-1-big-Data.db | Bin 0 -> 50 bytes .../mc-1-big-Digest.crc32 | 1 + .../mc-1-big-Filter.db | Bin 0 -> 16 bytes .../mc-1-big-Index.db | Bin 0 -> 8 bytes .../mc-1-big-Statistics.db | Bin 0 -> 4659 bytes .../mc-1-big-Summary.db | Bin 0 -> 56 bytes .../mc-1-big-TOC.txt | 8 +++ 9 files changed, 67 insertions(+) create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-CRC.db create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Data.db create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Digest.crc32 create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Filter.db create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Index.db create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Statistics.db create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Summary.db create mode 100644 tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-TOC.txt diff --git a/tests/sstable_3_x_test.cc b/tests/sstable_3_x_test.cc index 3c07a448fd..12a1273b96 100644 --- a/tests/sstable_3_x_test.cc +++ b/tests/sstable_3_x_test.cc @@ -4463,3 +4463,61 @@ SEASTAR_THREAD_TEST_CASE(test_complex_column_zero_subcolumns_read) { r.produces_end_of_stream(); } + +SEASTAR_THREAD_TEST_CASE(test_uncompressed_read_two_rows_fast_forwarding) { + auto abj = defer([] { await_background_jobs().get(); }); + // Following tests run on files in tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding + // They were created using following CQL statements: + // + // CREATE TABLE two_rows_fast_forwarding (pk int, ck int, rc int, PRIMARY KEY (pk, ck)) WITH compression = {'sstable_compression': ''}; + // INSERT INTO two_rows_fast_forwarding (pk, ck, rc) VALUES (0, 7, 7); + // INSERT INTO two_rows_fast_forwarding (pk, ck, rc) VALUES (0, 8, 8); + + static const sstring path = "tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding"; + static thread_local const schema_ptr s = + schema_builder("test_ks", "two_rows_fast_forwarding") + .with_column("pk", int32_type, column_kind::partition_key) + .with_column("ck", int32_type, column_kind::clustering_key) + .with_column("rc", int32_type) + .build(); + sstable_assertions sst(s, path); + sst.load(); + + auto to_pkey = [&] (int key) { + auto bytes = int32_type->decompose(int32_t(key)); + auto pk = partition_key::from_single_value(*s, bytes); + return dht::global_partitioner().decorate_key(*s, pk); + }; + + auto to_ckey = [&] (int key) { + auto bytes = int32_type->decompose(int32_t(key)); + return clustering_key::from_single_value(*s, bytes); + }; + + auto rc_cdef = s->get_column_definition(to_bytes("rc")); + BOOST_REQUIRE(rc_cdef); + + auto to_expected = [rc_cdef] (int val) { + return std::vector{{rc_cdef, int32_type->decompose(int32_t(val))}}; + }; + + auto r = assert_that(sst.read_range_rows_flat(query::full_partition_range, + s->full_slice(), + default_priority_class(), + no_resource_tracking(), + streamed_mutation::forwarding::yes)); + r.produces_partition_start(to_pkey(0)) + .produces_end_of_stream(); + + r.fast_forward_to(to_ckey(2), to_ckey(3)); + r.produces_end_of_stream(); + + r.fast_forward_to(to_ckey(4), to_ckey(5)); + r.produces_end_of_stream(); + + r.fast_forward_to(to_ckey(6), to_ckey(9)); + r.produces_row(to_ckey(7), to_expected(7)) + .produces_row(to_ckey(8), to_expected(8)) + .produces_end_of_stream(); +} + diff --git a/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-CRC.db b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-CRC.db new file mode 100644 index 0000000000000000000000000000000000000000..c834c6f74c398910deaeaa2ce4213a5bc0e4fb78 GIT binary patch literal 8 PcmZQzWMEjhmTxrx1z`dS literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Data.db b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Data.db new file mode 100644 index 0000000000000000000000000000000000000000..88ee607435f86cba9e7725108b0f2722105e1070 GIT binary patch literal 50 qcmZQzVE}^q|Ns9tfEYla0wUPig%~(MG?>T1#rGhIzY!$B!3Y4wvIctq literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Digest.crc32 b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Digest.crc32 new file mode 100644 index 0000000000..b76a5076c6 --- /dev/null +++ b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Digest.crc32 @@ -0,0 +1 @@ +2712473259 \ No newline at end of file diff --git a/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Filter.db b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Filter.db new file mode 100644 index 0000000000000000000000000000000000000000..157a4de7cff17365433da137f823747e58804d15 GIT binary patch literal 16 XcmZQzU|?lnU|?imQefz4U|;|M1jqp~ literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Index.db b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Index.db new file mode 100644 index 0000000000000000000000000000000000000000..f9376371f57ea150ba2e6002d905fabebd52132f GIT binary patch literal 8 LcmZQzVE_XF03-kf literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Statistics.db b/tests/sstables/3.x/uncompressed/read_two_rows_fast_forwarding/mc-1-big-Statistics.db new file mode 100644 index 0000000000000000000000000000000000000000..9e22137a456a95a0e428991dff83c994262cc09a GIT binary patch literal 4659 zcmeI$drTBZ90%~7y*oG%uHJzNG}2bV2Q{bRq)4Jt^(>sJ5kUp}P?zHrOnGGQtVnHa zEd8UTK{U1a#HtA~NF<7_KnYd%y3bfB0|Hn`E-{ z+28E#%Cmh*Ey-=MjqQlOP`@lU!!B*LC5!?U!8`YxF2oKN2l#W&pU)A(qOt&2J; zEeYoHSi_T@H2(6DZFi_&n~`;#deZg0S=7@m7agTeU;S}Cwe{xoJnEeNC8^Z*q;KD( z{_yX}0qU9`8#AeoH24l*(d4xXWlOjbp4AC zci(s9da=K0P9?F%#oXJ8wTYKZHtNB_P4xNb{;J(U-yfk- zNVVMUGLU#i?{DoJh~M7Z+(g^+t|vW}&gaq`YeOxmUscfB-A`P9>-MPz;*NudnrVC8 zoyk3EfjBdLdj8owV%xe$PqzdtIQ?b(4-V|X)bk>_##j8m?77r#r>F)05!SeJF1Y7{ z0SfN9U^s-}o(sk!xaSJ)xyXe0Z|%9*nzsrrRIu-Vi4}Akst(R?tEpl@