mirror of https://github.com/citusdata/citus.git
rename to citus_shard_property_set
parent
51c3ed8dfd
commit
83dd504a64
|
@ -139,8 +139,7 @@ PG_FUNCTION_INFO_V1(citus_table_size);
|
|||
PG_FUNCTION_INFO_V1(citus_total_relation_size);
|
||||
PG_FUNCTION_INFO_V1(citus_relation_size);
|
||||
PG_FUNCTION_INFO_V1(citus_shard_sizes);
|
||||
PG_FUNCTION_INFO_V1(citus_shard_set_isolated);
|
||||
PG_FUNCTION_INFO_V1(citus_shard_unset_isolated);
|
||||
PG_FUNCTION_INFO_V1(citus_shard_property_set);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -361,11 +360,11 @@ citus_relation_size(PG_FUNCTION_ARGS)
|
|||
|
||||
|
||||
/*
|
||||
* citus_shard_set_isolated sets the needsisolatednode flag to true for all
|
||||
* citus_shard_property_set allows setting shard properties for all
|
||||
* the shards within the shard group that given shard belongs to.
|
||||
*/
|
||||
Datum
|
||||
citus_shard_set_isolated(PG_FUNCTION_ARGS)
|
||||
citus_shard_property_set(PG_FUNCTION_ARGS)
|
||||
{
|
||||
CheckCitusVersion(ERROR);
|
||||
EnsureCoordinator();
|
||||
|
@ -373,29 +372,13 @@ citus_shard_set_isolated(PG_FUNCTION_ARGS)
|
|||
PG_ENSURE_ARGNOTNULL(0, "shard_id");
|
||||
uint64 shardId = PG_GETARG_INT64(0);
|
||||
|
||||
ErrorIfShardIsolationNotPossible(shardId);
|
||||
if (!PG_ARGISNULL(1))
|
||||
{
|
||||
ErrorIfShardIsolationNotPossible(shardId);
|
||||
|
||||
bool enabled = true;
|
||||
ShardGroupSetNeedsIsolatedNodeGlobally(shardId, enabled);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* citus_shard_unset_isolated sets the needsisolatednode flag to false for all
|
||||
* the shards within the shard group that given shard belongs to.
|
||||
*/
|
||||
Datum
|
||||
citus_shard_unset_isolated(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_ENSURE_ARGNOTNULL(0, "shard_id");
|
||||
uint64 shardId = PG_GETARG_INT64(0);
|
||||
|
||||
ErrorIfShardIsolationNotPossible(shardId);
|
||||
|
||||
bool enabled = false;
|
||||
ShardGroupSetNeedsIsolatedNodeGlobally(shardId, enabled);
|
||||
bool enabled = PG_GETARG_BOOL(1);
|
||||
ShardGroupSetNeedsIsolatedNodeGlobally(shardId, enabled);
|
||||
}
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
|
|
@ -10,5 +10,4 @@ ALTER TABLE pg_dist_shard ADD COLUMN needsisolatednode boolean NOT NULL DEFAULT
|
|||
|
||||
#include "udfs/citus_internal_shard_group_set_needsisolatednode/12.2-1.sql"
|
||||
|
||||
#include "udfs/citus_shard_set_isolated/12.2-1.sql"
|
||||
#include "udfs/citus_shard_unset_isolated/12.2-1.sql"
|
||||
#include "udfs/citus_shard_property_set/12.2-1.sql"
|
||||
|
|
|
@ -7,8 +7,7 @@ ALTER TABLE pg_dist_shard DROP COLUMN needsisolatednode;
|
|||
DROP FUNCTION pg_catalog.citus_internal_add_shard_metadata(regclass, bigint, "char", text, text, boolean);
|
||||
#include "../udfs/citus_internal_add_shard_metadata/10.2-1.sql"
|
||||
|
||||
DROP FUNCTION pg_catalog.citus_shard_set_isolated(shard_id bigint);
|
||||
DROP FUNCTION pg_catalog.citus_shard_unset_isolated(shard_id bigint);
|
||||
DROP FUNCTION pg_catalog.citus_shard_property_set(shard_id bigint, anti_affinity boolean);
|
||||
|
||||
DROP FUNCTION pg_catalog.citus_internal_shard_group_set_needsisolatednode(
|
||||
shard_id bigint,
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_shard_property_set(shard_id bigint, anti_affinity boolean default null)
|
||||
RETURNS void
|
||||
LANGUAGE C VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$citus_shard_property_set$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_shard_property_set(bigint, boolean) IS
|
||||
'Allows setting shard properties for all the shards within the shard group that given shard belongs to.';
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_shard_property_set(shard_id bigint, anti_affinity boolean default null)
|
||||
RETURNS void
|
||||
LANGUAGE C VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$citus_shard_property_set$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_shard_property_set(bigint, boolean) IS
|
||||
'Allows setting shard properties for all the shards within the shard group that given shard belongs to.';
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_shard_set_isolated(shard_id bigint)
|
||||
RETURNS void
|
||||
LANGUAGE C VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$citus_shard_set_isolated$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_shard_set_isolated(bigint) IS
|
||||
'Sets the needsisolatednode flag to true for all the shards in the shard group of the given shard.';
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_shard_set_isolated(shard_id bigint)
|
||||
RETURNS void
|
||||
LANGUAGE C VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$citus_shard_set_isolated$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_shard_set_isolated(bigint) IS
|
||||
'Sets the needsisolatednode flag to true for all the shards in the shard group of the given shard.';
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_shard_unset_isolated(shard_id bigint)
|
||||
RETURNS void
|
||||
LANGUAGE C VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$citus_shard_unset_isolated$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_shard_unset_isolated(bigint) IS
|
||||
'Sets the needsisolatednode flag to false for all the shards in the shard group of the given shard.';
|
|
@ -1,6 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_shard_unset_isolated(shard_id bigint)
|
||||
RETURNS void
|
||||
LANGUAGE C VOLATILE
|
||||
AS 'MODULE_PATHNAME', $$citus_shard_unset_isolated$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_shard_unset_isolated(bigint) IS
|
||||
'Sets the needsisolatednode flag to false for all the shards in the shard group of the given shard.';
|
|
@ -102,8 +102,8 @@ ORDER BY nodeid;
|
|||
SELECT shardids[2] AS shardgroup_5_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -111,8 +111,8 @@ SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
|||
SELECT shardids[3] AS shardgroup_10_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 10 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_10_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_10_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -131,8 +131,8 @@ ORDER BY nodeid;
|
|||
SELECT shardids[1] AS shardgroup_3_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 3 \gset
|
||||
SELECT citus_shard_unset_isolated(:shardgroup_3_shardid);
|
||||
citus_shard_unset_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_3_shardid, anti_affinity=>false);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -151,8 +151,8 @@ ORDER BY nodeid;
|
|||
SELECT shardids[1] AS shardgroup_10_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 10 \gset
|
||||
SELECT citus_shard_unset_isolated(:shardgroup_10_shardid);
|
||||
citus_shard_unset_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_10_shardid, anti_affinity=>false);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -171,8 +171,8 @@ ORDER BY nodeid;
|
|||
SELECT shardids[1] AS shardgroup_5_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -227,8 +227,8 @@ SELECT 1 FROM citus_add_node('localhost', :worker_2_port);
|
|||
SELECT shardids[1] AS shardgroup_5_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -372,8 +372,8 @@ SELECT create_distributed_table('dist_2', 'a', colocate_with=>'dist_1');
|
|||
SELECT shardids[1] AS shardgroup_3_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 3 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_3_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_3_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -428,8 +428,8 @@ SELECT create_distributed_table('dist_2', 'a', colocate_with=>'dist_1');
|
|||
SELECT shardids[1] AS shardgroup_9_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 9 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_9_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_9_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -475,8 +475,8 @@ ORDER BY nodeid;
|
|||
SELECT shardids[1] AS shardgroup_12_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 12 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_12_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_12_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -530,8 +530,8 @@ SELECT create_distributed_table('dist_3', 'a', colocate_with=>'none');
|
|||
SELECT shardids[1] AS shardgroup_17_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_3')
|
||||
WHERE shardgroupindex = 17 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_17_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_17_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -576,8 +576,8 @@ ORDER BY nodeid;
|
|||
SELECT shardids[1] AS shardgroup_18_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_3')
|
||||
WHERE shardgroupindex = 18 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_18_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_18_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -629,8 +629,21 @@ SELECT create_distributed_table('single_shard_1', null, colocate_with=>'none');
|
|||
SELECT shardids[1] AS shardgroup_1_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.single_shard_1')
|
||||
WHERE shardgroupindex = 1 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_1_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- noop
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, NULL);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -654,13 +667,13 @@ ORDER BY nodeid;
|
|||
(3 rows)
|
||||
|
||||
-- test invalid input
|
||||
SELECT citus_shard_set_isolated(NULL);
|
||||
SELECT citus_shard_property_set(NULL, anti_affinity=>true);
|
||||
ERROR: shard_id cannot be NULL
|
||||
SELECT citus_shard_set_isolated(0);
|
||||
SELECT citus_shard_property_set(0, anti_affinity=>true);
|
||||
ERROR: shard xxxxx does not exist
|
||||
SELECT citus_shard_unset_isolated(NULL);
|
||||
SELECT citus_shard_property_set(NULL, anti_affinity=>false);
|
||||
ERROR: shard_id cannot be NULL
|
||||
SELECT citus_shard_unset_isolated(0);
|
||||
SELECT citus_shard_property_set(0, anti_affinity=>false);
|
||||
ERROR: shard xxxxx does not exist
|
||||
CREATE TABLE append_table (a int, b int);
|
||||
SELECT create_distributed_table('append_table', 'a', 'append');
|
||||
|
@ -699,21 +712,21 @@ SELECT citus_add_local_table_to_metadata('local_table');
|
|||
(1 row)
|
||||
|
||||
-- all should fail
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
ERROR: shard isolation is only supported for hash distributed tables
|
||||
DROP TABLE range_table;
|
||||
DROP TYPE composite_key_type;
|
||||
|
@ -795,8 +808,8 @@ SELECT citus_add_local_table_to_metadata('local_table_1');
|
|||
SELECT shardids[1] AS shardgroup_1_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 1 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_1_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1051,8 +1064,8 @@ SELECT create_distributed_table('single_shard_2', null, colocate_with=>'none');
|
|||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass, 'single_shard_2'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass, 'single_shard_2'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -1191,8 +1204,8 @@ SELECT create_distributed_table('dist_3', 'a', shard_count=>1, colocate_with=>'n
|
|||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('dist_1'::regclass, 'dist_2'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('dist_1'::regclass, 'dist_2'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -1253,8 +1266,8 @@ SELECT create_distributed_table('dist_1', 'a', shard_count=>4);
|
|||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1307,8 +1320,8 @@ SET citus.shard_replication_factor TO 1;
|
|||
SELECT shardids[1] AS shardgroup_1_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_2')
|
||||
WHERE shardgroupindex = 1 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_1_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1362,8 +1375,8 @@ SELECT create_distributed_table('single_shard_4', null, colocate_with=>'none');
|
|||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1382,14 +1395,14 @@ SELECT public.verify_placements_in_shard_group_isolated('isolate_placement.singl
|
|||
t
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_2'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_2'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_unset_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1441,14 +1454,14 @@ DROP TABLE single_shard_2;
|
|||
SELECT shardid, nodeid INTO single_shard_3_shardid_nodeid
|
||||
FROM pg_dist_shard JOIN pg_dist_placement USING (shardid) JOIN pg_dist_node USING (groupid)
|
||||
WHERE logicalrelid = 'isolate_placement.single_shard_3'::regclass AND noderole = 'primary';
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
@ -1541,14 +1554,14 @@ DROP TABLE single_shard_2;
|
|||
SELECT shardid, nodeid INTO single_shard_3_shardid_nodeid
|
||||
FROM pg_dist_shard JOIN pg_dist_placement USING (shardid) JOIN pg_dist_node USING (groupid)
|
||||
WHERE logicalrelid = 'isolate_placement.single_shard_3'::regclass AND noderole = 'primary';
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
|
|
@ -1424,9 +1424,8 @@ SELECT * FROM multi_extension.print_extension_changes();
|
|||
---------------------------------------------------------------------
|
||||
| function citus_internal_add_shard_metadata(regclass,bigint,"char",text,text,boolean) void
|
||||
| function citus_internal_shard_group_set_needsisolatednode(bigint,boolean) void
|
||||
| function citus_shard_set_isolated(bigint) void
|
||||
| function citus_shard_unset_isolated(bigint) void
|
||||
(4 rows)
|
||||
| function citus_shard_property_set(bigint,boolean) void
|
||||
(3 rows)
|
||||
|
||||
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||
-- show running version
|
||||
|
|
|
@ -13,8 +13,8 @@ SELECT create_distributed_table('table_with_isolated_placements', 'a', colocate_
|
|||
SELECT shardids[1] AS shardgroup_5_shardid
|
||||
FROM public.get_enumerated_shard_groups('upgrade_isolate_placement_before.table_with_isolated_placements')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
citus_shard_set_isolated
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
citus_shard_property_set
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
|
|
@ -131,9 +131,8 @@ ORDER BY 1;
|
|||
function citus_shard_cost_1(bigint)
|
||||
function citus_shard_cost_by_disk_size(bigint)
|
||||
function citus_shard_indexes_on_worker()
|
||||
function citus_shard_set_isolated(bigint)
|
||||
function citus_shard_property_set(bigint,boolean)
|
||||
function citus_shard_sizes()
|
||||
function citus_shard_unset_isolated(bigint)
|
||||
function citus_shards_on_worker()
|
||||
function citus_split_shard_by_split_points(bigint,text[],integer[],citus.shard_transfer_mode)
|
||||
function citus_stat_activity()
|
||||
|
@ -347,5 +346,5 @@ ORDER BY 1;
|
|||
view citus_stat_tenants_local
|
||||
view pg_dist_shard_placement
|
||||
view time_partitions
|
||||
(337 rows)
|
||||
(336 rows)
|
||||
|
||||
|
|
|
@ -67,13 +67,13 @@ SELECT shardids[2] AS shardgroup_5_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT shardids[3] AS shardgroup_10_shardid
|
||||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 10 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_10_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_10_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -84,7 +84,7 @@ SELECT shardids[1] AS shardgroup_3_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 3 \gset
|
||||
|
||||
SELECT citus_shard_unset_isolated(:shardgroup_3_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_3_shardid, anti_affinity=>false);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -95,7 +95,7 @@ SELECT shardids[1] AS shardgroup_10_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 10 \gset
|
||||
|
||||
SELECT citus_shard_unset_isolated(:shardgroup_10_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_10_shardid, anti_affinity=>false);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -106,7 +106,7 @@ SELECT shardids[1] AS shardgroup_5_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -134,7 +134,7 @@ SELECT shardids[1] AS shardgroup_5_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -228,7 +228,7 @@ SELECT shardids[1] AS shardgroup_3_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 3 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_3_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_3_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -258,7 +258,7 @@ SELECT shardids[1] AS shardgroup_9_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 9 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_9_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_9_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -287,7 +287,7 @@ SELECT shardids[1] AS shardgroup_12_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 12 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_12_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_12_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1')
|
||||
|
@ -320,7 +320,7 @@ SELECT shardids[1] AS shardgroup_17_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_3')
|
||||
WHERE shardgroupindex = 17 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_17_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_17_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_3')
|
||||
|
@ -343,7 +343,7 @@ SELECT shardids[1] AS shardgroup_18_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_3')
|
||||
WHERE shardgroupindex = 18 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_18_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_18_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_3')
|
||||
|
@ -370,7 +370,11 @@ SELECT shardids[1] AS shardgroup_1_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.single_shard_1')
|
||||
WHERE shardgroupindex = 1 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_1_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, anti_affinity=>true);
|
||||
|
||||
-- noop
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, NULL);
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid);
|
||||
|
||||
CREATE TABLE single_shard_2(a int);
|
||||
SELECT create_distributed_table('single_shard_2', null, colocate_with=>'single_shard_1');
|
||||
|
@ -381,10 +385,10 @@ $$)
|
|||
ORDER BY nodeid;
|
||||
|
||||
-- test invalid input
|
||||
SELECT citus_shard_set_isolated(NULL);
|
||||
SELECT citus_shard_set_isolated(0);
|
||||
SELECT citus_shard_unset_isolated(NULL);
|
||||
SELECT citus_shard_unset_isolated(0);
|
||||
SELECT citus_shard_property_set(NULL, anti_affinity=>true);
|
||||
SELECT citus_shard_property_set(0, anti_affinity=>true);
|
||||
SELECT citus_shard_property_set(NULL, anti_affinity=>false);
|
||||
SELECT citus_shard_property_set(0, anti_affinity=>false);
|
||||
|
||||
CREATE TABLE append_table (a int, b int);
|
||||
SELECT create_distributed_table('append_table', 'a', 'append');
|
||||
|
@ -402,15 +406,15 @@ CREATE TABLE local_table(a int);
|
|||
SELECT citus_add_local_table_to_metadata('local_table');
|
||||
|
||||
-- all should fail
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'append_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'range_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'ref_table'::regclass LIMIT 1;
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid = 'local_table'::regclass LIMIT 1;
|
||||
|
||||
DROP TABLE range_table;
|
||||
DROP TYPE composite_key_type;
|
||||
|
@ -455,7 +459,7 @@ SELECT shardids[1] AS shardgroup_1_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_1')
|
||||
WHERE shardgroupindex = 1 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_1_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, anti_affinity=>true);
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
SELECT rebalance_table_shards(shard_transfer_mode=>'block_writes');
|
||||
|
@ -578,7 +582,7 @@ SELECT create_distributed_table('single_shard_1', null, colocate_with=>'none');
|
|||
CREATE TABLE single_shard_2(a int);
|
||||
SELECT create_distributed_table('single_shard_2', null, colocate_with=>'none');
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass, 'single_shard_2'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass, 'single_shard_2'::regclass);
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
SELECT rebalance_table_shards(shard_transfer_mode=>'block_writes');
|
||||
|
@ -650,7 +654,7 @@ SELECT create_distributed_table('dist_1', 'a', shard_count=>1);
|
|||
SELECT create_distributed_table('dist_2', 'a', shard_count=>1, colocate_with=>'none');
|
||||
SELECT create_distributed_table('dist_3', 'a', shard_count=>1, colocate_with=>'none');
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('dist_1'::regclass, 'dist_2'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('dist_1'::regclass, 'dist_2'::regclass);
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
SELECT rebalance_table_shards(shard_transfer_mode=>'block_writes');
|
||||
|
@ -681,7 +685,7 @@ SELECT create_distributed_table('single_shard_2', null, colocate_with=>'none');
|
|||
CREATE TABLE dist_1(a int);
|
||||
SELECT create_distributed_table('dist_1', 'a', shard_count=>4);
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
|
||||
SELECT groupid AS single_shard_1_group_id FROM pg_dist_shard JOIN pg_dist_placement USING (shardid) WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass \gset
|
||||
|
||||
|
@ -712,7 +716,7 @@ SELECT shardids[1] AS shardgroup_1_shardid
|
|||
FROM public.get_enumerated_shard_groups('isolate_placement.dist_2')
|
||||
WHERE shardgroupindex = 1 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_1_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_1_shardid, anti_affinity=>true);
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
SELECT rebalance_table_shards(shard_transfer_mode=>'block_writes');
|
||||
|
@ -736,7 +740,7 @@ SELECT create_distributed_table('single_shard_3', null, colocate_with=>'none');
|
|||
CREATE TABLE single_shard_4(a int);
|
||||
SELECT create_distributed_table('single_shard_4', null, colocate_with=>'none');
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
SELECT rebalance_table_shards(shard_transfer_mode=>'block_writes');
|
||||
|
@ -744,8 +748,8 @@ SET client_min_messages TO NOTICE;
|
|||
|
||||
SELECT public.verify_placements_in_shard_group_isolated('isolate_placement.single_shard_1', 1);
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_2'::regclass);
|
||||
SELECT citus_shard_unset_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_2'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>false) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
SELECT rebalance_table_shards(shard_transfer_mode=>'block_writes');
|
||||
|
@ -772,8 +776,8 @@ SELECT shardid, nodeid INTO single_shard_3_shardid_nodeid
|
|||
FROM pg_dist_shard JOIN pg_dist_placement USING (shardid) JOIN pg_dist_node USING (groupid)
|
||||
WHERE logicalrelid = 'isolate_placement.single_shard_3'::regclass AND noderole = 'primary';
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
|
||||
-- tell rebalancer that single_shard_3 cannot be placed on the node where it is currently placed
|
||||
CREATE OR REPLACE FUNCTION test_shard_allowed_on_node(p_shardid bigint, p_nodeid int)
|
||||
|
@ -844,8 +848,8 @@ SELECT shardid, nodeid INTO single_shard_3_shardid_nodeid
|
|||
FROM pg_dist_shard JOIN pg_dist_placement USING (shardid) JOIN pg_dist_node USING (groupid)
|
||||
WHERE logicalrelid = 'isolate_placement.single_shard_3'::regclass AND noderole = 'primary';
|
||||
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_set_isolated(shardid) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_1'::regclass);
|
||||
SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid IN ('single_shard_3'::regclass);
|
||||
|
||||
-- Same test above but this time we tell rebalancer that single_shard_3 cannot be placed
|
||||
-- on any node except the one where it is currently placed.
|
||||
|
|
|
@ -13,7 +13,7 @@ SELECT shardids[1] AS shardgroup_5_shardid
|
|||
FROM public.get_enumerated_shard_groups('upgrade_isolate_placement_before.table_with_isolated_placements')
|
||||
WHERE shardgroupindex = 5 \gset
|
||||
|
||||
SELECT citus_shard_set_isolated(:shardgroup_5_shardid);
|
||||
SELECT citus_shard_property_set(:shardgroup_5_shardid, anti_affinity=>true);
|
||||
|
||||
SELECT result FROM run_command_on_all_nodes($$
|
||||
SELECT * FROM public.get_colocated_shards_needisolatednode('upgrade_isolate_placement_before.table_with_isolated_placements')
|
||||
|
|
Loading…
Reference in New Issue