Re: like pg_shmem_allocations, but fine-grained for DSM registry ?
Florents Tselai <florents.tselai@gmail.com>
From: Florents Tselai <florents.tselai@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-06-03T20:07:31Z
Lists: pgsql-hackers
Attachments
- v4-0001-First-attempt-towards-a-pg_dsm_registry-view.-Ite.patch (application/octet-stream)
- v4-0002-Rename-view-to-pg_dsm_registry_allocations-and-fu.patch (application/octet-stream)
- v4-0003-Add-doc-entry-for-pg_shmem_allocations_numa.patch (application/octet-stream)
- v4-0004-Cleanup-includes-in-pg_get_dsm_registry_allocatio.patch (application/octet-stream)
- (unnamed) (text/plain)
> On 3 Jun 2025, at 10:53 PM, Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Tue, Jun 03, 2025 at 10:39:25PM +0300, Florents Tselai wrote:
>> Thanks for the detailed review Nathan
>
> Thanks for the updated patch!
>
> + if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
> + ereport(ERROR, (errmsg("pg_get_dsm_registry_allocations must be used in a SRF context")));
>
> InitMaterializedSRF() takes care of this for you.
>
> +typedef struct
> +{
> + Tuplestorestate *tupstore;
> + TupleDesc tupdesc;
> +} DSMRegistrySRFContext;
>
> This appears to be unused.
>
> +#include "fmgr.h"
> +#include "funcapi.h"
> +#include "miscadmin.h"
> +#include "utils/builtins.h"
>
> Do we need fmgr.h and miscadmin.h? Also, please alphabetize these into the
> existing list of #includes.
>
> + values[1] = Int64GetDatum(entry->size);
>
> I think there's a sign mismatch problem here, but it seems implausible in
> practice. pg_get_shmem_allocations() does the same thing.
>
> + <sect1 id="view-pg-dsm-registry-allocations">
> + <title><structname>pg_dsm_registry_allocations</structname></title>
>
> We need to add an entry into the System Views table in the Overview page,
> too.
>
> --
> nathan