From f10a025cfe97c1a341f636368e67af5ca644c5d8 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 4 Jul 2022 14:52:12 +0200 Subject: Implement List support for TransactionId Use it for RelationSyncEntry->streamed_txns, which is currently using an integer list. The API support is not complete, not because it is hard to write but because it's unclear that it's worth the code space, there being so little use of XID lists. Discussion: https://postgr.es/m/202205130830.g5ntonhztspb@alvherre.pgsql Reviewed-by: Amit Kapila --- src/backend/replication/pgoutput/pgoutput.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/backend/replication/pgoutput/pgoutput.c') diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 8deae571433..2cbca4a0870 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1923,15 +1923,7 @@ init_rel_sync_cache(MemoryContext cachectx) static bool get_schema_sent_in_streamed_txn(RelationSyncEntry *entry, TransactionId xid) { - ListCell *lc; - - foreach(lc, entry->streamed_txns) - { - if (xid == (uint32) lfirst_int(lc)) - return true; - } - - return false; + return list_member_xid(entry->streamed_txns, xid); } /* @@ -1945,7 +1937,7 @@ set_schema_sent_in_streamed_txn(RelationSyncEntry *entry, TransactionId xid) oldctx = MemoryContextSwitchTo(CacheMemoryContext); - entry->streamed_txns = lappend_int(entry->streamed_txns, xid); + entry->streamed_txns = lappend_xid(entry->streamed_txns, xid); MemoryContextSwitchTo(oldctx); } @@ -2248,7 +2240,7 @@ cleanup_rel_sync_cache(TransactionId xid, bool is_commit) */ foreach(lc, entry->streamed_txns) { - if (xid == (uint32) lfirst_int(lc)) + if (xid == lfirst_xid(lc)) { if (is_commit) entry->schema_sent = true; -- cgit v1.2.3