Use direct hash lookup in logicalrep_partmap_invalidate_cb()

This replaces an O(N) hash_seq_search() loop by an O(1) lookup, removing
a TODO item, making the invalidation callback faster when dealing with
many relations.  This can work because LogicalRepPartMap is keyed by a
partition OID, and a relmapentry's localreloid matches with it.

An assertion is added in logicalrep_partition_open() to enforce the fact
that localreloid matches with the hash key.

Author: DaeMyung Kang <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0962f9e344390c69e44bc55675510b2fa2b3f778

Modified Files
--------------
src/backend/replication/logical/relation.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)

Reply via email to