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
pgstat_stress.tar.gz
Description: application/gzip
signature.asc
Description: PGP signature
