aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/pgoutput
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2025-03-13 09:03:45 +0530
committerAmit Kapila <akapila@postgresql.org>2025-03-13 09:16:33 +0530
commit3abe9dc18892b9f69bb48a2eb21fbe5cf348a489 (patch)
tree94c13f6e439179127d0b8bd9d03d080726bedda1 /src/backend/replication/pgoutput
parent75da2bece670059f3c1a3628dfbc3d24cc9638b8 (diff)
downloadpostgresql-3abe9dc18892b9f69bb48a2eb21fbe5cf348a489.tar.gz
postgresql-3abe9dc18892b9f69bb48a2eb21fbe5cf348a489.zip
Avoid invalidating all RelationSyncCache entries on publication rename.
On Publication rename, we need to only invalidate the RelationSyncCache entries corresponding to relations that are part of the publication being renamed. As part of this patch, we introduce a new invalidation message to invalidate the cache maintained by the logical decoding output plugin. We can't use existing relcache invalidation for this purpose, as that would unnecessarily cause relcache invalidations in other backends. This will improve performance by building fewer relation cache entries during logical replication. Author: Hayato Kuroda <kuroda.hayato@fujitsu.com> Author: Shlok Kyal <shlok.kyal.oss@gmail.com> Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/OSCPR01MB14966C09AA201EFFA706576A7F5C92@OSCPR01MB14966.jpnprd01.prod.outlook.com
Diffstat (limited to 'src/backend/replication/pgoutput')
-rw-r--r--src/backend/replication/pgoutput/pgoutput.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 9063af6e1df..ed806c54300 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -531,6 +531,8 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
CacheRegisterSyscacheCallback(PUBLICATIONOID,
publication_invalidation_cb,
(Datum) 0);
+ CacheRegisterRelSyncCallback(rel_sync_cache_relation_cb,
+ (Datum) 0);
publication_callback_registered = true;
}
@@ -1789,12 +1791,6 @@ static void
publication_invalidation_cb(Datum arg, int cacheid, uint32 hashvalue)
{
publications_valid = false;
-
- /*
- * Also invalidate per-relation cache so that next time the filtering info
- * is checked it will be updated with the new publication settings.
- */
- rel_sync_cache_publication_cb(arg, cacheid, hashvalue);
}
/*