From 529f1bc8e31b967ef66a1e498d9b5ce400456bd1 Mon Sep 17 00:00:00 2001 From: Nitish Upreti Date: Mon, 27 Jun 2022 22:24:23 -0700 Subject: [PATCH] Reindent --- .../operations/worker_shard_copy.c | 3 +- .../operations/worker_split_copy_udf.c | 56 ++++++++++++------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/backend/distributed/operations/worker_shard_copy.c b/src/backend/distributed/operations/worker_shard_copy.c index c74bc98d7..71042d7f6 100644 --- a/src/backend/distributed/operations/worker_shard_copy.c +++ b/src/backend/distributed/operations/worker_shard_copy.c @@ -231,7 +231,8 @@ ShardCopyDestReceiverStartup(DestReceiver *dest, int operation, TupleDesc /* define how tuples will be serialised */ CopyOutState copyOutState = (CopyOutState) palloc0(sizeof(CopyOutStateData)); - copyOutState->binary = EnableBinaryProtocol && CanUseBinaryCopyFormat(inputTupleDescriptor); + copyOutState->binary = EnableBinaryProtocol && CanUseBinaryCopyFormat( + inputTupleDescriptor); copyOutState->null_print = (char *) nullPrintCharacter; copyOutState->null_print_client = (char *) nullPrintCharacter; copyOutState->fe_msgbuf = makeStringInfo(); diff --git a/src/backend/distributed/operations/worker_split_copy_udf.c b/src/backend/distributed/operations/worker_split_copy_udf.c index 0bea0f1c5..7f3bb4b31 100644 --- a/src/backend/distributed/operations/worker_split_copy_udf.c +++ b/src/backend/distributed/operations/worker_split_copy_udf.c @@ -31,12 +31,16 @@ typedef struct SplitCopyInfo static void ParseSplitCopyInfoDatum(Datum splitCopyInfoDatum, SplitCopyInfo **splitCopyInfo); -static DestReceiver** CreateShardCopyDestReceivers(EState *estate, ShardInterval *shardIntervalToSplitCopy, List *splitCopyInfoList); -static DestReceiver* CreatePartitionedSplitCopyDestReceiver( - EState *executor, - ShardInterval *shardIntervalToSplitCopy, - List *splitCopyInfoList); -static void BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValueArray, ArrayType **maxValueArray); +static DestReceiver ** CreateShardCopyDestReceivers(EState *estate, + ShardInterval * + shardIntervalToSplitCopy, + List *splitCopyInfoList); +static DestReceiver * CreatePartitionedSplitCopyDestReceiver(EState *executor, + ShardInterval * + shardIntervalToSplitCopy, + List *splitCopyInfoList); +static void BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValueArray, + ArrayType **maxValueArray); /* * worker_split_copy(source_shard_id bigint, splitCopyInfo citus.split_copy_info[]) @@ -73,8 +77,8 @@ worker_split_copy(PG_FUNCTION_ARGS) EState *executor = CreateExecutorState(); DestReceiver *splitCopyDestReceiver = CreatePartitionedSplitCopyDestReceiver(executor, - shardIntervalToSplitCopy, - splitCopyInfoList); + shardIntervalToSplitCopy, + splitCopyInfoList); char *sourceShardToCopyName = generate_qualified_relation_name( shardIntervalToSplitCopy->relationId); @@ -145,7 +149,8 @@ ParseSplitCopyInfoDatum(Datum splitCopyInfoDatum, SplitCopyInfo **splitCopyInfo) /* Build 'min/max' hash range arrays for PartitionedResultDestReceiver */ static void -BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValueArray, ArrayType **maxValueArray) +BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValueArray, + ArrayType **maxValueArray) { int partitionCount = list_length(splitCopyInfoList); @@ -167,8 +172,10 @@ BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValueArray, Array index++; } - *minValueArray = CreateArrayFromDatums(minValues, minValueNulls, partitionCount, TEXTOID); - *maxValueArray = CreateArrayFromDatums(maxValues, maxValueNulls, partitionCount, TEXTOID); + *minValueArray = CreateArrayFromDatums(minValues, minValueNulls, partitionCount, + TEXTOID); + *maxValueArray = CreateArrayFromDatums(maxValues, maxValueNulls, partitionCount, + TEXTOID); } @@ -177,10 +184,12 @@ BuildMinMaxRangeArrays(List *splitCopyInfoList, ArrayType **minValueArray, Array * Each ShardCopyDestReceivers will be responsible for copying tuples from source shard, * that fall under its min/max range, to specified destination shard. */ -static DestReceiver** -CreateShardCopyDestReceivers(EState *estate, ShardInterval *shardIntervalToSplitCopy, List *splitCopyInfoList) +static DestReceiver ** +CreateShardCopyDestReceivers(EState *estate, ShardInterval *shardIntervalToSplitCopy, + List *splitCopyInfoList) { - DestReceiver **shardCopyDests = palloc0(splitCopyInfoList->length * sizeof(DestReceiver *)); + DestReceiver **shardCopyDests = palloc0(splitCopyInfoList->length * + sizeof(DestReceiver *)); SplitCopyInfo *splitCopyInfo = NULL; int index = 0; @@ -188,7 +197,8 @@ CreateShardCopyDestReceivers(EState *estate, ShardInterval *shardIntervalToSplit foreach_ptr(splitCopyInfo, splitCopyInfoList) { char *destinationShardSchemaName = get_namespace_name(get_rel_namespace( - shardIntervalToSplitCopy->relationId)); + shardIntervalToSplitCopy + ->relationId)); char *destinationShardNameCopy = pstrdup(sourceShardNamePrefix); AppendShardIdToName(&destinationShardNameCopy, splitCopyInfo->destinationShardId); @@ -206,11 +216,13 @@ CreateShardCopyDestReceivers(EState *estate, ShardInterval *shardIntervalToSplit /* Create PartitionedSplitCopyDestReceiver along with underlying ShardCopyDestReceivers */ -static DestReceiver* -CreatePartitionedSplitCopyDestReceiver(EState *estate, ShardInterval *shardIntervalToSplitCopy, List *splitCopyInfoList) +static DestReceiver * +CreatePartitionedSplitCopyDestReceiver(EState *estate, + ShardInterval *shardIntervalToSplitCopy, + List *splitCopyInfoList) { /* Create underlying ShardCopyDestReceivers */ - DestReceiver** shardCopyDestReceivers = CreateShardCopyDestReceivers( + DestReceiver **shardCopyDestReceivers = CreateShardCopyDestReceivers( estate, shardIntervalToSplitCopy, splitCopyInfoList); @@ -219,9 +231,11 @@ CreatePartitionedSplitCopyDestReceiver(EState *estate, ShardInterval *shardInter ArrayType *minValuesArray = NULL; ArrayType *maxValuesArray = NULL; BuildMinMaxRangeArrays(splitCopyInfoList, &minValuesArray, &maxValuesArray); - char partitionMethod = PartitionMethodViaCatalog(shardIntervalToSplitCopy->relationId); - CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(shardIntervalToSplitCopy->relationId); - Var* partitionColumn = cacheEntry->partitionColumn; + char partitionMethod = PartitionMethodViaCatalog( + shardIntervalToSplitCopy->relationId); + CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry( + shardIntervalToSplitCopy->relationId); + Var *partitionColumn = cacheEntry->partitionColumn; CitusTableCacheEntry *shardSearchInfo = QueryTupleShardSearchInfo(minValuesArray, maxValuesArray,