Skip to content

Commit

Permalink
Add a config for arbitrary config tests where all the tables are null…
Browse files Browse the repository at this point in the history
…-shard-key tables (#6783/#6788)
  • Loading branch information
onurctirtir committed Apr 18, 2023
1 parent 8d370f8 commit be3f83d
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions src/test/regress/citus_tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
"sql_schedule",
"sql_base_schedule",
"postgres_schedule",
"null_dist_key_prep_schedule",
]

BEFORE_PG_UPGRADE_SCHEDULE = "./before_pg_upgrade_schedule"
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"

Expand Down Expand Up @@ -98,6 +100,7 @@ def __init__(self, arguments):
self.user = REGULAR_USER_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",
Expand Down Expand Up @@ -200,6 +203,49 @@ def __init__(self, arguments):
]


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)
Expand Down
13 changes: 13 additions & 0 deletions src/test/regress/expected/null_dist_key_prep.out
Original file line number Diff line number Diff line change
@@ -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$;
1 change: 1 addition & 0 deletions src/test/regress/null_dist_key_prep_schedule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test: null_dist_key_prep
14 changes: 14 additions & 0 deletions src/test/regress/sql/null_dist_key_prep.sql
Original file line number Diff line number Diff line change
@@ -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$;

0 comments on commit be3f83d

Please sign in to comment.