diff --git a/src/backend/distributed/utils/node_metadata.c b/src/backend/distributed/utils/node_metadata.c index 3662309ce..049a517d8 100644 --- a/src/backend/distributed/utils/node_metadata.c +++ b/src/backend/distributed/utils/node_metadata.c @@ -1754,6 +1754,7 @@ UnsetMetadataSyncedForAll(void) bool indexOK = false; HeapTuple heapTuple = NULL; TupleDesc tupleDescriptor = NULL; + CatalogIndexState indstate; /* * Concurrent master_update_node() calls might iterate and try to update @@ -1767,6 +1768,8 @@ UnsetMetadataSyncedForAll(void) ScanKeyInit(&scanKey[1], Anum_pg_dist_node_metadatasynced, BTEqualStrategyNumber, F_BOOLEQ, BoolGetDatum(true)); + indstate = CatalogOpenIndexes(relation); + scanDescriptor = systable_beginscan(relation, InvalidOid, indexOK, NULL, scanKeyCount, scanKey); @@ -1794,7 +1797,8 @@ UnsetMetadataSyncedForAll(void) newHeapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace); - CatalogTupleUpdate(relation, &newHeapTuple->t_self, newHeapTuple); + CatalogTupleUpdateWithInfo(relation, &newHeapTuple->t_self, newHeapTuple, + indstate); CommandCounterIncrement(); @@ -1804,6 +1808,7 @@ UnsetMetadataSyncedForAll(void) } systable_endscan(scanDescriptor); + CatalogCloseIndexes(indstate); heap_close(relation, NoLock); return updatedAtLeastOne;