mirror of https://github.com/citusdata/citus.git
Fixing permission issue when splitting non-superuser owned tables
parent
8f56a30a21
commit
aca0a03d21
|
@ -668,12 +668,12 @@ DoSplitCopy(WorkerNode *sourceShardNode, List *sourceColocatedShardIntervalList,
|
||||||
* ROW(81060015, -- destination shard id
|
* ROW(81060015, -- destination shard id
|
||||||
* -2147483648, -- split range begin
|
* -2147483648, -- split range begin
|
||||||
* 1073741823, --split range end
|
* 1073741823, --split range end
|
||||||
* 10 -- worker node id)::citus.split_copy_info,
|
* 10 -- worker node id)::pg_catalog.split_copy_info,
|
||||||
* -- split copy info for split children 2
|
* -- split copy info for split children 2
|
||||||
* ROW(81060016, --destination shard id
|
* ROW(81060016, --destination shard id
|
||||||
* 1073741824, --split range begin
|
* 1073741824, --split range begin
|
||||||
* 2147483647, --split range end
|
* 2147483647, --split range end
|
||||||
* 11 -- workef node id)::citus.split_copy_info
|
* 11 -- workef node id)::pg_catalog.split_copy_info
|
||||||
* ]
|
* ]
|
||||||
* );
|
* );
|
||||||
*/
|
*/
|
||||||
|
@ -698,7 +698,7 @@ CreateSplitCopyCommand(ShardInterval *sourceShardSplitInterval,
|
||||||
|
|
||||||
StringInfo splitCopyInfoRow = makeStringInfo();
|
StringInfo splitCopyInfoRow = makeStringInfo();
|
||||||
appendStringInfo(splitCopyInfoRow,
|
appendStringInfo(splitCopyInfoRow,
|
||||||
"ROW(%lu, %d, %d, %u)::citus.split_copy_info",
|
"ROW(%lu, %d, %d, %u)::pg_catalog.split_copy_info",
|
||||||
splitChildShardInterval->shardId,
|
splitChildShardInterval->shardId,
|
||||||
DatumGetInt32(splitChildShardInterval->minValue),
|
DatumGetInt32(splitChildShardInterval->minValue),
|
||||||
DatumGetInt32(splitChildShardInterval->maxValue),
|
DatumGetInt32(splitChildShardInterval->maxValue),
|
||||||
|
|
|
@ -43,7 +43,7 @@ static void BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValue
|
||||||
ArrayType **maxValueArray);
|
ArrayType **maxValueArray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* worker_split_copy(source_shard_id bigint, splitCopyInfo citus.split_copy_info[])
|
* worker_split_copy(source_shard_id bigint, splitCopyInfo pg_catalog.split_copy_info[])
|
||||||
* UDF to split copy shard to list of destination shards.
|
* UDF to split copy shard to list of destination shards.
|
||||||
* 'source_shard_id' : Source ShardId to split copy.
|
* 'source_shard_id' : Source ShardId to split copy.
|
||||||
* 'splitCopyInfos' : Array of Split Copy Info (destination_shard's id, min/max ranges and node_id)
|
* 'splitCopyInfos' : Array of Split Copy Info (destination_shard's id, min/max ranges and node_id)
|
||||||
|
@ -60,7 +60,7 @@ worker_split_copy(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
|
||||||
errmsg(
|
errmsg(
|
||||||
"citus.split_copy_info array cannot contain null values")));
|
"pg_catalog.split_copy_info array cannot contain null values")));
|
||||||
}
|
}
|
||||||
|
|
||||||
const int slice_ndim = 0;
|
const int slice_ndim = 0;
|
||||||
|
@ -121,7 +121,7 @@ ParseSplitCopyInfoDatum(Datum splitCopyInfoDatum, SplitCopyInfo **splitCopyInfo)
|
||||||
if (isnull)
|
if (isnull)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errmsg(
|
ereport(ERROR, (errmsg(
|
||||||
"destination_shard_id for split_copy_info cannot be null.")));
|
"destination_shard_id for pg_catalog.split_copy_info cannot be null.")));
|
||||||
}
|
}
|
||||||
copyInfo->destinationShardId = DatumGetUInt64(destinationShardIdDatum);
|
copyInfo->destinationShardId = DatumGetUInt64(destinationShardIdDatum);
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ ParseSplitCopyInfoDatum(Datum splitCopyInfoDatum, SplitCopyInfo **splitCopyInfo)
|
||||||
if (isnull)
|
if (isnull)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errmsg(
|
ereport(ERROR, (errmsg(
|
||||||
"destination_shard_min_value for split_copy_info cannot be null.")));
|
"destination_shard_min_value for pg_catalog.split_copy_info cannot be null.")));
|
||||||
}
|
}
|
||||||
copyInfo->destinationShardMinHashValue = minValueDatum;
|
copyInfo->destinationShardMinHashValue = minValueDatum;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ ParseSplitCopyInfoDatum(Datum splitCopyInfoDatum, SplitCopyInfo **splitCopyInfo)
|
||||||
if (isnull)
|
if (isnull)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errmsg(
|
ereport(ERROR, (errmsg(
|
||||||
"destination_shard_max_value for split_copy_info cannot be null.")));
|
"destination_shard_max_value for pg_catalog.split_copy_info cannot be null.")));
|
||||||
}
|
}
|
||||||
copyInfo->destinationShardMaxHashValue = maxValueDatum;
|
copyInfo->destinationShardMaxHashValue = maxValueDatum;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ ParseSplitCopyInfoDatum(Datum splitCopyInfoDatum, SplitCopyInfo **splitCopyInfo)
|
||||||
if (isnull)
|
if (isnull)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errmsg(
|
ereport(ERROR, (errmsg(
|
||||||
"destination_shard_node_id for split_copy_info cannot be null.")));
|
"destination_shard_node_id for pg_catalog.split_copy_info cannot be null.")));
|
||||||
}
|
}
|
||||||
copyInfo->destinationShardNodeId = DatumGetInt32(nodeIdDatum);
|
copyInfo->destinationShardNodeId = DatumGetInt32(nodeIdDatum);
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ DROP FUNCTION pg_catalog.citus_split_shard_by_split_points(
|
||||||
shard_transfer_mode citus.shard_transfer_mode);
|
shard_transfer_mode citus.shard_transfer_mode);
|
||||||
DROP FUNCTION pg_catalog.worker_split_copy(
|
DROP FUNCTION pg_catalog.worker_split_copy(
|
||||||
source_shard_id bigint,
|
source_shard_id bigint,
|
||||||
splitCopyInfos citus.split_copy_info[]);
|
splitCopyInfos pg_catalog.split_copy_info[]);
|
||||||
DROP TYPE citus.split_copy_info;
|
DROP TYPE pg_catalog.split_copy_info;
|
||||||
|
|
||||||
#include "../../../columnar/sql/downgrades/columnar--11.1-1--11.0-3.sql"
|
#include "../../../columnar/sql/downgrades/columnar--11.1-1--11.0-3.sql"
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
-- We want to create the type in pg_catalog but doing that leads to an error
|
||||||
|
-- "ERROR: permission denied to create "pg_catalog.split_copy_info"
|
||||||
|
-- "DETAIL: System catalog modifications are currently disallowed. ""
|
||||||
|
-- As a workaround, we create the type in the citus schema and then later modify it to pg_catalog.
|
||||||
DROP TYPE IF EXISTS citus.split_copy_info;
|
DROP TYPE IF EXISTS citus.split_copy_info;
|
||||||
CREATE TYPE citus.split_copy_info AS (
|
CREATE TYPE citus.split_copy_info AS (
|
||||||
destination_shard_id bigint,
|
destination_shard_id bigint,
|
||||||
|
@ -6,12 +10,13 @@ CREATE TYPE citus.split_copy_info AS (
|
||||||
-- A 'nodeId' is a uint32 in CITUS [1, 4294967296] but postgres does not have unsigned type support.
|
-- A 'nodeId' is a uint32 in CITUS [1, 4294967296] but postgres does not have unsigned type support.
|
||||||
-- Use integer (consistent with other previously defined UDFs that take nodeId as integer) as for all practical purposes it is big enough.
|
-- Use integer (consistent with other previously defined UDFs that take nodeId as integer) as for all practical purposes it is big enough.
|
||||||
destination_shard_node_id integer);
|
destination_shard_node_id integer);
|
||||||
|
ALTER TYPE citus.split_copy_info SET SCHEMA pg_catalog;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.worker_split_copy(
|
CREATE OR REPLACE FUNCTION pg_catalog.worker_split_copy(
|
||||||
source_shard_id bigint,
|
source_shard_id bigint,
|
||||||
splitCopyInfos citus.split_copy_info[])
|
splitCopyInfos pg_catalog.split_copy_info[])
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C STRICT
|
LANGUAGE C STRICT
|
||||||
AS 'MODULE_PATHNAME', $$worker_split_copy$$;
|
AS 'MODULE_PATHNAME', $$worker_split_copy$$;
|
||||||
COMMENT ON FUNCTION pg_catalog.worker_split_copy(source_shard_id bigint, splitCopyInfos citus.split_copy_info[])
|
COMMENT ON FUNCTION pg_catalog.worker_split_copy(source_shard_id bigint, splitCopyInfos pg_catalog.split_copy_info[])
|
||||||
IS 'Perform split copy for shard';
|
IS 'Perform split copy for shard';
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
-- We want to create the type in pg_catalog but doing that leads to an error
|
||||||
|
-- "ERROR: permission denied to create "pg_catalog.split_copy_info"
|
||||||
|
-- "DETAIL: System catalog modifications are currently disallowed. ""
|
||||||
|
-- As a workaround, we create the type in the citus schema and then later modify it to pg_catalog.
|
||||||
DROP TYPE IF EXISTS citus.split_copy_info;
|
DROP TYPE IF EXISTS citus.split_copy_info;
|
||||||
CREATE TYPE citus.split_copy_info AS (
|
CREATE TYPE citus.split_copy_info AS (
|
||||||
destination_shard_id bigint,
|
destination_shard_id bigint,
|
||||||
|
@ -6,12 +10,13 @@ CREATE TYPE citus.split_copy_info AS (
|
||||||
-- A 'nodeId' is a uint32 in CITUS [1, 4294967296] but postgres does not have unsigned type support.
|
-- A 'nodeId' is a uint32 in CITUS [1, 4294967296] but postgres does not have unsigned type support.
|
||||||
-- Use integer (consistent with other previously defined UDFs that take nodeId as integer) as for all practical purposes it is big enough.
|
-- Use integer (consistent with other previously defined UDFs that take nodeId as integer) as for all practical purposes it is big enough.
|
||||||
destination_shard_node_id integer);
|
destination_shard_node_id integer);
|
||||||
|
ALTER TYPE citus.split_copy_info SET SCHEMA pg_catalog;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.worker_split_copy(
|
CREATE OR REPLACE FUNCTION pg_catalog.worker_split_copy(
|
||||||
source_shard_id bigint,
|
source_shard_id bigint,
|
||||||
splitCopyInfos citus.split_copy_info[])
|
splitCopyInfos pg_catalog.split_copy_info[])
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C STRICT
|
LANGUAGE C STRICT
|
||||||
AS 'MODULE_PATHNAME', $$worker_split_copy$$;
|
AS 'MODULE_PATHNAME', $$worker_split_copy$$;
|
||||||
COMMENT ON FUNCTION pg_catalog.worker_split_copy(source_shard_id bigint, splitCopyInfos citus.split_copy_info[])
|
COMMENT ON FUNCTION pg_catalog.worker_split_copy(source_shard_id bigint, splitCopyInfos pg_catalog.split_copy_info[])
|
||||||
IS 'Perform split copy for shard';
|
IS 'Perform split copy for shard';
|
||||||
|
|
|
@ -11,6 +11,9 @@ Here is a high level overview of test plan:
|
||||||
8. Split an already split shard second time on a different schema.
|
8. Split an already split shard second time on a different schema.
|
||||||
*/
|
*/
|
||||||
CREATE SCHEMA "citus_split_test_schema";
|
CREATE SCHEMA "citus_split_test_schema";
|
||||||
|
CREATE ROLE test_split_role WITH LOGIN;
|
||||||
|
GRANT USAGE, CREATE ON SCHEMA "citus_split_test_schema" TO test_split_role;
|
||||||
|
SET ROLE test_split_role;
|
||||||
SET search_path TO "citus_split_test_schema";
|
SET search_path TO "citus_split_test_schema";
|
||||||
SET citus.next_shard_id TO 8981000;
|
SET citus.next_shard_id TO 8981000;
|
||||||
SET citus.next_placement_id TO 8610000;
|
SET citus.next_placement_id TO 8610000;
|
||||||
|
@ -193,6 +196,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node
|
||||||
-- END : Display current state
|
-- END : Display current state
|
||||||
-- BEGIN : Move one shard before we split it.
|
-- BEGIN : Move one shard before we split it.
|
||||||
\c - postgres - :master_port
|
\c - postgres - :master_port
|
||||||
|
SET ROLE test_split_role;
|
||||||
SET search_path TO "citus_split_test_schema";
|
SET search_path TO "citus_split_test_schema";
|
||||||
SET citus.next_shard_id TO 8981007;
|
SET citus.next_shard_id TO 8981007;
|
||||||
SET citus.defer_drop_after_shard_move TO OFF;
|
SET citus.defer_drop_after_shard_move TO OFF;
|
||||||
|
@ -372,6 +376,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node
|
||||||
-- END : Display current state
|
-- END : Display current state
|
||||||
-- BEGIN: Should be able to change/drop constraints
|
-- BEGIN: Should be able to change/drop constraints
|
||||||
\c - postgres - :master_port
|
\c - postgres - :master_port
|
||||||
|
SET ROLE test_split_role;
|
||||||
SET search_path TO "citus_split_test_schema";
|
SET search_path TO "citus_split_test_schema";
|
||||||
ALTER INDEX index_on_sensors RENAME TO index_on_sensors_renamed;
|
ALTER INDEX index_on_sensors RENAME TO index_on_sensors_renamed;
|
||||||
ALTER INDEX index_on_sensors_renamed ALTER COLUMN 1 SET STATISTICS 200;
|
ALTER INDEX index_on_sensors_renamed ALTER COLUMN 1 SET STATISTICS 200;
|
||||||
|
|
|
@ -1098,14 +1098,14 @@ SELECT * FROM multi_extension.print_extension_changes();
|
||||||
| function citus_split_shard_by_split_points(bigint,text[],integer[],citus.shard_transfer_mode) void
|
| function citus_split_shard_by_split_points(bigint,text[],integer[],citus.shard_transfer_mode) void
|
||||||
| function columnar.get_storage_id(regclass) bigint
|
| function columnar.get_storage_id(regclass) bigint
|
||||||
| function columnar_internal.columnar_handler(internal) table_am_handler
|
| function columnar_internal.columnar_handler(internal) table_am_handler
|
||||||
| function worker_split_copy(bigint,citus.split_copy_info[]) void
|
| function worker_split_copy(bigint,pg_catalog.split_copy_info[]) void
|
||||||
| schema columnar_internal
|
| schema columnar_internal
|
||||||
| sequence columnar_internal.storageid_seq
|
| sequence columnar_internal.storageid_seq
|
||||||
| table columnar_internal.chunk
|
| table columnar_internal.chunk
|
||||||
| table columnar_internal.chunk_group
|
| table columnar_internal.chunk_group
|
||||||
| table columnar_internal.options
|
| table columnar_internal.options
|
||||||
| table columnar_internal.stripe
|
| table columnar_internal.stripe
|
||||||
| type citus.split_copy_info
|
| type pg_catalog.split_copy_info
|
||||||
| view columnar.chunk
|
| view columnar.chunk
|
||||||
| view columnar.chunk_group
|
| view columnar.chunk_group
|
||||||
| view columnar.options
|
| view columnar.options
|
||||||
|
|
|
@ -242,7 +242,7 @@ ORDER BY 1;
|
||||||
function worker_partitioned_table_size(regclass)
|
function worker_partitioned_table_size(regclass)
|
||||||
function worker_record_sequence_dependency(regclass,regclass,name)
|
function worker_record_sequence_dependency(regclass,regclass,name)
|
||||||
function worker_save_query_explain_analyze(text,jsonb)
|
function worker_save_query_explain_analyze(text,jsonb)
|
||||||
function worker_split_copy(bigint,citus.split_copy_info[])
|
function worker_split_copy(bigint,pg_catalog.split_copy_info[])
|
||||||
schema citus
|
schema citus
|
||||||
schema citus_internal
|
schema citus_internal
|
||||||
schema columnar
|
schema columnar
|
||||||
|
@ -271,7 +271,7 @@ ORDER BY 1;
|
||||||
table pg_dist_transaction
|
table pg_dist_transaction
|
||||||
type citus.distribution_type
|
type citus.distribution_type
|
||||||
type citus.shard_transfer_mode
|
type citus.shard_transfer_mode
|
||||||
type citus.split_copy_info
|
type pg_catalog.split_copy_info
|
||||||
type citus_copy_format
|
type citus_copy_format
|
||||||
type noderole
|
type noderole
|
||||||
view citus_dist_stat_activity
|
view citus_dist_stat_activity
|
||||||
|
|
|
@ -154,12 +154,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81060015, -- destination shard id
|
ROW(81060015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81060016, --destination shard id
|
ROW(81060016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
@ -176,12 +176,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81060015, -- destination shard id
|
ROW(81060015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info,
|
:worker_2_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81060016, --destination shard id
|
ROW(81060016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info
|
:worker_2_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
|
|
@ -154,12 +154,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
@ -176,12 +176,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info,
|
:worker_2_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info
|
:worker_2_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
|
|
@ -191,12 +191,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81060015, -- destination shard id
|
ROW(81060015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81060016, --destination shard id
|
ROW(81060016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
@ -213,12 +213,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81060015, -- destination shard id
|
ROW(81060015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info,
|
:worker_2_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81060016, --destination shard id
|
ROW(81060016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info
|
:worker_2_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
|
|
@ -59,12 +59,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
-1073741824, --split range end
|
-1073741824, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
-1073741823, --split range begin
|
-1073741823, --split range begin
|
||||||
-1, --split range end
|
-1, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
ERROR: could not find valid entry for shard xxxxx
|
ERROR: could not find valid entry for shard xxxxx
|
||||||
|
@ -82,9 +82,9 @@ ERROR: function worker_split_copy(integer, text[]) does not exist
|
||||||
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
SELECT * from worker_split_copy(
|
SELECT * from worker_split_copy(
|
||||||
81070000, -- source shard id to copy
|
81070000, -- source shard id to copy
|
||||||
ARRAY[NULL::citus.split_copy_info]-- empty array
|
ARRAY[NULL::pg_catalog.split_copy_info]-- empty array
|
||||||
);
|
);
|
||||||
ERROR: citus.split_copy_info array cannot contain null values
|
ERROR: pg_catalog.split_copy_info array cannot contain null values
|
||||||
SELECT * from worker_split_copy(
|
SELECT * from worker_split_copy(
|
||||||
81070000, -- source shard id to copy
|
81070000, -- source shard id to copy
|
||||||
ARRAY[ROW(NULL)]-- empty array
|
ARRAY[ROW(NULL)]-- empty array
|
||||||
|
@ -93,9 +93,9 @@ ERROR: function worker_split_copy(integer, record[]) does not exist
|
||||||
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
SELECT * from worker_split_copy(
|
SELECT * from worker_split_copy(
|
||||||
81070000, -- source shard id to copy
|
81070000, -- source shard id to copy
|
||||||
ARRAY[ROW(NULL, NULL, NULL, NULL)::citus.split_copy_info] -- empty array
|
ARRAY[ROW(NULL, NULL, NULL, NULL)::pg_catalog.split_copy_info] -- empty array
|
||||||
);
|
);
|
||||||
ERROR: destination_shard_id for split_copy_info cannot be null.
|
ERROR: destination_shard_id for pg_catalog.split_copy_info cannot be null.
|
||||||
-- END: Test Negative scenario
|
-- END: Test Negative scenario
|
||||||
-- BEGIN: Trigger 2-way local shard split copy.
|
-- BEGIN: Trigger 2-way local shard split copy.
|
||||||
-- Ensure we will perform text copy.
|
-- Ensure we will perform text copy.
|
||||||
|
@ -107,12 +107,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
-1073741824, --split range end
|
-1073741824, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
-1073741823, --split range begin
|
-1073741823, --split range begin
|
||||||
-1, --split range end
|
-1, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
|
|
@ -154,12 +154,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
@ -176,12 +176,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info,
|
:worker_2_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info
|
:worker_2_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
worker_split_copy
|
worker_split_copy
|
||||||
|
|
|
@ -12,6 +12,11 @@ Here is a high level overview of test plan:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE SCHEMA "citus_split_test_schema";
|
CREATE SCHEMA "citus_split_test_schema";
|
||||||
|
|
||||||
|
CREATE ROLE test_split_role WITH LOGIN;
|
||||||
|
GRANT USAGE, CREATE ON SCHEMA "citus_split_test_schema" TO test_split_role;
|
||||||
|
SET ROLE test_split_role;
|
||||||
|
|
||||||
SET search_path TO "citus_split_test_schema";
|
SET search_path TO "citus_split_test_schema";
|
||||||
SET citus.next_shard_id TO 8981000;
|
SET citus.next_shard_id TO 8981000;
|
||||||
SET citus.next_placement_id TO 8610000;
|
SET citus.next_placement_id TO 8610000;
|
||||||
|
@ -114,6 +119,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node
|
||||||
|
|
||||||
-- BEGIN : Move one shard before we split it.
|
-- BEGIN : Move one shard before we split it.
|
||||||
\c - postgres - :master_port
|
\c - postgres - :master_port
|
||||||
|
SET ROLE test_split_role;
|
||||||
SET search_path TO "citus_split_test_schema";
|
SET search_path TO "citus_split_test_schema";
|
||||||
SET citus.next_shard_id TO 8981007;
|
SET citus.next_shard_id TO 8981007;
|
||||||
SET citus.defer_drop_after_shard_move TO OFF;
|
SET citus.defer_drop_after_shard_move TO OFF;
|
||||||
|
@ -194,6 +200,7 @@ SELECT shard.shardid, logicalrelid, shardminvalue, shardmaxvalue, nodename, node
|
||||||
|
|
||||||
-- BEGIN: Should be able to change/drop constraints
|
-- BEGIN: Should be able to change/drop constraints
|
||||||
\c - postgres - :master_port
|
\c - postgres - :master_port
|
||||||
|
SET ROLE test_split_role;
|
||||||
SET search_path TO "citus_split_test_schema";
|
SET search_path TO "citus_split_test_schema";
|
||||||
ALTER INDEX index_on_sensors RENAME TO index_on_sensors_renamed;
|
ALTER INDEX index_on_sensors RENAME TO index_on_sensors_renamed;
|
||||||
ALTER INDEX index_on_sensors_renamed ALTER COLUMN 1 SET STATISTICS 200;
|
ALTER INDEX index_on_sensors_renamed ALTER COLUMN 1 SET STATISTICS 200;
|
||||||
|
|
|
@ -165,12 +165,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81060015, -- destination shard id
|
ROW(81060015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81060016, --destination shard id
|
ROW(81060016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
-- END: Trigger 2-way local shard split copy.
|
-- END: Trigger 2-way local shard split copy.
|
||||||
|
@ -183,12 +183,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81060015, -- destination shard id
|
ROW(81060015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info,
|
:worker_2_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81060016, --destination shard id
|
ROW(81060016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info
|
:worker_2_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
-- END: Trigger 2-way remote shard split copy.
|
-- END: Trigger 2-way remote shard split copy.
|
||||||
|
|
|
@ -43,12 +43,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
-1073741824, --split range end
|
-1073741824, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
-1073741823, --split range begin
|
-1073741823, --split range begin
|
||||||
-1, --split range end
|
-1, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ SELECT * from worker_split_copy(
|
||||||
|
|
||||||
SELECT * from worker_split_copy(
|
SELECT * from worker_split_copy(
|
||||||
81070000, -- source shard id to copy
|
81070000, -- source shard id to copy
|
||||||
ARRAY[NULL::citus.split_copy_info]-- empty array
|
ARRAY[NULL::pg_catalog.split_copy_info]-- empty array
|
||||||
);
|
);
|
||||||
|
|
||||||
SELECT * from worker_split_copy(
|
SELECT * from worker_split_copy(
|
||||||
|
@ -74,7 +74,7 @@ SELECT * from worker_split_copy(
|
||||||
|
|
||||||
SELECT * from worker_split_copy(
|
SELECT * from worker_split_copy(
|
||||||
81070000, -- source shard id to copy
|
81070000, -- source shard id to copy
|
||||||
ARRAY[ROW(NULL, NULL, NULL, NULL)::citus.split_copy_info] -- empty array
|
ARRAY[ROW(NULL, NULL, NULL, NULL)::pg_catalog.split_copy_info] -- empty array
|
||||||
);
|
);
|
||||||
-- END: Test Negative scenario
|
-- END: Test Negative scenario
|
||||||
|
|
||||||
|
@ -88,12 +88,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
-1073741824, --split range end
|
-1073741824, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
-1073741823, --split range begin
|
-1073741823, --split range begin
|
||||||
-1, --split range end
|
-1, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
-- END: Trigger 2-way local shard split copy.
|
-- END: Trigger 2-way local shard split copy.
|
||||||
|
|
|
@ -157,12 +157,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info,
|
:worker_1_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_1_node)::citus.split_copy_info
|
:worker_1_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
-- END: Trigger 2-way local shard split copy.
|
-- END: Trigger 2-way local shard split copy.
|
||||||
|
@ -175,12 +175,12 @@ SELECT * from worker_split_copy(
|
||||||
ROW(81070015, -- destination shard id
|
ROW(81070015, -- destination shard id
|
||||||
-2147483648, -- split range begin
|
-2147483648, -- split range begin
|
||||||
1073741823, --split range end
|
1073741823, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info,
|
:worker_2_node)::pg_catalog.split_copy_info,
|
||||||
-- split copy info for split children 2
|
-- split copy info for split children 2
|
||||||
ROW(81070016, --destination shard id
|
ROW(81070016, --destination shard id
|
||||||
1073741824, --split range begin
|
1073741824, --split range begin
|
||||||
2147483647, --split range end
|
2147483647, --split range end
|
||||||
:worker_2_node)::citus.split_copy_info
|
:worker_2_node)::pg_catalog.split_copy_info
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
-- END: Trigger 2-way remote shard split copy.
|
-- END: Trigger 2-way remote shard split copy.
|
||||||
|
|
Loading…
Reference in New Issue