mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
Test that schema digests with UDFs don't change
This refactors test_schema_digest_does_not_change to also test a schema with user defined functions and user defined aggregates. Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
This commit is contained in:
@@ -575,7 +575,7 @@ SEASTAR_TEST_CASE(test_prepared_statement_is_invalidated_by_schema_change) {
|
||||
|
||||
// We don't want schema digest to change between Scylla versions because that results in a schema disagreement
|
||||
// during rolling upgrade.
|
||||
future<> test_schema_digest_does_not_change_with_disabled_features(sstring data_dir, std::set<sstring> disabled_features, std::vector<utils::UUID> expected_digests) {
|
||||
future<> test_schema_digest_does_not_change_with_disabled_features(sstring data_dir, std::set<sstring> disabled_features, std::vector<utils::UUID> expected_digests, std::function<void(cql_test_env& e)> extra_schema_changes) {
|
||||
using namespace db;
|
||||
using namespace db::schema_tables;
|
||||
|
||||
@@ -588,6 +588,7 @@ future<> test_schema_digest_does_not_change_with_disabled_features(sstring data_
|
||||
|
||||
auto db_cfg_ptr = make_shared<db::config>();
|
||||
auto& db_cfg = *db_cfg_ptr;
|
||||
db_cfg.enable_user_defined_functions({true}, db::config::config_source::CommandLine);
|
||||
if (regenerate) {
|
||||
db_cfg.data_file_directories({data_dir}, db::config::config_source::CommandLine);
|
||||
} else {
|
||||
@@ -597,7 +598,7 @@ future<> test_schema_digest_does_not_change_with_disabled_features(sstring data_
|
||||
cql_test_config cfg_in(db_cfg_ptr);
|
||||
cfg_in.disabled_features = std::move(disabled_features);
|
||||
|
||||
return do_with_cql_env_thread([regenerate, expected_digests = std::move(expected_digests)](cql_test_env& e) {
|
||||
return do_with_cql_env_thread([regenerate, expected_digests = std::move(expected_digests), extra_schema_changes = std::move(extra_schema_changes)] (cql_test_env& e) {
|
||||
if (regenerate) {
|
||||
// Exercise many different kinds of schema changes.
|
||||
e.execute_cql(
|
||||
@@ -613,6 +614,7 @@ future<> test_schema_digest_does_not_change_with_disabled_features(sstring data_
|
||||
e.execute_cql(
|
||||
"create keyspace tests2 with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };").get();
|
||||
e.execute_cql("drop keyspace tests2;").get();
|
||||
extra_schema_changes(e);
|
||||
}
|
||||
|
||||
auto expect_digest = [&] (schema_features sf, utils::UUID expected) {
|
||||
@@ -673,7 +675,7 @@ SEASTAR_TEST_CASE(test_schema_digest_does_not_change) {
|
||||
utils::UUID("1d91ad22-ea7c-3e7f-9557-87f0f3bb94d7"),
|
||||
utils::UUID("2dcd4a37-cbb5-399b-b3c9-8eb1398b096b")
|
||||
};
|
||||
return test_schema_digest_does_not_change_with_disabled_features("./tests/sstables/schema_digest_test", std::set<sstring>{"COMPUTED_COLUMNS"}, std::move(expected_digests));
|
||||
return test_schema_digest_does_not_change_with_disabled_features("./tests/sstables/schema_digest_test", std::set<sstring>{"COMPUTED_COLUMNS"}, std::move(expected_digests), [] (cql_test_env& e) {});
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_schema_digest_does_not_change_after_computed_columns) {
|
||||
@@ -688,5 +690,28 @@ SEASTAR_TEST_CASE(test_schema_digest_does_not_change_after_computed_columns) {
|
||||
utils::UUID("d58e5214-516e-3d0b-95b5-01ab71584a8d"),
|
||||
utils::UUID("e1b50bed-2ab8-3759-92c7-1f4288046ae6")
|
||||
};
|
||||
return test_schema_digest_does_not_change_with_disabled_features("./tests/sstables/schema_digest_test_computed_columns", std::set<sstring>{}, std::move(expected_digests));
|
||||
return test_schema_digest_does_not_change_with_disabled_features("./tests/sstables/schema_digest_test_computed_columns", std::set<sstring>{}, std::move(expected_digests), [] (cql_test_env& e) {});
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_schema_digest_does_not_change_with_functions) {
|
||||
std::vector<utils::UUID> expected_digests{
|
||||
utils::UUID("2ed81876-3870-349e-a1fe-56c2db5d887a"),
|
||||
utils::UUID("c8deb566-5669-339f-84f7-b27ef42a7c9b"),
|
||||
utils::UUID("c8deb566-5669-339f-84f7-b27ef42a7c9b"),
|
||||
utils::UUID("e1b63e8d-c209-3f4f-9ceb-64b646658b19"),
|
||||
utils::UUID("e1b63e8d-c209-3f4f-9ceb-64b646658b19"),
|
||||
utils::UUID("58934682-1b73-3ab7-ac9d-4129f9ddf147"),
|
||||
utils::UUID("c5b294c5-8f50-3be1-be39-2e2e21e6957c"),
|
||||
utils::UUID("467c27ed-a979-3705-afbf-105233220846"),
|
||||
utils::UUID("0678bd76-3b67-3901-bad1-424d51b13d7b")
|
||||
};
|
||||
return test_schema_digest_does_not_change_with_disabled_features(
|
||||
"./tests/sstables/schema_digest_with_functions_test",
|
||||
std::set<sstring>{},
|
||||
std::move(expected_digests),
|
||||
[] (cql_test_env& e) {
|
||||
e.execute_cql("create function twice(val int) called on null input returns int language lua as 'return 2 * val';").get();
|
||||
e.execute_cql("create function my_add(a int, b int) called on null input returns int language lua as 'return a + b';").get();
|
||||
e.execute_cql("create aggregate my_agg(int) sfunc my_add stype int finalfunc twice;").get();
|
||||
});
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
4228182466
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2901583446
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
1051884921
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
4222568219
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2664764726
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
4046539671
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2051958108
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
2664764726
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
1028582781
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
3730466410
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
3664263782
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
CompressionInfo.db
|
||||
Filter.db
|
||||
Data.db
|
||||
Statistics.db
|
||||
TOC.txt
|
||||
Digest.crc32
|
||||
Scylla.db
|
||||
Index.db
|
||||
Summary.db
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user