diff --git a/src/backend/distributed/executor/multi_utility.c b/src/backend/distributed/executor/multi_utility.c index 25d6b53aa..90549e9d6 100644 --- a/src/backend/distributed/executor/multi_utility.c +++ b/src/backend/distributed/executor/multi_utility.c @@ -3027,8 +3027,12 @@ PostProcessUtility(Node *parsetree) indexForm = (Form_pg_index) GETSTRUCT(indexTuple); indexForm->indisvalid = true; +#if (PG_VERSION_NUM >= 100000) + CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple); +#else simple_heap_update(pg_index, &indexTuple->t_self, indexTuple); CatalogUpdateIndexes(pg_index, indexTuple); +#endif /* clean up; index now marked valid, but ROLLBACK will mark invalid */ heap_freetuple(indexTuple); diff --git a/src/backend/distributed/master/master_metadata_utility.c b/src/backend/distributed/master/master_metadata_utility.c index 4081ad35b..821574fcb 100644 --- a/src/backend/distributed/master/master_metadata_utility.c +++ b/src/backend/distributed/master/master_metadata_utility.c @@ -794,8 +794,12 @@ InsertShardRow(Oid relationId, uint64 shardId, char storageType, tupleDescriptor = RelationGetDescr(pgDistShard); heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleInsert(pgDistShard, heapTuple); +#else simple_heap_insert(pgDistShard, heapTuple); CatalogUpdateIndexes(pgDistShard, heapTuple); +#endif /* invalidate previous cache entry and close relation */ CitusInvalidateRelcacheByRelid(relationId); @@ -842,8 +846,12 @@ InsertShardPlacementRow(uint64 shardId, uint64 placementId, tupleDescriptor = RelationGetDescr(pgDistShardPlacement); heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleInsert(pgDistShardPlacement, heapTuple); +#else simple_heap_insert(pgDistShardPlacement, heapTuple); CatalogUpdateIndexes(pgDistShardPlacement, heapTuple); +#endif CitusInvalidateRelcacheByShardId(shardId); @@ -898,8 +906,13 @@ InsertIntoPgDistPartition(Oid relationId, char distributionMethod, newTuple = heap_form_tuple(RelationGetDescr(pgDistPartition), newValues, newNulls); /* finally insert tuple, build index entries & register cache invalidation */ +#if (PG_VERSION_NUM >= 100000) + CatalogTupleInsert(pgDistPartition, newTuple); +#else simple_heap_insert(pgDistPartition, newTuple); CatalogUpdateIndexes(pgDistPartition, newTuple); +#endif + CitusInvalidateRelcacheByRelid(relationId); RecordDistributedRelationDependencies(relationId, (Node *) distributionColumn); @@ -1150,9 +1163,13 @@ UpdateShardPlacementState(uint64 placementId, char shardState) replace[Anum_pg_dist_shard_placement_shardstate - 1] = true; heapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace); - simple_heap_update(pgDistShardPlacement, &heapTuple->t_self, heapTuple); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleUpdate(pgDistShardPlacement, &heapTuple->t_self, heapTuple); +#else + simple_heap_update(pgDistShardPlacement, &heapTuple->t_self, heapTuple); CatalogUpdateIndexes(pgDistShardPlacement, heapTuple); +#endif shardId = DatumGetInt64(heap_getattr(heapTuple, Anum_pg_dist_shard_placement_shardid, @@ -1217,9 +1234,13 @@ UpdateColocationGroupReplicationFactor(uint32 colocationId, int replicationFacto replace[Anum_pg_dist_colocation_replicationfactor - 1] = true; newHeapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace); - simple_heap_update(pgDistColocation, &newHeapTuple->t_self, newHeapTuple); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleUpdate(pgDistColocation, &newHeapTuple->t_self, newHeapTuple); +#else + simple_heap_update(pgDistColocation, &newHeapTuple->t_self, newHeapTuple); CatalogUpdateIndexes(pgDistColocation, newHeapTuple); +#endif CommandCounterIncrement(); diff --git a/src/backend/distributed/metadata/metadata_sync.c b/src/backend/distributed/metadata/metadata_sync.c index e7a659c2b..2f66cd2af 100644 --- a/src/backend/distributed/metadata/metadata_sync.c +++ b/src/backend/distributed/metadata/metadata_sync.c @@ -812,9 +812,13 @@ MarkNodeHasMetadata(char *nodeName, int32 nodePort, bool hasMetadata) replace[Anum_pg_dist_node_hasmetadata - 1] = true; heapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace); - simple_heap_update(pgDistNode, &heapTuple->t_self, heapTuple); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleUpdate(pgDistNode, &heapTuple->t_self, heapTuple); +#else + simple_heap_update(pgDistNode, &heapTuple->t_self, heapTuple); CatalogUpdateIndexes(pgDistNode, heapTuple); +#endif CitusInvalidateRelcacheByRelid(DistNodeRelationId()); diff --git a/src/backend/distributed/transaction/transaction_recovery.c b/src/backend/distributed/transaction/transaction_recovery.c index edff64850..b2b48ae92 100644 --- a/src/backend/distributed/transaction/transaction_recovery.c +++ b/src/backend/distributed/transaction/transaction_recovery.c @@ -100,8 +100,13 @@ LogTransactionRecord(int groupId, char *transactionName) tupleDescriptor = RelationGetDescr(pgDistTransaction); heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleInsert(pgDistTransaction, heapTuple); +#else simple_heap_insert(pgDistTransaction, heapTuple); CatalogUpdateIndexes(pgDistTransaction, heapTuple); +#endif + CommandCounterIncrement(); /* close relation and invalidate previous cache entry */ diff --git a/src/backend/distributed/utils/colocation_utils.c b/src/backend/distributed/utils/colocation_utils.c index 2d2cfbeaf..33abb1911 100644 --- a/src/backend/distributed/utils/colocation_utils.c +++ b/src/backend/distributed/utils/colocation_utils.c @@ -477,8 +477,12 @@ CreateColocationGroup(int shardCount, int replicationFactor, Oid distributionCol tupleDescriptor = RelationGetDescr(pgDistColocation); heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleInsert(pgDistColocation, heapTuple); +#else simple_heap_insert(pgDistColocation, heapTuple); CatalogUpdateIndexes(pgDistColocation, heapTuple); +#endif /* increment the counter so that next command can see the row */ CommandCounterIncrement(); @@ -648,9 +652,15 @@ UpdateRelationColocationGroup(Oid distributedRelationId, uint32 colocationId) replace[Anum_pg_dist_partition_colocationid - 1] = true; heapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isNull, replace); - simple_heap_update(pgDistPartition, &heapTuple->t_self, heapTuple); + +#if (PG_VERSION_NUM >= 100000) + CatalogTupleUpdate(pgDistPartition, &heapTuple->t_self, heapTuple); +#else + simple_heap_update(pgDistPartition, &heapTuple->t_self, heapTuple); CatalogUpdateIndexes(pgDistPartition, heapTuple); +#endif + CitusInvalidateRelcacheByRelid(distributedRelationId); CommandCounterIncrement(); diff --git a/src/backend/distributed/utils/node_metadata.c b/src/backend/distributed/utils/node_metadata.c index 9a0d31a8f..18de0a02f 100644 --- a/src/backend/distributed/utils/node_metadata.c +++ b/src/backend/distributed/utils/node_metadata.c @@ -625,9 +625,14 @@ SetNodeState(char *nodeName, int32 nodePort, bool isActive) replace[Anum_pg_dist_node_isactive - 1] = true; heapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace); - simple_heap_update(pgDistNode, &heapTuple->t_self, heapTuple); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleUpdate(pgDistNode, &heapTuple->t_self, heapTuple); +#else + simple_heap_update(pgDistNode, &heapTuple->t_self, heapTuple); CatalogUpdateIndexes(pgDistNode, heapTuple); +#endif + CitusInvalidateRelcacheByRelid(DistNodeRelationId()); CommandCounterIncrement(); @@ -868,8 +873,12 @@ InsertNodeRow(int nodeid, char *nodeName, int32 nodePort, uint32 groupId, char * tupleDescriptor = RelationGetDescr(pgDistNode); heapTuple = heap_form_tuple(tupleDescriptor, values, isNulls); +#if (PG_VERSION_NUM >= 100000) + CatalogTupleInsert(pgDistNode, heapTuple); +#else simple_heap_insert(pgDistNode, heapTuple); CatalogUpdateIndexes(pgDistNode, heapTuple); +#endif /* close relation and invalidate previous cache entry */ heap_close(pgDistNode, AccessExclusiveLock);