diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index 0c17a32e4..23d144e52 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -2133,9 +2133,6 @@ CitusCopyDestReceiverStartup(DestReceiver *dest, int operation, */ SerializeNonCommutativeWrites(shardIntervalList, RowExclusiveLock); - /* keep the table metadata to avoid looking it up for every tuple */ - copyDest->tableMetadata = cacheEntry; - UseCoordinatedTransaction(); if (cacheEntry->replicationModel == REPLICATION_MODEL_2PC || @@ -2480,8 +2477,9 @@ ShardIdForTuple(CitusCopyDestReceiver *copyDest, Datum *columnValues, bool *colu * For reference table, this function blindly returns the tables single * shard. */ - ShardInterval *shardInterval = FindShardInterval(partitionColumnValue, - copyDest->tableMetadata); + CitusTableCacheEntry *cacheEntry = + GetCitusTableCacheEntry(copyDest->distributedRelationId); + ShardInterval *shardInterval = FindShardInterval(partitionColumnValue, cacheEntry); if (shardInterval == NULL) { ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), diff --git a/src/include/distributed/commands/multi_copy.h b/src/include/distributed/commands/multi_copy.h index 9ec8f280b..0029d5396 100644 --- a/src/include/distributed/commands/multi_copy.h +++ b/src/include/distributed/commands/multi_copy.h @@ -88,9 +88,6 @@ typedef struct CitusCopyDestReceiver List *columnNameList; int partitionColumnIndex; - /* distributed table metadata */ - CitusTableCacheEntry *tableMetadata; - /* open relation handle */ Relation distributedRelation;