mirror of https://github.com/citusdata/citus.git
Addressing open comments
parent
ebd0e9a617
commit
4fcdff53ae
|
@ -575,6 +575,22 @@ DoSplitCopy(WorkerNode *sourceShardNode, List *sourceColocatedShardIntervalList,
|
||||||
* 'sourceShardSplitInterval' : Source shard interval to be copied.
|
* 'sourceShardSplitInterval' : Source shard interval to be copied.
|
||||||
* 'splitChildrenShardINnerIntervalList' : List of shard intervals for split children.
|
* 'splitChildrenShardINnerIntervalList' : List of shard intervals for split children.
|
||||||
* 'destinationWorkerNodesList' : List of workers for split children placement.
|
* 'destinationWorkerNodesList' : List of workers for split children placement.
|
||||||
|
* Here is an example of a 2 way split copy :
|
||||||
|
* SELECT * from worker_split_copy(
|
||||||
|
* 81060000, -- source shard id to split copy
|
||||||
|
* ARRAY[
|
||||||
|
* -- split copy info for split children 1
|
||||||
|
* ROW(81060015, -- destination shard id
|
||||||
|
* -2147483648, -- split range begin
|
||||||
|
* 1073741823, --split range end
|
||||||
|
* 10 -- worker node id)::citus.split_copy_info,
|
||||||
|
* -- split copy info for split children 2
|
||||||
|
* ROW(81060016, --destination shard id
|
||||||
|
* 1073741824, --split range begin
|
||||||
|
* 2147483647, --split range end
|
||||||
|
* 11 -- workef node id)::citus.split_copy_info
|
||||||
|
* ]
|
||||||
|
* );
|
||||||
*/
|
*/
|
||||||
static StringInfo
|
static StringInfo
|
||||||
CreateSplitCopyCommand(ShardInterval *sourceShardSplitInterval,
|
CreateSplitCopyCommand(ShardInterval *sourceShardSplitInterval,
|
||||||
|
|
|
@ -135,6 +135,36 @@ ConnectToRemoteAndStartCopy(ShardCopyDestReceiver *copyDest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CreateShardCopyDestReceiver creates a DestReceiver that copies into
|
||||||
|
* a destinationShardFullyQualifiedName on destinationNodeId.
|
||||||
|
*/
|
||||||
|
DestReceiver *
|
||||||
|
CreateShardCopyDestReceiver(EState *executorState,
|
||||||
|
List *destinationShardFullyQualifiedName,
|
||||||
|
uint32_t destinationNodeId)
|
||||||
|
{
|
||||||
|
ShardCopyDestReceiver *copyDest = (ShardCopyDestReceiver *) palloc0(
|
||||||
|
sizeof(ShardCopyDestReceiver));
|
||||||
|
|
||||||
|
/* set up the DestReceiver function pointers */
|
||||||
|
copyDest->pub.receiveSlot = ShardCopyDestReceiverReceive;
|
||||||
|
copyDest->pub.rStartup = ShardCopyDestReceiverStartup;
|
||||||
|
copyDest->pub.rShutdown = ShardCopyDestReceiverShutdown;
|
||||||
|
copyDest->pub.rDestroy = ShardCopyDestReceiverDestroy;
|
||||||
|
copyDest->pub.mydest = DestCopyOut;
|
||||||
|
copyDest->executorState = executorState;
|
||||||
|
|
||||||
|
copyDest->destinationNodeId = destinationNodeId;
|
||||||
|
copyDest->destinationShardFullyQualifiedName = destinationShardFullyQualifiedName;
|
||||||
|
copyDest->tuplesSent = 0;
|
||||||
|
copyDest->connection = NULL;
|
||||||
|
copyDest->useLocalCopy = CanUseLocalCopy(destinationNodeId);
|
||||||
|
|
||||||
|
return (DestReceiver *) copyDest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ShardCopyDestReceiverReceive implements the receiveSlot function of
|
* ShardCopyDestReceiverReceive implements the receiveSlot function of
|
||||||
* ShardCopyDestReceiver. It takes a TupleTableSlot and sends the contents to
|
* ShardCopyDestReceiver. It takes a TupleTableSlot and sends the contents to
|
||||||
|
@ -304,36 +334,6 @@ ShardCopyDestReceiverShutdown(DestReceiver *dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CreateShardCopyDestReceiver creates a DestReceiver that copies into
|
|
||||||
* a destinationShardFullyQualifiedName on destinationNodeId.
|
|
||||||
*/
|
|
||||||
DestReceiver *
|
|
||||||
CreateShardCopyDestReceiver(EState *executorState,
|
|
||||||
List *destinationShardFullyQualifiedName,
|
|
||||||
uint32_t destinationNodeId)
|
|
||||||
{
|
|
||||||
ShardCopyDestReceiver *copyDest = (ShardCopyDestReceiver *) palloc0(
|
|
||||||
sizeof(ShardCopyDestReceiver));
|
|
||||||
|
|
||||||
/* set up the DestReceiver function pointers */
|
|
||||||
copyDest->pub.receiveSlot = ShardCopyDestReceiverReceive;
|
|
||||||
copyDest->pub.rStartup = ShardCopyDestReceiverStartup;
|
|
||||||
copyDest->pub.rShutdown = ShardCopyDestReceiverShutdown;
|
|
||||||
copyDest->pub.rDestroy = ShardCopyDestReceiverDestroy;
|
|
||||||
copyDest->pub.mydest = DestCopyOut;
|
|
||||||
copyDest->executorState = executorState;
|
|
||||||
|
|
||||||
copyDest->destinationNodeId = destinationNodeId;
|
|
||||||
copyDest->destinationShardFullyQualifiedName = destinationShardFullyQualifiedName;
|
|
||||||
copyDest->tuplesSent = 0;
|
|
||||||
copyDest->connection = NULL;
|
|
||||||
copyDest->useLocalCopy = CanUseLocalCopy(destinationNodeId);
|
|
||||||
|
|
||||||
return (DestReceiver *) copyDest;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ShardCopyDestReceiverDestroy frees the DestReceiver.
|
* ShardCopyDestReceiverDestroy frees the DestReceiver.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -60,9 +60,11 @@ worker_split_copy(PG_FUNCTION_ARGS)
|
||||||
(errmsg("Shard Copy Info cannot have null values.")));
|
(errmsg("Shard Copy Info cannot have null values.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int slice_ndim = 0;
|
||||||
|
ArrayMetaState *mState = NULL;
|
||||||
ArrayIterator copyInfo_iterator = array_create_iterator(splitCopyInfoArrayObject,
|
ArrayIterator copyInfo_iterator = array_create_iterator(splitCopyInfoArrayObject,
|
||||||
0 /* slice_ndim */,
|
slice_ndim,
|
||||||
NULL /* mState */);
|
mState);
|
||||||
Datum copyInfoDatum = 0;
|
Datum copyInfoDatum = 0;
|
||||||
bool isnull = false;
|
bool isnull = false;
|
||||||
List *splitCopyInfoList = NULL;
|
List *splitCopyInfoList = NULL;
|
||||||
|
@ -230,10 +232,9 @@ CreatePartitionedSplitCopyDestReceiver(EState *estate,
|
||||||
ArrayType *minValuesArray = NULL;
|
ArrayType *minValuesArray = NULL;
|
||||||
ArrayType *maxValuesArray = NULL;
|
ArrayType *maxValuesArray = NULL;
|
||||||
BuildMinMaxRangeArrays(splitCopyInfoList, &minValuesArray, &maxValuesArray);
|
BuildMinMaxRangeArrays(splitCopyInfoList, &minValuesArray, &maxValuesArray);
|
||||||
char partitionMethod = PartitionMethodViaCatalog(
|
|
||||||
shardIntervalToSplitCopy->relationId);
|
|
||||||
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(
|
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(
|
||||||
shardIntervalToSplitCopy->relationId);
|
shardIntervalToSplitCopy->relationId);
|
||||||
|
char partitionMethod = cacheEntry->partitionMethod;
|
||||||
Var *partitionColumn = cacheEntry->partitionColumn;
|
Var *partitionColumn = cacheEntry->partitionColumn;
|
||||||
|
|
||||||
CitusTableCacheEntry *shardSearchInfo =
|
CitusTableCacheEntry *shardSearchInfo =
|
||||||
|
|
Loading…
Reference in New Issue