rename to has_separate_node

tenant-schema-isolation-complete-view
Onur Tirtir 2023-09-29 14:47:23 +03:00
parent 7d68e655bc
commit a58442d411
4 changed files with 10 additions and 10 deletions

View File

@ -15,7 +15,7 @@ SELECT
CASE CASE
WHEN NOT pg_dist_shard.needsisolatednode THEN false WHEN NOT pg_dist_shard.needsisolatednode THEN false
ELSE ELSE
-- own_node = true if the node doesn't have any other shards except the ones that are colocated with this shard -- has_separate_node = true if the node doesn't have any other shards except the ones that are colocated with this shard
NOT EXISTS ( NOT EXISTS (
-- get all the distributed table shards that are placed on the same node as this shard -- get all the distributed table shards that are placed on the same node as this shard
SELECT pds1.shardid SELECT pds1.shardid
@ -32,7 +32,7 @@ SELECT
WHERE pdp1.colocationid = pg_dist_partition.colocationid AND WHERE pdp1.colocationid = pg_dist_partition.colocationid AND
((pds1.shardminvalue IS NULL AND pg_dist_shard.shardminvalue IS NULL) OR (pds1.shardminvalue = pg_dist_shard.shardminvalue)) ((pds1.shardminvalue IS NULL AND pg_dist_shard.shardminvalue IS NULL) OR (pds1.shardminvalue = pg_dist_shard.shardminvalue))
) )
END AS own_node END AS has_separate_node
FROM FROM
pg_dist_shard pg_dist_shard
JOIN JOIN

View File

@ -15,7 +15,7 @@ SELECT
CASE CASE
WHEN NOT pg_dist_shard.needsisolatednode THEN false WHEN NOT pg_dist_shard.needsisolatednode THEN false
ELSE ELSE
-- own_node = true if the node doesn't have any other shards except the ones that are colocated with this shard -- has_separate_node = true if the node doesn't have any other shards except the ones that are colocated with this shard
NOT EXISTS ( NOT EXISTS (
-- get all the distributed table shards that are placed on the same node as this shard -- get all the distributed table shards that are placed on the same node as this shard
SELECT pds1.shardid SELECT pds1.shardid
@ -32,7 +32,7 @@ SELECT
WHERE pdp1.colocationid = pg_dist_partition.colocationid AND WHERE pdp1.colocationid = pg_dist_partition.colocationid AND
((pds1.shardminvalue IS NULL AND pg_dist_shard.shardminvalue IS NULL) OR (pds1.shardminvalue = pg_dist_shard.shardminvalue)) ((pds1.shardminvalue IS NULL AND pg_dist_shard.shardminvalue IS NULL) OR (pds1.shardminvalue = pg_dist_shard.shardminvalue))
) )
END AS own_node END AS has_separate_node
FROM FROM
pg_dist_shard pg_dist_shard
JOIN JOIN

View File

@ -18,7 +18,7 @@ AS $func$
DECLARE DECLARE
v_result boolean; v_result boolean;
BEGIN BEGIN
SELECT bool_and(own_node) INTO v_result SELECT bool_and(has_separate_node) INTO v_result
FROM citus_shards FROM citus_shards
JOIN ( JOIN (
SELECT shardids FROM public.get_enumerated_shard_groups(qualified_table_name) WHERE shardgroupindex = shard_group_index SELECT shardids FROM public.get_enumerated_shard_groups(qualified_table_name) WHERE shardgroupindex = shard_group_index
@ -1185,7 +1185,7 @@ SELECT public.verify_placements_in_shard_group_isolated('isolate_placement.dist_
SELECT DISTINCT(table_name::regclass::text) SELECT DISTINCT(table_name::regclass::text)
FROM citus_shards FROM citus_shards
JOIN pg_class ON (oid = table_name) JOIN pg_class ON (oid = table_name)
WHERE relnamespace = 'isolate_placement'::regnamespace AND own_node WHERE relnamespace = 'isolate_placement'::regnamespace AND has_separate_node
ORDER BY 1; ORDER BY 1;
table_name table_name
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -1196,7 +1196,7 @@ ORDER BY 1;
dist_post_concurrently_colocated dist_post_concurrently_colocated
(5 rows) (5 rows)
SELECT bool_or(own_node) = false SELECT bool_or(has_separate_node) = false
FROM citus_shards FROM citus_shards
JOIN ( JOIN (
SELECT unnest(shardids) shardid SELECT unnest(shardids) shardid

View File

@ -20,7 +20,7 @@ AS $func$
DECLARE DECLARE
v_result boolean; v_result boolean;
BEGIN BEGIN
SELECT bool_and(own_node) INTO v_result SELECT bool_and(has_separate_node) INTO v_result
FROM citus_shards FROM citus_shards
JOIN ( JOIN (
SELECT shardids FROM public.get_enumerated_shard_groups(qualified_table_name) WHERE shardgroupindex = shard_group_index SELECT shardids FROM public.get_enumerated_shard_groups(qualified_table_name) WHERE shardgroupindex = shard_group_index
@ -658,10 +658,10 @@ SELECT public.verify_placements_in_shard_group_isolated('isolate_placement.dist_
SELECT DISTINCT(table_name::regclass::text) SELECT DISTINCT(table_name::regclass::text)
FROM citus_shards FROM citus_shards
JOIN pg_class ON (oid = table_name) JOIN pg_class ON (oid = table_name)
WHERE relnamespace = 'isolate_placement'::regnamespace AND own_node WHERE relnamespace = 'isolate_placement'::regnamespace AND has_separate_node
ORDER BY 1; ORDER BY 1;
SELECT bool_or(own_node) = false SELECT bool_or(has_separate_node) = false
FROM citus_shards FROM citus_shards
JOIN ( JOIN (
SELECT unnest(shardids) shardid SELECT unnest(shardids) shardid