mirror of https://github.com/citusdata/citus.git
Rename worker_modify_identity_columns to worker_adjust_identity_column_seq_ranges.
parent
c9a3fbb503
commit
4b49e927e6
|
@ -1887,7 +1887,7 @@ SequenceDependencyCommandList(Oid relationId)
|
|||
|
||||
/*
|
||||
* IdentitySequenceDependencyCommandList generate a command to execute
|
||||
* a UDF (WORKER_MODIFY_IDENTITY_COLUMNS) on workers to modify the identity
|
||||
* a UDF (WORKER_ADJUST_IDENTITY_COLUMN_SEQ_RANGES) on workers to modify the identity
|
||||
* columns min/max values to produce unique values on workers.
|
||||
*/
|
||||
List *
|
||||
|
@ -1919,7 +1919,7 @@ IdentitySequenceDependencyCommandList(Oid targetRelationId)
|
|||
char *tableName = generate_qualified_relation_name(targetRelationId);
|
||||
|
||||
appendStringInfo(stringInfo,
|
||||
WORKER_MODIFY_IDENTITY_COLUMNS,
|
||||
WORKER_ADJUST_IDENTITY_COLUMN_SEQ_RANGES,
|
||||
quote_literal_cstr(tableName));
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
-- citus--11.2-1--11.3-1
|
||||
#include "udfs/repl_origin_helper/11.3-1.sql"
|
||||
#include "udfs/worker_modify_identity_columns/11.3-1.sql"
|
||||
#include "udfs/worker_adjust_identity_column_seq_ranges/11.3-1.sql"
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
DROP FUNCTION pg_catalog.citus_internal_start_replication_origin_tracking();
|
||||
DROP FUNCTION pg_catalog.citus_internal_stop_replication_origin_tracking();
|
||||
DROP FUNCTION pg_catalog.citus_internal_is_replication_origin_tracking_active();
|
||||
DROP FUNCTION IF EXISTS pg_catalog.worker_modify_identity_columns(regclass);
|
||||
DROP FUNCTION IF EXISTS pg_catalog.worker_adjust_identity_column_seq_ranges(regclass);
|
||||
|
|
7
src/backend/distributed/sql/udfs/worker_adjust_identity_column_seq_ranges/11.3-1.sql
generated
Normal file
7
src/backend/distributed/sql/udfs/worker_adjust_identity_column_seq_ranges/11.3-1.sql
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.worker_adjust_identity_column_seq_ranges(regclass)
|
||||
RETURNS VOID
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$worker_adjust_identity_column_seq_ranges$$;
|
||||
COMMENT ON FUNCTION pg_catalog.worker_adjust_identity_column_seq_ranges(regclass)
|
||||
IS 'modify identity column seq ranges to produce globally unique values';
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.worker_adjust_identity_column_seq_ranges(regclass)
|
||||
RETURNS VOID
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$worker_adjust_identity_column_seq_ranges$$;
|
||||
COMMENT ON FUNCTION pg_catalog.worker_adjust_identity_column_seq_ranges(regclass)
|
||||
IS 'modify identity column seq ranges to produce globally unique values';
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.worker_modify_identity_columns(regclass)
|
||||
RETURNS VOID
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$worker_modify_identity_columns$$;
|
||||
COMMENT ON FUNCTION pg_catalog.worker_modify_identity_columns(regclass)
|
||||
IS 'modify identity columns to produce globally unique values';
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.worker_modify_identity_columns(regclass)
|
||||
RETURNS VOID
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$worker_modify_identity_columns$$;
|
||||
COMMENT ON FUNCTION pg_catalog.worker_modify_identity_columns(regclass)
|
||||
IS 'modify identity columns to produce globally unique values';
|
||||
|
|
@ -70,7 +70,7 @@ static void AlterSequenceMinMax(Oid sequenceId, char *schemaName, char *sequence
|
|||
PG_FUNCTION_INFO_V1(worker_apply_shard_ddl_command);
|
||||
PG_FUNCTION_INFO_V1(worker_apply_inter_shard_ddl_command);
|
||||
PG_FUNCTION_INFO_V1(worker_apply_sequence_command);
|
||||
PG_FUNCTION_INFO_V1(worker_modify_identity_columns);
|
||||
PG_FUNCTION_INFO_V1(worker_adjust_identity_column_seq_ranges);
|
||||
PG_FUNCTION_INFO_V1(worker_append_table_to_shard);
|
||||
PG_FUNCTION_INFO_V1(worker_nextval);
|
||||
|
||||
|
@ -135,13 +135,13 @@ worker_apply_inter_shard_ddl_command(PG_FUNCTION_ARGS)
|
|||
|
||||
|
||||
/*
|
||||
* worker_modify_identity_columns takes a table oid, runs an ALTER SEQUENCE statement
|
||||
* worker_adjust_identity_column_seq_ranges takes a table oid, runs an ALTER SEQUENCE statement
|
||||
* for each identity column to adjust the minvalue and maxvalue of the sequence owned by
|
||||
* identity column such that the sequence creates globally unique values.
|
||||
* We use table oid instead of sequence name to avoid any potential conflicts between sequences of different tables. This way, we can safely iterate through identity columns on a specific table without any issues. While this may introduce a small amount of business logic to workers, it's a much safer approach overall.
|
||||
*/
|
||||
Datum
|
||||
worker_modify_identity_columns(PG_FUNCTION_ARGS)
|
||||
worker_adjust_identity_column_seq_ranges(PG_FUNCTION_ARGS)
|
||||
{
|
||||
CheckCitusVersion(ERROR);
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ extern void SyncDeleteColocationGroupToNodes(uint32 colocationId);
|
|||
"placementid = EXCLUDED.placementid"
|
||||
#define METADATA_SYNC_CHANNEL "metadata_sync"
|
||||
|
||||
#define WORKER_MODIFY_IDENTITY_COLUMNS \
|
||||
"SELECT pg_catalog.worker_modify_identity_columns(%s)"
|
||||
#define WORKER_ADJUST_IDENTITY_COLUMN_SEQ_RANGES \
|
||||
"SELECT pg_catalog.worker_adjust_identity_column_seq_ranges(%s)"
|
||||
|
||||
/* controlled via GUC */
|
||||
extern char *EnableManualMetadataChangesForUser;
|
||||
|
|
|
@ -1365,7 +1365,7 @@ SELECT * FROM multi_extension.print_extension_changes();
|
|||
| function citus_internal_is_replication_origin_tracking_active() boolean
|
||||
| function citus_internal_start_replication_origin_tracking() void
|
||||
| function citus_internal_stop_replication_origin_tracking() void
|
||||
| function worker_modify_identity_columns(regclass) void
|
||||
| function worker_adjust_identity_column_seq_ranges(regclass) void
|
||||
(4 rows)
|
||||
|
||||
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||
|
|
|
@ -251,7 +251,7 @@ ORDER BY 1;
|
|||
function worker_fix_pre_citus10_partitioned_table_constraint_names(regclass,bigint,text)
|
||||
function worker_hash("any")
|
||||
function worker_last_saved_explain_analyze()
|
||||
function worker_modify_identity_columns(regclass)
|
||||
function worker_adjust_identity_column_seq_ranges(regclass)
|
||||
function worker_nextval(regclass)
|
||||
function worker_partial_agg(oid,anyelement)
|
||||
function worker_partial_agg_ffunc(internal)
|
||||
|
|
Loading…
Reference in New Issue