| From: | Sami Imseih <samimseih(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [Proposal] Adding callback support for custom statistics kinds |
| Date: | 2025-12-06 01:27:50 |
| Message-ID: | CAA5RZ0sG2RUKg=OLY+6-e4q=X9rsLfK3pKn03d=RZQppEDR=Bg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> > However, as discussed off-list, I do think moving the custom kind tests from
> > injection points to the new test module is a prerequisite. I rather
> > not have us push a new test module that is doing duplicate work as the injection
> > stats tests.
> > I worked on this refactoring today and plan to have a patch ready for review
> > by tomorrow.
>
> Cool, thanks!
Attached is the new test module that replaces the custom statistics
tests currently in the injection points tests. Under test_custom_stats, there
are two separate modules: one for variable-amount stats and one for
fixed-amount stats. With this, we can completely remove the
stats-related tests and supporting code under
src/test/modules/injection_points/.
A few notes on the tests:
1. Variable stats: pgstat_drop_entry() and pgstat_fetch_entry() are
exercised here, addressing an earlier point raised in the thread.
2. Fixed-amount stats: I added specific tests for reset behavior; both
during crash recovery and during manual resets.
3. In test_custom_fixed_stats.c, you will see this comment:
```
/* see explanation above PgStatShared_Archiver for the reset protocol */
LWLockAcquire(&stats_shmem->lock, LW_EXCLUSIVE);
```
This is intentional, as the reset protocol is documented at the
referenced location [0]. I wanted to call that out for the patch review.
Once this gets pushed, it will simplify the remaining work needed
for the remaining serialization callbacks work.
[0] https://github.com/postgres/postgres/blob/master/src/include/utils/pgstat_internal.h#L362-L382
--
Sami Imseih
Amazon Web Services (AWS)
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Move-custom-stats-tests-from-injection_points-to-.patch | application/octet-stream | 58.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-06 01:35:51 | Re: Making jsonb_agg() faster |
| Previous Message | Thomas Munro | 2025-12-06 00:56:32 | Re: Safer hash table initialization macro |