From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: add function for creating/attaching hash table in DSM registry |
Date: | 2025-06-09 20:26:17 |
Message-ID: | aEdDacna9aHnt46K@nathan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Jun 09, 2025 at 03:10:30PM -0500, Sami Imseih wrote:
> One thing I noticed, and I´m not too fond of, is that the wait_event name shows
> up with the _dsh suffix:
>
> ```
> postgres=# select query, wait_event, wait_event_type from pg_stat_activity ;
> query | wait_event
> | wait_event_type
> -------------------------------------------------------------------+------------------------
> +-----------------
> select 1; | pg_stat_statements_dsh
> | LWLock
> ```
>
> So the suffix isn´t just an internal name, it´s user-facing now. If we really
> need to keep this behavior, I think it´s important to document it clearly in
> the code.
Okay. FWIW we do use suffixes like "DSA" and "Hash" for the built-in
tranche names (e.g., DSMRegistryDSA and DSMRegistryHash).
> +
> +static dshash_table *tdr_hash;
> +
>
> Isn't it better to initialize this to NULL?
It might be better notationally, but it'll be initialized to NULL either
way.
> ```
> params is ignored; a new tranche ID will be generated if needed.
> ```
>
> The "if needed" part isn't necessary here. A new tranche ID will always be
> generated, right?
Not if the dshash table already exists.
> 3/ GetNamedDSMSegment is called with "found" as the last argument:
>
> ```
> state = GetNamedDSMSegment(name, sizeof(NamedDSMHashState), NULL, found);
> ```
>
> I think it should use a different bool here instead of "found", since that
> value isn´t really needed from GetNamedDSMSegment. Also, it refers to
> whether the dynamic hash was found, and is set later in the routine.
Yeah, I might as well add another boolean variable called "unused" or
something for clarity here.
--
nathan
From | Date | Subject | |
---|---|---|---|
Next Message | Dagfinn Ilmari Mannsåker | 2025-06-09 20:27:07 | Improve tab completion for various SET/RESET forms |
Previous Message | Sami Imseih | 2025-06-09 20:10:30 | Re: add function for creating/attaching hash table in DSM registry |