Rename worker_modify_identity_columns to worker_adjust_identity_column_seq_ranges.

issue/6694
Gokhan Gulbiz 2023-03-29 13:31:38 +03:00
parent c9a3fbb503
commit 4b49e927e6
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
11 changed files with 25 additions and 25 deletions

View File

@ -1887,7 +1887,7 @@ SequenceDependencyCommandList(Oid relationId)
/* /*
* IdentitySequenceDependencyCommandList generate a command to execute * 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. * columns min/max values to produce unique values on workers.
*/ */
List * List *
@ -1919,7 +1919,7 @@ IdentitySequenceDependencyCommandList(Oid targetRelationId)
char *tableName = generate_qualified_relation_name(targetRelationId); char *tableName = generate_qualified_relation_name(targetRelationId);
appendStringInfo(stringInfo, appendStringInfo(stringInfo,
WORKER_MODIFY_IDENTITY_COLUMNS, WORKER_ADJUST_IDENTITY_COLUMN_SEQ_RANGES,
quote_literal_cstr(tableName)); quote_literal_cstr(tableName));

View File

@ -1,3 +1,3 @@
-- citus--11.2-1--11.3-1 -- citus--11.2-1--11.3-1
#include "udfs/repl_origin_helper/11.3-1.sql" #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"

View File

@ -2,4 +2,4 @@
DROP FUNCTION pg_catalog.citus_internal_start_replication_origin_tracking(); 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_stop_replication_origin_tracking();
DROP FUNCTION pg_catalog.citus_internal_is_replication_origin_tracking_active(); 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);

View 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';

View 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';

View File

@ -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';

View File

@ -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';

View File

@ -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_shard_ddl_command);
PG_FUNCTION_INFO_V1(worker_apply_inter_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_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_append_table_to_shard);
PG_FUNCTION_INFO_V1(worker_nextval); 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 * 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. * 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. * 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 Datum
worker_modify_identity_columns(PG_FUNCTION_ARGS) worker_adjust_identity_column_seq_ranges(PG_FUNCTION_ARGS)
{ {
CheckCitusVersion(ERROR); CheckCitusVersion(ERROR);

View File

@ -147,8 +147,8 @@ extern void SyncDeleteColocationGroupToNodes(uint32 colocationId);
"placementid = EXCLUDED.placementid" "placementid = EXCLUDED.placementid"
#define METADATA_SYNC_CHANNEL "metadata_sync" #define METADATA_SYNC_CHANNEL "metadata_sync"
#define WORKER_MODIFY_IDENTITY_COLUMNS \ #define WORKER_ADJUST_IDENTITY_COLUMN_SEQ_RANGES \
"SELECT pg_catalog.worker_modify_identity_columns(%s)" "SELECT pg_catalog.worker_adjust_identity_column_seq_ranges(%s)"
/* controlled via GUC */ /* controlled via GUC */
extern char *EnableManualMetadataChangesForUser; extern char *EnableManualMetadataChangesForUser;

View File

@ -1365,7 +1365,7 @@ SELECT * FROM multi_extension.print_extension_changes();
| function citus_internal_is_replication_origin_tracking_active() boolean | function citus_internal_is_replication_origin_tracking_active() boolean
| function citus_internal_start_replication_origin_tracking() void | function citus_internal_start_replication_origin_tracking() void
| function citus_internal_stop_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) (4 rows)
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff; DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;

View File

@ -251,7 +251,7 @@ ORDER BY 1;
function worker_fix_pre_citus10_partitioned_table_constraint_names(regclass,bigint,text) function worker_fix_pre_citus10_partitioned_table_constraint_names(regclass,bigint,text)
function worker_hash("any") function worker_hash("any")
function worker_last_saved_explain_analyze() 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_nextval(regclass)
function worker_partial_agg(oid,anyelement) function worker_partial_agg(oid,anyelement)
function worker_partial_agg_ffunc(internal) function worker_partial_agg_ffunc(internal)