Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit588acf6

Browse files
author
Amit Kapila
committed
Avoid invalidating all RelationSyncCache entries on publication change.
On change of publication via ALTER PUBLICATION ... SET/ADD/DROP commands,we were invalidating all the relations present in relation sync cachemaintained by pgoutput. We need to invalidate only the relation entriesthat are changed as part of publication DDL.We have ensured that the publication DDL execution generated theinvalidations required to invalidate impacted relation sync entries inRelationSyncCache.This improves the performance by avoiding building the cache entries forthe cases where a publication has many tables but only one of them isdropped.Author: Shlok Kyal <shlok.kyal.oss@gmail.com>Author: Hayato Kuroda <kuroda.hayato@fujitsu.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
1 parent1d33de9 commit588acf6

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

‎src/backend/replication/pgoutput/pgoutput.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,23 +1965,18 @@ init_rel_sync_cache(MemoryContext cachectx)
19651965
/*
19661966
* Flush all cache entries after a pg_namespace change, in case it was a
19671967
* schema rename affecting a relation being replicated.
1968+
*
1969+
* XXX: It is not a good idea to invalidate all the relation entries in
1970+
* RelationSyncCache on schema rename. We can optimize it to invalidate
1971+
* only the required relations by either having a specific invalidation
1972+
* message containing impacted relations or by having schema information
1973+
* in each RelationSyncCache entry and using hashvalue of pg_namespace.oid
1974+
* passed to the callback.
19681975
*/
19691976
CacheRegisterSyscacheCallback(NAMESPACEOID,
19701977
rel_sync_cache_publication_cb,
19711978
(Datum)0);
19721979

1973-
/*
1974-
* Flush all cache entries after any publication changes. (We need no
1975-
* callback entry for pg_publication, because publication_invalidation_cb
1976-
* will take care of it.)
1977-
*/
1978-
CacheRegisterSyscacheCallback(PUBLICATIONRELMAP,
1979-
rel_sync_cache_publication_cb,
1980-
(Datum)0);
1981-
CacheRegisterSyscacheCallback(PUBLICATIONNAMESPACEMAP,
1982-
rel_sync_cache_publication_cb,
1983-
(Datum)0);
1984-
19851980
relation_callbacks_registered= true;
19861981
}
19871982

@@ -2397,8 +2392,7 @@ rel_sync_cache_relation_cb(Datum arg, Oid relid)
23972392
/*
23982393
* Publication relation/schema map syscache invalidation callback
23992394
*
2400-
* Called for invalidations on pg_publication, pg_publication_rel,
2401-
* pg_publication_namespace, and pg_namespace.
2395+
* Called for invalidations on pg_publication and pg_namespace.
24022396
*/
24032397
staticvoid
24042398
rel_sync_cache_publication_cb(Datumarg,intcacheid,uint32hashvalue)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp