mirror of https://github.com/citusdata/citus.git
Separate superuser files
parent
7ae7c42775
commit
34f91b4aa6
|
@ -2,7 +2,7 @@
|
||||||
# Only run few basic tests to set up a testing environment
|
# Only run few basic tests to set up a testing environment
|
||||||
# ----------
|
# ----------
|
||||||
test: multi_cluster_management
|
test: multi_cluster_management
|
||||||
test: multi_test_helpers multi_create_fdw
|
test: multi_test_helpers multi_test_helpers_superuser multi_create_fdw
|
||||||
test: multi_test_catalog_views
|
test: multi_test_catalog_views
|
||||||
test: multi_create_table multi_behavioral_analytics_create_table
|
test: multi_create_table multi_behavioral_analytics_create_table
|
||||||
test: multi_load_data
|
test: multi_load_data
|
||||||
|
|
|
@ -80,45 +80,6 @@ BEGIN
|
||||||
RETURN true;
|
RETURN true;
|
||||||
END;
|
END;
|
||||||
$func$;
|
$func$;
|
||||||
CREATE OR REPLACE FUNCTION wait_until_metadata_sync(timeout INTEGER DEFAULT 15000)
|
|
||||||
RETURNS void
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'citus';
|
|
||||||
-- set sync intervals to less than 15s so wait_until_metadata_sync never times out
|
|
||||||
ALTER SYSTEM SET citus.metadata_sync_interval TO 3000;
|
|
||||||
ALTER SYSTEM SET citus.metadata_sync_retry_interval TO 500;
|
|
||||||
SELECT pg_reload_conf();
|
|
||||||
pg_reload_conf
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
t
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- Verifies pg_dist_node and pg_dist_palcement in the given worker matches the ones in coordinator
|
|
||||||
CREATE OR REPLACE FUNCTION verify_metadata(hostname TEXT, port INTEGER, master_port INTEGER DEFAULT xxxxx)
|
|
||||||
RETURNS BOOLEAN
|
|
||||||
LANGUAGE sql
|
|
||||||
AS $$
|
|
||||||
SELECT wait_until_metadata_sync();
|
|
||||||
WITH dist_node_summary AS (
|
|
||||||
SELECT 'SELECT jsonb_agg(ROW(nodeid, groupid, nodename, nodeport, isactive) ORDER BY nodeid) FROM pg_dist_node' as query
|
|
||||||
), dist_node_check AS (
|
|
||||||
SELECT count(distinct result) = 1 AS matches
|
|
||||||
FROM dist_node_summary CROSS JOIN LATERAL
|
|
||||||
master_run_on_worker(ARRAY[hostname, '<host>'], ARRAY[port, master_port],
|
|
||||||
ARRAY[dist_node_summary.query, dist_node_summary.query],
|
|
||||||
false)
|
|
||||||
), dist_placement_summary AS (
|
|
||||||
SELECT 'SELECT jsonb_agg(pg_dist_placement ORDER BY shardid) FROM pg_dist_placement)' AS query
|
|
||||||
), dist_placement_check AS (
|
|
||||||
SELECT count(distinct result) = 1 AS matches
|
|
||||||
FROM dist_placement_summary CROSS JOIN LATERAL
|
|
||||||
master_run_on_worker(ARRAY[hostname, '<host>'], ARRAY[port, master_port],
|
|
||||||
ARRAY[dist_placement_summary.query, dist_placement_summary.query],
|
|
||||||
false)
|
|
||||||
)
|
|
||||||
SELECT dist_node_check.matches AND dist_placement_check.matches
|
|
||||||
FROM dist_node_check CROSS JOIN dist_placement_check
|
|
||||||
$$;
|
|
||||||
--
|
--
|
||||||
-- Procedure for creating shards for range partitioned distributed table.
|
-- Procedure for creating shards for range partitioned distributed table.
|
||||||
--
|
--
|
||||||
|
@ -135,15 +96,3 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
-- partition_task_list_results tests the internal PartitionTasklistResults function
|
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.partition_task_list_results(resultIdPrefix text,
|
|
||||||
query text,
|
|
||||||
target_table regclass,
|
|
||||||
binaryFormat bool DEFAULT true)
|
|
||||||
RETURNS TABLE(resultId text,
|
|
||||||
nodeId int,
|
|
||||||
rowCount bigint,
|
|
||||||
targetShardId bigint,
|
|
||||||
targetShardIndex int)
|
|
||||||
LANGUAGE C STRICT VOLATILE
|
|
||||||
AS 'citus', $$partition_task_list_results$$;
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
--
|
||||||
|
-- Helper UDFs which require superuser permissions
|
||||||
|
--
|
||||||
|
CREATE OR REPLACE FUNCTION wait_until_metadata_sync(timeout INTEGER DEFAULT 15000)
|
||||||
|
RETURNS void
|
||||||
|
LANGUAGE C STRICT
|
||||||
|
AS 'citus';
|
||||||
|
-- set sync intervals to less than 15s so wait_until_metadata_sync never times out
|
||||||
|
ALTER SYSTEM SET citus.metadata_sync_interval TO 3000;
|
||||||
|
ALTER SYSTEM SET citus.metadata_sync_retry_interval TO 500;
|
||||||
|
SELECT pg_reload_conf();
|
||||||
|
pg_reload_conf
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
-- Verifies pg_dist_node and pg_dist_palcement in the given worker matches the ones in coordinator
|
||||||
|
CREATE OR REPLACE FUNCTION verify_metadata(hostname TEXT, port INTEGER, master_port INTEGER DEFAULT xxxxx)
|
||||||
|
RETURNS BOOLEAN
|
||||||
|
LANGUAGE sql
|
||||||
|
AS $$
|
||||||
|
SELECT wait_until_metadata_sync();
|
||||||
|
WITH dist_node_summary AS (
|
||||||
|
SELECT 'SELECT jsonb_agg(ROW(nodeid, groupid, nodename, nodeport, isactive) ORDER BY nodeid) FROM pg_dist_node' as query
|
||||||
|
), dist_node_check AS (
|
||||||
|
SELECT count(distinct result) = 1 AS matches
|
||||||
|
FROM dist_node_summary CROSS JOIN LATERAL
|
||||||
|
master_run_on_worker(ARRAY[hostname, '<host>'], ARRAY[port, master_port],
|
||||||
|
ARRAY[dist_node_summary.query, dist_node_summary.query],
|
||||||
|
false)
|
||||||
|
), dist_placement_summary AS (
|
||||||
|
SELECT 'SELECT jsonb_agg(pg_dist_placement ORDER BY shardid) FROM pg_dist_placement)' AS query
|
||||||
|
), dist_placement_check AS (
|
||||||
|
SELECT count(distinct result) = 1 AS matches
|
||||||
|
FROM dist_placement_summary CROSS JOIN LATERAL
|
||||||
|
master_run_on_worker(ARRAY[hostname, '<host>'], ARRAY[port, master_port],
|
||||||
|
ARRAY[dist_placement_summary.query, dist_placement_summary.query],
|
||||||
|
false)
|
||||||
|
)
|
||||||
|
SELECT dist_node_check.matches AND dist_placement_check.matches
|
||||||
|
FROM dist_node_check CROSS JOIN dist_placement_check
|
||||||
|
$$;
|
||||||
|
-- partition_task_list_results tests the internal PartitionTasklistResults function
|
||||||
|
CREATE OR REPLACE FUNCTION pg_catalog.partition_task_list_results(resultIdPrefix text,
|
||||||
|
query text,
|
||||||
|
target_table regclass,
|
||||||
|
binaryFormat bool DEFAULT true)
|
||||||
|
RETURNS TABLE(resultId text,
|
||||||
|
nodeId int,
|
||||||
|
rowCount bigint,
|
||||||
|
targetShardId bigint,
|
||||||
|
targetShardIndex int)
|
||||||
|
LANGUAGE C STRICT VOLATILE
|
||||||
|
AS 'citus', $$partition_task_list_results$$;
|
|
@ -14,7 +14,7 @@
|
||||||
# Tests around schema changes, these are run first, so there's no preexisting objects.
|
# Tests around schema changes, these are run first, so there's no preexisting objects.
|
||||||
# ---
|
# ---
|
||||||
test: multi_extension
|
test: multi_extension
|
||||||
test: multi_test_helpers
|
test: multi_test_helpers multi_test_helpers_superuser
|
||||||
test: multi_mx_node_metadata
|
test: multi_mx_node_metadata
|
||||||
test: multi_cluster_management
|
test: multi_cluster_management
|
||||||
test: multi_mx_function_table_reference
|
test: multi_mx_function_table_reference
|
||||||
|
|
|
@ -25,7 +25,7 @@ test: multi_cluster_management
|
||||||
test: alter_role_propagation
|
test: alter_role_propagation
|
||||||
test: propagate_extension_commands
|
test: propagate_extension_commands
|
||||||
test: escape_extension_name
|
test: escape_extension_name
|
||||||
test: multi_test_helpers
|
test: multi_test_helpers multi_test_helpers_superuser
|
||||||
test: multi_test_catalog_views
|
test: multi_test_catalog_views
|
||||||
test: multi_table_ddl
|
test: multi_table_ddl
|
||||||
test: multi_name_lengths
|
test: multi_name_lengths
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
# remove / add node operations, we do not want any preexisting objects before
|
# remove / add node operations, we do not want any preexisting objects before
|
||||||
# propagate_extension_commands
|
# propagate_extension_commands
|
||||||
# ---
|
# ---
|
||||||
test: multi_test_helpers_shadow
|
test: multi_test_helpers
|
||||||
test: multi_test_catalog_views
|
test: multi_test_catalog_views
|
||||||
test: multi_name_resolution
|
test: multi_name_resolution
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
# remove / add node operations, we do not want any preexisting objects before
|
# remove / add node operations, we do not want any preexisting objects before
|
||||||
# propagate_extension_commands
|
# propagate_extension_commands
|
||||||
# ---
|
# ---
|
||||||
test: multi_test_helpers
|
test: multi_test_helpers multi_test_helpers_superuser
|
||||||
test: multi_test_catalog_views
|
test: multi_test_catalog_views
|
||||||
test: multi_name_lengths
|
test: multi_name_lengths
|
||||||
test: multi_name_resolution
|
test: multi_name_resolution
|
||||||
|
|
|
@ -88,43 +88,6 @@ BEGIN
|
||||||
END;
|
END;
|
||||||
$func$;
|
$func$;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION wait_until_metadata_sync(timeout INTEGER DEFAULT 15000)
|
|
||||||
RETURNS void
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'citus';
|
|
||||||
|
|
||||||
-- set sync intervals to less than 15s so wait_until_metadata_sync never times out
|
|
||||||
ALTER SYSTEM SET citus.metadata_sync_interval TO 3000;
|
|
||||||
ALTER SYSTEM SET citus.metadata_sync_retry_interval TO 500;
|
|
||||||
SELECT pg_reload_conf();
|
|
||||||
|
|
||||||
-- Verifies pg_dist_node and pg_dist_palcement in the given worker matches the ones in coordinator
|
|
||||||
CREATE OR REPLACE FUNCTION verify_metadata(hostname TEXT, port INTEGER, master_port INTEGER DEFAULT 57636)
|
|
||||||
RETURNS BOOLEAN
|
|
||||||
LANGUAGE sql
|
|
||||||
AS $$
|
|
||||||
SELECT wait_until_metadata_sync();
|
|
||||||
WITH dist_node_summary AS (
|
|
||||||
SELECT 'SELECT jsonb_agg(ROW(nodeid, groupid, nodename, nodeport, isactive) ORDER BY nodeid) FROM pg_dist_node' as query
|
|
||||||
), dist_node_check AS (
|
|
||||||
SELECT count(distinct result) = 1 AS matches
|
|
||||||
FROM dist_node_summary CROSS JOIN LATERAL
|
|
||||||
master_run_on_worker(ARRAY[hostname, 'localhost'], ARRAY[port, master_port],
|
|
||||||
ARRAY[dist_node_summary.query, dist_node_summary.query],
|
|
||||||
false)
|
|
||||||
), dist_placement_summary AS (
|
|
||||||
SELECT 'SELECT jsonb_agg(pg_dist_placement ORDER BY shardid) FROM pg_dist_placement)' AS query
|
|
||||||
), dist_placement_check AS (
|
|
||||||
SELECT count(distinct result) = 1 AS matches
|
|
||||||
FROM dist_placement_summary CROSS JOIN LATERAL
|
|
||||||
master_run_on_worker(ARRAY[hostname, 'localhost'], ARRAY[port, master_port],
|
|
||||||
ARRAY[dist_placement_summary.query, dist_placement_summary.query],
|
|
||||||
false)
|
|
||||||
)
|
|
||||||
SELECT dist_node_check.matches AND dist_placement_check.matches
|
|
||||||
FROM dist_node_check CROSS JOIN dist_placement_check
|
|
||||||
$$;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Procedure for creating shards for range partitioned distributed table.
|
-- Procedure for creating shards for range partitioned distributed table.
|
||||||
--
|
--
|
||||||
|
@ -141,17 +104,3 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|
||||||
-- partition_task_list_results tests the internal PartitionTasklistResults function
|
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.partition_task_list_results(resultIdPrefix text,
|
|
||||||
query text,
|
|
||||||
target_table regclass,
|
|
||||||
binaryFormat bool DEFAULT true)
|
|
||||||
RETURNS TABLE(resultId text,
|
|
||||||
nodeId int,
|
|
||||||
rowCount bigint,
|
|
||||||
targetShardId bigint,
|
|
||||||
targetShardIndex int)
|
|
||||||
LANGUAGE C STRICT VOLATILE
|
|
||||||
AS 'citus', $$partition_task_list_results$$;
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
--
|
||||||
|
-- Helper UDFs which require superuser permissions
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION wait_until_metadata_sync(timeout INTEGER DEFAULT 15000)
|
||||||
|
RETURNS void
|
||||||
|
LANGUAGE C STRICT
|
||||||
|
AS 'citus';
|
||||||
|
|
||||||
|
-- set sync intervals to less than 15s so wait_until_metadata_sync never times out
|
||||||
|
ALTER SYSTEM SET citus.metadata_sync_interval TO 3000;
|
||||||
|
ALTER SYSTEM SET citus.metadata_sync_retry_interval TO 500;
|
||||||
|
SELECT pg_reload_conf();
|
||||||
|
|
||||||
|
-- Verifies pg_dist_node and pg_dist_palcement in the given worker matches the ones in coordinator
|
||||||
|
CREATE OR REPLACE FUNCTION verify_metadata(hostname TEXT, port INTEGER, master_port INTEGER DEFAULT 57636)
|
||||||
|
RETURNS BOOLEAN
|
||||||
|
LANGUAGE sql
|
||||||
|
AS $$
|
||||||
|
SELECT wait_until_metadata_sync();
|
||||||
|
WITH dist_node_summary AS (
|
||||||
|
SELECT 'SELECT jsonb_agg(ROW(nodeid, groupid, nodename, nodeport, isactive) ORDER BY nodeid) FROM pg_dist_node' as query
|
||||||
|
), dist_node_check AS (
|
||||||
|
SELECT count(distinct result) = 1 AS matches
|
||||||
|
FROM dist_node_summary CROSS JOIN LATERAL
|
||||||
|
master_run_on_worker(ARRAY[hostname, 'localhost'], ARRAY[port, master_port],
|
||||||
|
ARRAY[dist_node_summary.query, dist_node_summary.query],
|
||||||
|
false)
|
||||||
|
), dist_placement_summary AS (
|
||||||
|
SELECT 'SELECT jsonb_agg(pg_dist_placement ORDER BY shardid) FROM pg_dist_placement)' AS query
|
||||||
|
), dist_placement_check AS (
|
||||||
|
SELECT count(distinct result) = 1 AS matches
|
||||||
|
FROM dist_placement_summary CROSS JOIN LATERAL
|
||||||
|
master_run_on_worker(ARRAY[hostname, 'localhost'], ARRAY[port, master_port],
|
||||||
|
ARRAY[dist_placement_summary.query, dist_placement_summary.query],
|
||||||
|
false)
|
||||||
|
)
|
||||||
|
SELECT dist_node_check.matches AND dist_placement_check.matches
|
||||||
|
FROM dist_node_check CROSS JOIN dist_placement_check
|
||||||
|
$$;
|
||||||
|
|
||||||
|
-- partition_task_list_results tests the internal PartitionTasklistResults function
|
||||||
|
CREATE OR REPLACE FUNCTION pg_catalog.partition_task_list_results(resultIdPrefix text,
|
||||||
|
query text,
|
||||||
|
target_table regclass,
|
||||||
|
binaryFormat bool DEFAULT true)
|
||||||
|
RETURNS TABLE(resultId text,
|
||||||
|
nodeId int,
|
||||||
|
rowCount bigint,
|
||||||
|
targetShardId bigint,
|
||||||
|
targetShardIndex int)
|
||||||
|
LANGUAGE C STRICT VOLATILE
|
||||||
|
AS 'citus', $$partition_task_list_results$$;
|
Loading…
Reference in New Issue