From a7a152b27ff910b37403e349fdf6fc0ed45c6d30 Mon Sep 17 00:00:00 2001 From: Piotr Jastrzebski Date: Mon, 28 May 2018 10:19:38 +0200 Subject: [PATCH] Add test_uncompressed_compound_ck_read for SSTables 3.x Signed-off-by: Piotr Jastrzebski --- tests/sstable_3_x_test.cc | 102 ++++++++++++++++++ .../uncompressed/compound_ck/mc-1-big-CRC.db | Bin 0 -> 8 bytes .../uncompressed/compound_ck/mc-1-big-Data.db | Bin 0 -> 397 bytes .../compound_ck/mc-1-big-Digest.crc32 | 1 + .../compound_ck/mc-1-big-Filter.db | Bin 0 -> 24 bytes .../compound_ck/mc-1-big-Index.db | Bin 0 -> 43 bytes .../compound_ck/mc-1-big-Statistics.db | Bin 0 -> 4902 bytes .../compound_ck/mc-1-big-Summary.db | Bin 0 -> 56 bytes .../uncompressed/compound_ck/mc-1-big-TOC.txt | 8 ++ 9 files changed, 111 insertions(+) create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-CRC.db create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Data.db create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Digest.crc32 create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Filter.db create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Index.db create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Statistics.db create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Summary.db create mode 100644 tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-TOC.txt diff --git a/tests/sstable_3_x_test.cc b/tests/sstable_3_x_test.cc index 86686bb242..fa95bb38e5 100644 --- a/tests/sstable_3_x_test.cc +++ b/tests/sstable_3_x_test.cc @@ -487,6 +487,108 @@ SEASTAR_TEST_CASE(test_uncompressed_simple_read) { }); } +// Following tests run on files in tests/sstables/3.x/uncompressed/simple +// 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, +// ck_int INT, +// ck_text TEXT, +// ck_uuid UUID, +// ck_inet INET, +// val INT, +// PRIMARY KEY(pk, ck_int, ck_text, ck_uuid, ck_inet)) +// WITH compression = { 'enabled' : false }; +// +// INSERT INTO test_ks.test_table(pk, ck_int, ck_text, ck_uuid, ck_inet, val) +// VALUES(1, 101, 'This is a string for 1', f7fdcbd2-4544-482c-85fd-d9572adc3cd6, '10.0.0.1', 1001); +// INSERT INTO test_ks.test_table(pk, ck_int, ck_text, ck_uuid, ck_inet, val) +// VALUES(2, 102, 'This is a string for 2', c25ae960-07a2-467d-8f35-5bd38647b367, '10.0.0.2', 1002); +// INSERT INTO test_ks.test_table(pk, ck_int, ck_text, ck_uuid, ck_inet, val) +// VALUES(3, 103, 'This is a string for 3', f7e8ebc0-dbae-4c06-bae0-656c23f6af6a, '10.0.0.3', 1003); +// INSERT INTO test_ks.test_table(pk, ck_int, ck_text, ck_uuid, ck_inet, val) +// VALUES(4, 104, 'This is a string for 4', 4549e2c2-786e-4b30-90aa-5dd37ae1db8f, '10.0.0.4', 1004); +// INSERT INTO test_ks.test_table(pk, ck_int, ck_text, ck_uuid, ck_inet, val) +// VALUES(5, 105, 'This is a string for 5', f1badb6f-80a0-4eef-90df-b3651d9a5578, '10.0.0.5', 1005); + +static thread_local const sstring UNCOMPRESSED_COMPOUND_CK_PATH = "tests/sstables/3.x/uncompressed/compound_ck"; +static thread_local const schema_ptr UNCOMPRESSED_COMPOUND_CK_SCHEMA = + schema_builder("test_ks", "test_table") + .with_column("pk", int32_type, column_kind::partition_key) + .with_column("ck_int", int32_type, column_kind::clustering_key) + .with_column("ck_text", utf8_type, column_kind::clustering_key) + .with_column("ck_uuid", uuid_type, column_kind::clustering_key) + .with_column("ck_inet", inet_addr_type, column_kind::clustering_key) + .with_column("val", int32_type) + .build(); + +SEASTAR_TEST_CASE(test_uncompressed_compound_ck_read) { + return seastar::async([] { + sstable_assertions sst(UNCOMPRESSED_COMPOUND_CK_SCHEMA, + UNCOMPRESSED_COMPOUND_CK_PATH); + sst.load(); + auto to_key = [] (int key) { + auto bytes = int32_type->decompose(int32_t(key)); + auto pk = partition_key::from_single_value(*UNCOMPRESSED_COMPOUND_CK_SCHEMA, bytes); + return dht::global_partitioner().decorate_key(*UNCOMPRESSED_COMPOUND_CK_SCHEMA, pk); + }; + + auto int_cdef = + UNCOMPRESSED_SIMPLE_SCHEMA->get_column_definition(to_bytes("val")); + BOOST_REQUIRE(int_cdef); + + + assert_that(sst.read_rows_flat()) + .produces_partition_start(to_key(5)) + .produces_row(clustering_key::from_exploded(*UNCOMPRESSED_SIMPLE_SCHEMA, { + int32_type->decompose(105), + utf8_type->from_string("This is a string for 5"), + uuid_type->from_string("f1badb6f-80a0-4eef-90df-b3651d9a5578"), + inet_addr_type->from_string("10.0.0.5") + }), + {{int_cdef, int32_type->decompose(1005)}}) + .produces_partition_end() + .produces_partition_start(to_key(1)) + .produces_row(clustering_key::from_exploded(*UNCOMPRESSED_SIMPLE_SCHEMA, { + int32_type->decompose(101), + utf8_type->from_string("This is a string for 1"), + uuid_type->from_string("f7fdcbd2-4544-482c-85fd-d9572adc3cd6"), + inet_addr_type->from_string("10.0.0.1") + }), + {{int_cdef, int32_type->decompose(1001)}}) + .produces_partition_end() + .produces_partition_start(to_key(2)) + .produces_row(clustering_key::from_exploded(*UNCOMPRESSED_SIMPLE_SCHEMA, { + int32_type->decompose(102), + utf8_type->from_string("This is a string for 2"), + uuid_type->from_string("c25ae960-07a2-467d-8f35-5bd38647b367"), + inet_addr_type->from_string("10.0.0.2") + }), + {{int_cdef, int32_type->decompose(1002)}}) + .produces_partition_end() + .produces_partition_start(to_key(4)) + .produces_row(clustering_key::from_exploded(*UNCOMPRESSED_SIMPLE_SCHEMA, { + int32_type->decompose(104), + utf8_type->from_string("This is a string for 4"), + uuid_type->from_string("4549e2c2-786e-4b30-90aa-5dd37ae1db8f"), + inet_addr_type->from_string("10.0.0.4") + }), + {{int_cdef, int32_type->decompose(1004)}}) + .produces_partition_end() + .produces_partition_start(to_key(3)) + .produces_row(clustering_key::from_exploded(*UNCOMPRESSED_SIMPLE_SCHEMA, { + int32_type->decompose(103), + utf8_type->from_string("This is a string for 3"), + uuid_type->from_string("f7e8ebc0-dbae-4c06-bae0-656c23f6af6a"), + inet_addr_type->from_string("10.0.0.3") + }), + {{int_cdef, int32_type->decompose(1003)}}) + .produces_partition_end() + .produces_end_of_stream(); + }); +} + static void compare_files(sstring filename1, sstring filename2) { std::ifstream ifs1(filename1); std::ifstream ifs2(filename2); diff --git a/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-CRC.db b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-CRC.db new file mode 100644 index 0000000000000000000000000000000000000000..06cca5a416f0758e0dbc024fc752e71402da3516 GIT binary patch literal 8 PcmZQzWMEisxn&ao1#kjL literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Data.db b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Data.db new file mode 100644 index 0000000000000000000000000000000000000000..74147a770fff8161fa1e4b6c1af59912738a1728 GIT binary patch literal 397 zcmZQzVPIfjt^fc3e*=&K0xBRPQ!FGSvseL$5*3O|iZb)k71HvH6ih$vx}D#!!0-Kp z`^?Y=wBG21k!m8NIRS$3XgUn+Andi6|WZoNydCVB*rDHeG`1_032X3$PVcYc} WHAnf|`Ye!n%pmg&ri09T%?JR719sp5 literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Digest.crc32 b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Digest.crc32 new file mode 100644 index 0000000000..8d3b1e3e7c --- /dev/null +++ b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Digest.crc32 @@ -0,0 +1 @@ +2805576882 \ No newline at end of file diff --git a/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Filter.db b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Filter.db new file mode 100644 index 0000000000000000000000000000000000000000..e72c7521e97757f1fe3605b8cc6c164fcecc1c52 GIT binary patch literal 24 fcmZQzU|?lnU|?!c&|qj_(-2c+5^_4hpuhkC8+QWp literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Index.db b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Index.db new file mode 100644 index 0000000000000000000000000000000000000000..380fb31ff96a96968122fbce399eb33638ecb8de GIT binary patch literal 43 hcmZQzVPIfj1!54*7yzM}8s%{HXAiIwPdN73f+~x@&BKx!H<2|Gn_f+ zxBqkRo^$TGdk>co!js9AA{C63*GQR_@+K*Bgy`bQOLTX!|@NZjkv!H-N#OpHe*Fp3X{E^^n~_bYqP9956{ zyvzZwUnRwxr5sGbFNKMAurn}8okB?-fc&9Cu7pY@<=}V2q=t~{8p@HBwUlEh$5Eb5 zc@E`d%4w7rQO>5EAF@2|)l|Ha@@C3AD7RA{#Ac}L!8}F9J(PQ~*;$mgVsq5_x!pL< zmtZT5*vh5YDr&syJ2^*pWGJy*y&KBYOnf(fzD?5YQ^E_Vv{Q1); zt~l9Gsa_)wKlvSW6VFJcwBcp^6V>#$a4k@k(1Bj>zy`+ueY)3 zIBLIi_($Ytb8!FGB>GW&-LE?2H&?YG@4CGhx$AR0KbO1Ed@`Eo8?ZfN%6l7m%iM#= zr%q%*v-3L9?<>1g`z?%fiM42baNTPoV4SawSO%?lc@T|PS?#QaaaEW9CUk^3_fO~< zNj>O(iYn8cgYjt2(gz)zm5SE$EbZ<0VEo}j+pj@C`egpc(DS}4&4x}t=Qskrr2LJ& z(B_L7rO<`@sxqOisU1&4Z~QB21iJAHUmo%*s{szad9g4XI#~*V(zg-8~&lDPJ;PW8ipsB|I;z?hQ z=-~BAxt?cf0P%$-fmFC3$Ta@arv-7-;7>iT0k7QMb{O{OrNEL*xSm~w=GG?A-doYt zKMcJ0(&b~Vz`Y0FZ-f2ypGX_Xnu;^Jw@%+(4s2O>&Hjs8nOLTo2u~lU$xjte6hpn)=Pha-t7^cu1fu@)uR3h z5}j-L;j>!Ta~Vy(wcpfT{eBzaHIr{gCXaOf$B~&N`qsTu1G(n>h4uG_O4BZ7U$}py z{A?$3MJnaN#HplyNt*y@xo$SyUD^3ZeSHTZ3;zAhPlcgM5Zw-8y}{!07#9_9sE-!n1c<|r#qv?W%uORY@*%m4z?!@w^3OC;645uk-+0c literal 0 HcmV?d00001 diff --git a/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Summary.db b/tests/sstables/3.x/uncompressed/compound_ck/mc-1-big-Summary.db new file mode 100644 index 0000000000000000000000000000000000000000..ab6bd5d065001dab321da058d45d4d71968b5047 GIT binary patch literal 56 mcmZQzU}#`qU|