mirror of https://github.com/citusdata/citus.git
Try copying shard intervals out of cache for long lived borrow
parent
a461ef20d9
commit
8e79672839
|
@ -210,8 +210,37 @@ CoordinatorInsertSelectExecScanInternal(CustomScanState *node)
|
||||||
distSelectJob->jobId);
|
distSelectJob->jobId);
|
||||||
char *distResultPrefix = distResultPrefixString->data;
|
char *distResultPrefix = distResultPrefixString->data;
|
||||||
|
|
||||||
CitusTableCacheEntry *targetRelation =
|
CitusTableCacheEntry *cachedTargetRelation =
|
||||||
GetCitusTableCacheEntry(targetRelationId);
|
GetCitusTableCacheEntry(targetRelationId);
|
||||||
|
CitusTableCacheEntry *targetRelation = palloc(sizeof(CitusTableCacheEntry));
|
||||||
|
*targetRelation = *cachedTargetRelation;
|
||||||
|
|
||||||
|
#if PG_USE_ASSERT_CHECKING
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These fields aren't used in the code which follows,
|
||||||
|
* therefore in assert builds NULL these fields to
|
||||||
|
* segfault if they were to be used.
|
||||||
|
*/
|
||||||
|
targetRelation->partitionKeySTring = NULL;
|
||||||
|
targetRelation->shardIntervalCompareFunction = NULL;
|
||||||
|
targetRelation->hashFunction = NULL;
|
||||||
|
targetRelation->arrayOfPlacementArrayLengths = NULL;
|
||||||
|
targetRelation->arrayOfPlacementArrays = NULL;
|
||||||
|
targetRelation->referencedRelationViaForeignKey = NULL;
|
||||||
|
targetRelation->referencingRelationsViaForeignKey = NULL;
|
||||||
|
#endif
|
||||||
|
targetRelation->partitionColumn = copyObject(
|
||||||
|
cachedTargetRelation->partitionColumn);
|
||||||
|
targetRelation->sortedShardIntervalArray =
|
||||||
|
palloc(targetRelation->shardIntervalArrayLength * sizeof(ShardInterval));
|
||||||
|
for (int shardIndex = 0; shardIndex <
|
||||||
|
targetRelation->shardIntervalArrayLength; shardIndex++)
|
||||||
|
{
|
||||||
|
targetRelation->sortedShardIntervalArray[shardIndex] =
|
||||||
|
CopyShardInterval(
|
||||||
|
cachedTargetRelation->sortedShardIntervalArray[shardIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
int partitionColumnIndex =
|
int partitionColumnIndex =
|
||||||
PartitionColumnIndex(insertTargetList, targetRelation->partitionColumn);
|
PartitionColumnIndex(insertTargetList, targetRelation->partitionColumn);
|
||||||
|
|
Loading…
Reference in New Issue