| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | Rahila Syed <rahilasyed90(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: show size of DSAs and dshash tables in pg_dsm_registry_allocations |
| Date: | 2025-12-01 23:04:23 |
| Message-ID: | aS4e9z74V-Vn7NEi@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Dec 02, 2025 at 05:35:34AM +0800, Chao Li wrote:
> V2 overall looks good to me. I just got a question and a few nit comments.
Thanks for reviewing.
> Why do you error out instead of reporting 0/NULL usage here?
If attaching to the control segment fails, something has gone horribly
wrong. I don't think returning 0 for the size is appropriate in that case.
Also note that other functions in this file ERROR when attaching fails
(e.g., dsa_attach()).
> ```
> + else if (entry->type == DSMR_ENTRY_TYPE_DSH &&
> + entry->dsh.dsa_handle !=DSA_HANDLE_INVALID)
> ```
>
> Missing a white space after !=.
I agree, but for some reason, pgindent insists on removing that space. I'm
leaving that for another thread.
> ```
> - Size of the allocation in bytes. NULL for entries of type
> - <literal>area</literal> and <literal>hash</literal>.
> + Size of the allocation in bytes. NULL for entries that failed
> + initialization.
> ```
>
> “Failed initialization”, I guess “to” is needed after “failed”.
IMHO it's fine as-is. We could say "failed to initialize", but I'm not
sure that's materially better at conveying the information.
> ```
> -SELECT name, type, size IS DISTINCT FROM 0 AS size
> +SELECT name, type, size > 0 AS size
> ```
>
> As you changed the third column from “size” to “size > 0”, now it’s a
> bool column, so maybe rename the column alias from “size” to something
> indicating a bool type, such as “size_ok”, “has_size”, etc.
It was already a bool column, but your point still stands. I changed it to
"size_ok".
--
nathan
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-rework-DSM-registry-view.patch | text/plain | 6.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-01 23:29:49 | Re: split tablecmds.c |
| Previous Message | Myles Lewis | 2025-12-01 23:04:17 | Re: [PATCH] Add native PIVOT syntax for SQL Server/Oracle compatibility |