From 672d1980195802958ce4c899866d2cf12a958d11 Mon Sep 17 00:00:00 2001 From: Sameer Awasekar Date: Fri, 3 Jun 2022 12:05:37 +0530 Subject: [PATCH] Renamed UDF to worker_split_shard_replication_setup --- .../operations/split_shard_replication_setup.c | 15 ++++++--------- .../udfs/split_shard_replication_setup/11.0-2.sql | 6 +++--- .../udfs/split_shard_replication_setup/latest.sql | 6 +++--- .../distributed/shardsplit_shared_memory.h | 2 +- .../regress/expected/split_shard_test_helpers.out | 4 ++-- .../expected/upgrade_list_citus_objects.out | 1 + src/test/regress/sql/split_shard_test_helpers.sql | 4 ++-- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/backend/distributed/operations/split_shard_replication_setup.c b/src/backend/distributed/operations/split_shard_replication_setup.c index abaec5fc7..f880a3f3a 100644 --- a/src/backend/distributed/operations/split_shard_replication_setup.c +++ b/src/backend/distributed/operations/split_shard_replication_setup.c @@ -19,7 +19,7 @@ #include "utils/lsyscache.h" /* declarations for dynamic loading */ -PG_FUNCTION_INFO_V1(split_shard_replication_setup); +PG_FUNCTION_INFO_V1(worker_split_shard_replication_setup); static HTAB *ShardInfoHashMap = NULL; @@ -53,8 +53,7 @@ static ShardSplitInfo * CreateShardSplitInfo(uint64 sourceShardIdToSplit, static void AddShardSplitInfoEntryForNodeInMap(ShardSplitInfo *shardSplitInfo); static void PopulateShardSplitInfoInSM(ShardSplitInfo *shardSplitInfoArray, HTAB *shardInfoHashMap, - dsm_handle dsmHandle, - int shardSplitInfoCount); + dsm_handle dsmHandle); static void SetupHashMapForShardInfo(void); static uint32 NodeShardMappingHash(const void *key, Size keysize); @@ -62,7 +61,7 @@ static int NodeShardMappingHashCompare(const void *left, const void *right, Size /* - * split_shard_replication_setup UDF creates in-memory data structures + * worker_split_shard_replication_setup UDF creates in-memory data structures * to store the meta information about the shard undergoing split and new split * children along with their placements required during the catch up phase * of logical replication. @@ -102,7 +101,7 @@ static int NodeShardMappingHashCompare(const void *left, const void *right, Size * responsible. */ Datum -split_shard_replication_setup(PG_FUNCTION_ARGS) +worker_split_shard_replication_setup(PG_FUNCTION_ARGS) { ArrayType *shardInfoArrayObject = PG_GETARG_ARRAYTYPE_P(0); int shardInfoArrayLength = ARR_DIMS(shardInfoArrayObject)[0]; @@ -145,8 +144,7 @@ split_shard_replication_setup(PG_FUNCTION_ARGS) PopulateShardSplitInfoInSM(splitShardInfoSMArray, ShardInfoHashMap, - dsmHandle, - shardSplitInfoCount); + dsmHandle); return dsmHandle; } @@ -429,8 +427,7 @@ AddShardSplitInfoEntryForNodeInMap(ShardSplitInfo *shardSplitInfo) static void PopulateShardSplitInfoInSM(ShardSplitInfo *shardSplitInfoArray, HTAB *shardInfoHashMap, - dsm_handle dsmHandle, - int shardSplitInfoCount) + dsm_handle dsmHandle) { HASH_SEQ_STATUS status; hash_seq_init(&status, shardInfoHashMap); diff --git a/src/backend/distributed/sql/udfs/split_shard_replication_setup/11.0-2.sql b/src/backend/distributed/sql/udfs/split_shard_replication_setup/11.0-2.sql index 32e00aec8..4627747d2 100644 --- a/src/backend/distributed/sql/udfs/split_shard_replication_setup/11.0-2.sql +++ b/src/backend/distributed/sql/udfs/split_shard_replication_setup/11.0-2.sql @@ -1,7 +1,7 @@ -CREATE OR REPLACE FUNCTION pg_catalog.split_shard_replication_setup( +CREATE OR REPLACE FUNCTION pg_catalog.worker_split_shard_replication_setup( shardInfo bigint[][]) RETURNS bigint LANGUAGE C STRICT -AS 'MODULE_PATHNAME', $$split_shard_replication_setup$$; -COMMENT ON FUNCTION pg_catalog.split_shard_replication_setup(shardInfo bigint[][]) +AS 'MODULE_PATHNAME', $$worker_split_shard_replication_setup$$; +COMMENT ON FUNCTION pg_catalog.worker_split_shard_replication_setup(shardInfo bigint[][]) IS 'Replication setup for splitting a shard' diff --git a/src/backend/distributed/sql/udfs/split_shard_replication_setup/latest.sql b/src/backend/distributed/sql/udfs/split_shard_replication_setup/latest.sql index 32e00aec8..4627747d2 100644 --- a/src/backend/distributed/sql/udfs/split_shard_replication_setup/latest.sql +++ b/src/backend/distributed/sql/udfs/split_shard_replication_setup/latest.sql @@ -1,7 +1,7 @@ -CREATE OR REPLACE FUNCTION pg_catalog.split_shard_replication_setup( +CREATE OR REPLACE FUNCTION pg_catalog.worker_split_shard_replication_setup( shardInfo bigint[][]) RETURNS bigint LANGUAGE C STRICT -AS 'MODULE_PATHNAME', $$split_shard_replication_setup$$; -COMMENT ON FUNCTION pg_catalog.split_shard_replication_setup(shardInfo bigint[][]) +AS 'MODULE_PATHNAME', $$worker_split_shard_replication_setup$$; +COMMENT ON FUNCTION pg_catalog.worker_split_shard_replication_setup(shardInfo bigint[][]) IS 'Replication setup for splitting a shard' diff --git a/src/include/distributed/shardsplit_shared_memory.h b/src/include/distributed/shardsplit_shared_memory.h index 144a24caa..df64135c1 100644 --- a/src/include/distributed/shardsplit_shared_memory.h +++ b/src/include/distributed/shardsplit_shared_memory.h @@ -2,7 +2,7 @@ * * shardsplit_shared_memory.h * API's for creating and accessing shared memory segments to store - * shard split information. 'split_shard_replication_setup' UDF creates the + * shard split information. 'worker_split_shard_replication_setup' UDF creates the * shared memory and populates the contents. WAL sender processes are consumer * of split information for appropriate tuple routing. * diff --git a/src/test/regress/expected/split_shard_test_helpers.out b/src/test/regress/expected/split_shard_test_helpers.out index f1a198b53..a8db168b8 100644 --- a/src/test/regress/expected/split_shard_test_helpers.out +++ b/src/test/regress/expected/split_shard_test_helpers.out @@ -6,7 +6,7 @@ DECLARE memoryId bigint := 0; memoryIdText text; begin - SELECT * into memoryId from split_shard_replication_setup(ARRAY[ARRAY[1,2,-2147483648,-1, targetNode1], ARRAY[1,3,0,2147483647,targetNode2]]); + SELECT * into memoryId from worker_split_shard_replication_setup(ARRAY[ARRAY[1,2,-2147483648,-1, targetNode1], ARRAY[1,3,0,2147483647,targetNode2]]); SELECT FORMAT('%s', memoryId) into memoryIdText; return memoryIdText; end @@ -42,7 +42,7 @@ DECLARE memoryId bigint := 0; memoryIdText text; begin - SELECT * into memoryId from split_shard_replication_setup( + SELECT * into memoryId from worker_split_shard_replication_setup( ARRAY[ ARRAY[4, 5, -2147483648,-1, targetNode1], ARRAY[4, 6, 0 ,2147483647, targetNode2], diff --git a/src/test/regress/expected/upgrade_list_citus_objects.out b/src/test/regress/expected/upgrade_list_citus_objects.out index ef04f2b8c..f526353e0 100644 --- a/src/test/regress/expected/upgrade_list_citus_objects.out +++ b/src/test/regress/expected/upgrade_list_citus_objects.out @@ -242,6 +242,7 @@ ORDER BY 1; function worker_partitioned_table_size(regclass) function worker_record_sequence_dependency(regclass,regclass,name) function worker_save_query_explain_analyze(text,jsonb) + function worker_split_shard_replication_setup(bigint[]) schema citus schema citus_internal schema columnar diff --git a/src/test/regress/sql/split_shard_test_helpers.sql b/src/test/regress/sql/split_shard_test_helpers.sql index 132bd103c..27591f403 100644 --- a/src/test/regress/sql/split_shard_test_helpers.sql +++ b/src/test/regress/sql/split_shard_test_helpers.sql @@ -7,7 +7,7 @@ DECLARE memoryId bigint := 0; memoryIdText text; begin - SELECT * into memoryId from split_shard_replication_setup(ARRAY[ARRAY[1,2,-2147483648,-1, targetNode1], ARRAY[1,3,0,2147483647,targetNode2]]); + SELECT * into memoryId from worker_split_shard_replication_setup(ARRAY[ARRAY[1,2,-2147483648,-1, targetNode1], ARRAY[1,3,0,2147483647,targetNode2]]); SELECT FORMAT('%s', memoryId) into memoryIdText; return memoryIdText; end @@ -45,7 +45,7 @@ DECLARE memoryId bigint := 0; memoryIdText text; begin - SELECT * into memoryId from split_shard_replication_setup( + SELECT * into memoryId from worker_split_shard_replication_setup( ARRAY[ ARRAY[4, 5, -2147483648,-1, targetNode1], ARRAY[4, 6, 0 ,2147483647, targetNode2],