From ac0ffc9839782478a4400dc77667b5101f9a6f64 Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Wed, 22 Mar 2023 11:13:31 +0300 Subject: [PATCH] Add a config for arbitrary config tests where all the tables are null-shard-key tables (#6783/#6788) --- .../citus_arbitrary_configs.py | 11 +++++ src/test/regress/citus_tests/config.py | 46 +++++++++++++++++++ .../regress/expected/null_dist_key_prep.out | 13 ++++++ src/test/regress/null_dist_key_prep_schedule | 1 + src/test/regress/sql/null_dist_key_prep.sql | 14 ++++++ 5 files changed, 85 insertions(+) create mode 100644 src/test/regress/expected/null_dist_key_prep.out create mode 100644 src/test/regress/null_dist_key_prep_schedule create mode 100644 src/test/regress/sql/null_dist_key_prep.sql diff --git a/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py b/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py index 6c9863434..8785de8f7 100755 --- a/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py +++ b/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py @@ -76,6 +76,17 @@ def run_for_config(config, lock, sql_schedule_name): cfg.SUPER_USER_NAME, ) common.save_regression_diff("postgres", config.output_dir) + elif config.all_null_dist_key: + exitCode |= common.run_pg_regress_without_exit( + config.bindir, + config.pg_srcdir, + config.coordinator_port(), + cfg.NULL_DIST_KEY_PREP_SCHEDULE, + config.output_dir, + config.input_dir, + cfg.SUPER_USER_NAME, + ) + common.save_regression_diff("null_dist_key_prep_regression", config.output_dir) exitCode |= _run_pg_regress_on_port( config, config.coordinator_port(), cfg.CREATE_SCHEDULE diff --git a/src/test/regress/citus_tests/config.py b/src/test/regress/citus_tests/config.py index 3dc47671b..cd1be125b 100644 --- a/src/test/regress/citus_tests/config.py +++ b/src/test/regress/citus_tests/config.py @@ -22,6 +22,7 @@ ARBITRARY_SCHEDULE_NAMES = [ "sql_schedule", "sql_base_schedule", "postgres_schedule", + "null_dist_key_prep_schedule", ] BEFORE_PG_UPGRADE_SCHEDULE = "./before_pg_upgrade_schedule" @@ -29,6 +30,7 @@ AFTER_PG_UPGRADE_SCHEDULE = "./after_pg_upgrade_schedule" CREATE_SCHEDULE = "./create_schedule" POSTGRES_SCHEDULE = "./postgres_schedule" +NULL_DIST_KEY_PREP_SCHEDULE = "./null_dist_key_prep_schedule" SQL_SCHEDULE = "./sql_schedule" SQL_BASE_SCHEDULE = "./sql_base_schedule" @@ -101,6 +103,7 @@ class CitusBaseClusterConfig(object, metaclass=NewInitCaller): self.dbname = DATABASE_NAME self.is_mx = True self.is_citus = True + self.all_null_dist_key = False self.name = type(self).__name__ self.settings = { "shared_preload_libraries": "citus", @@ -203,6 +206,49 @@ class PostgresConfig(CitusDefaultClusterConfig): ] +class AllNullDistKeyDefaultConfig(CitusDefaultClusterConfig): + def __init__(self, arguments): + super().__init__(arguments) + self.all_null_dist_key = True + self.skip_tests += [ + # i) Skip the following tests because they require SQL support beyond + # router planner / supporting more DDL command types. + # + # group 1 + "dropped_columns_create_load", + "dropped_columns_1", + # group 2 + "distributed_planning_create_load", + "distributed_planning", + # group 4 + "views_create", + "views", + # group 5 + "intermediate_result_pruning_create", + "intermediate_result_pruning_queries_1", + "intermediate_result_pruning_queries_2", + # group 6 + "local_dist_join_load", + "local_dist_join", + "arbitrary_configs_recurring_outer_join", + # group 7 + "sequences_create", + "sequences", + # group 8 + "function_create", + "functions", + # group 9 + "merge_arbitrary_create", + "merge_arbitrary", + # group 10 + "arbitrary_configs_router_create", + "arbitrary_configs_router", + # + # ii) Skip the following test as it requires support for create_distributed_function. + "nested_execution", + ] + + class CitusSingleNodeClusterConfig(CitusDefaultClusterConfig): def __init__(self, arguments): super().__init__(arguments) diff --git a/src/test/regress/expected/null_dist_key_prep.out b/src/test/regress/expected/null_dist_key_prep.out new file mode 100644 index 000000000..7a861b06f --- /dev/null +++ b/src/test/regress/expected/null_dist_key_prep.out @@ -0,0 +1,13 @@ +ALTER FUNCTION create_distributed_table RENAME TO create_distributed_table_internal; +CREATE OR REPLACE FUNCTION pg_catalog.create_distributed_table(table_name regclass, + distribution_column text, + distribution_type citus.distribution_type DEFAULT 'hash', + colocate_with text DEFAULT 'default', + shard_count int DEFAULT NULL) +RETURNS void +LANGUAGE plpgsql +AS $function$ +BEGIN + PERFORM create_distributed_table_internal(table_name, NULL, NULL, colocate_with, NULL); +END; +$function$; diff --git a/src/test/regress/null_dist_key_prep_schedule b/src/test/regress/null_dist_key_prep_schedule new file mode 100644 index 000000000..1a43130ec --- /dev/null +++ b/src/test/regress/null_dist_key_prep_schedule @@ -0,0 +1 @@ +test: null_dist_key_prep diff --git a/src/test/regress/sql/null_dist_key_prep.sql b/src/test/regress/sql/null_dist_key_prep.sql new file mode 100644 index 000000000..5a9a3ac01 --- /dev/null +++ b/src/test/regress/sql/null_dist_key_prep.sql @@ -0,0 +1,14 @@ +ALTER FUNCTION create_distributed_table RENAME TO create_distributed_table_internal; + +CREATE OR REPLACE FUNCTION pg_catalog.create_distributed_table(table_name regclass, + distribution_column text, + distribution_type citus.distribution_type DEFAULT 'hash', + colocate_with text DEFAULT 'default', + shard_count int DEFAULT NULL) +RETURNS void +LANGUAGE plpgsql +AS $function$ +BEGIN + PERFORM create_distributed_table_internal(table_name, NULL, NULL, colocate_with, NULL); +END; +$function$;