Re: Comments on Custom RMGRs
Danil Anisimow <anisimow.d@gmail.com>
From: Danil Anisimow <anisimow.d@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Andres Freund <andres@anarazel.de>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-03-29T11:20:11Z
Lists: pgsql-hackers
Attachments
- rmgr_003.v3.patch (text/x-patch) patch v3
On Fri, Mar 22, 2024 at 2:02 AM Jeff Davis <pgsql@j-davis.com> wrote: > On Thu, 2024-03-21 at 19:47 +0700, Danil Anisimow wrote: > > [pgss_001.v1.patch] adds a custom resource manager to the > > pg_stat_statements extension. > > Did you consider moving the logic for loading the initial contents from > disk from pgss_shmem_startup to .rmgr_startup? I tried it, but .rmgr_startup is not called if the system was shut down cleanly. > My biggest concern is that it might not be quite right for a table AM > that has complex state that needs action to be taken at a slightly > different time, e.g. right after CheckPointBuffers(). > Then again, the rmgr is a low-level API, and any extension using it > should be prepared to adapt to changes. If it works for pgss, then we > know it works for at least one thing, and we can always improve it > later. For instance, we might call the hook several times and pass it a > "phase" argument. In [rmgr_003.v3.patch] I added a phase argument to RmgrCheckpoint(). Currently it is only called in two places: before and after CheckPointBuffers(). -- Regards, Daniil Anisimov Postgres Professional: http://postgrespro.com