RE: memory leak in logical WAL sender with pgoutput's cachectx - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject RE: memory leak in logical WAL sender with pgoutput's cachectx
Date
Msg-id OSCPR01MB1496670956541A05DA3C3DB3BF531A@OSCPR01MB14966.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: memory leak in logical WAL sender with pgoutput's cachectx  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
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


Attachment

pgsql-hackers by date:

Previous
From: James Pang
Date:
Subject: Re: max_locks_per_transaction v18
Next
From: Dilip Kumar
Date:
Subject: Re: Conflict detection for update_deleted in logical replication