Dear Sawada-san, > I've not verified, but even if that's true, IIUC only one relation's > cache entry can set in_use to true at a time.
I also think so. > If my understanding is > correct, when the walsender accepts invalidation messages in > logicalrep_write_tuple() as you mentioned, it doesn't release the > cache of the relation whose change is being sent but does for other > relations. It seems to me too aggressive to release caches compared to > the current behavior. Valid point. In some cases, publications can be altered then same relsync entries would be added again. So... first approach may be better from the perspective. Attached patch counts the number of invalidated entries. There is a chance to cleanup them only at COMMIT/ABORT/PREPARE time - hence in_use flag is not needed. Thought? Best regards, Hayato Kuroda FUJITSU LIMITED
v2-0001-pgoutput-allow-cleaning-up-Relsync-cache-entries.patch
Description: v2-0001-pgoutput-allow-cleaning-up-Relsync-cache-entries.patch