MCPcopy Create free account
hub / github.com/apache/cloudberry / FindReplTupleInLocalRel

Function FindReplTupleInLocalRel

src/backend/replication/logical/worker.c:1630–1654  ·  view source on GitHub ↗

* Try to find a tuple received from the publication side (in 'remoteslot') in * the corresponding local relation using either replica identity index, * primary key or if needed, sequential scan. * * Local tuple, if found, is returned in '*localslot'. */

Source from the content-addressed store, hash-verified

1628 * Local tuple, if found, is returned in '*localslot'.
1629 */
1630static bool
1631FindReplTupleInLocalRel(EState *estate, Relation localrel,
1632 LogicalRepRelation *remoterel,
1633 TupleTableSlot *remoteslot,
1634 TupleTableSlot **localslot)
1635{
1636 Oid idxoid;
1637 bool found;
1638
1639 *localslot = table_slot_create(localrel, &estate->es_tupleTable);
1640
1641 idxoid = GetRelationIdentityOrPK(localrel);
1642 Assert(OidIsValid(idxoid) ||
1643 (remoterel->replident == REPLICA_IDENTITY_FULL));
1644
1645 if (OidIsValid(idxoid))
1646 found = RelationFindReplTupleByIndex(localrel, idxoid,
1647 LockTupleExclusive,
1648 remoteslot, *localslot);
1649 else
1650 found = RelationFindReplTupleSeq(localrel, LockTupleExclusive,
1651 remoteslot, *localslot);
1652
1653 return found;
1654}
1655
1656/*
1657 * This handles insert, update, delete on a partitioned table.

Callers 3

Calls 4

table_slot_createFunction · 0.85
GetRelationIdentityOrPKFunction · 0.85
RelationFindReplTupleSeqFunction · 0.85

Tested by

no test coverage detected