| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pgstat: don't assert on dropped entries when writing stats file |
| Date: | 2026-10-21 00:48:29 |
| Message-ID: | atgL3Jg_lfMCLJ_r@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 20, 2026 at 11:07:21AM -0500, Sami Imseih wrote:
> Generation does not really tell us that this is another entry created
> with the same key. It could be the same entry with the same generation,
> right?
I was doing a bit more testing, and hitting the generation check is
possible, but in all of them I just get generation == 0, pointing at
an entirely new entry. I'll drop this part.
> + else
> + {
> + /* Entry reinitialized or created again, still in use. */
> +
> dshash_release_lock(pgStatLocal.kind_hash[key.kind], shent);
> + }
>
> Anyhow, the else-if and else branches do the same thing as it stands.
Yep, makes sense.
I am also attaching an equivalent of what I have used to stress-test
the entry releases. At first, I was using a set of terminals with
pgbench commands running in an infinite loop and server restarts.
That was annoying, so I've asked Claude to summarize that into a
single equivalent script that can be reused at will. If you want to
enlarge the window, add a small pg_usleep() before the dshash_find()
that does the exclusive lock lookup, like 20ms. Without the hardcoded
sleep, it takes a few more iterations to hit the various failures.
--
Michael
| Attachment | Content-Type | Size |
|---|---|---|
| pgstat_stress.tar.gz | application/gzip | 1.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-21 00:56:45 | Re: Trying out <stdatomic.h> |
| Previous Message | shihao zhong | 2026-10-21 00:48:09 | Re: [PATCH] Fix grouping-set nulling of variable-free grouping expressions |