| From: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com> |
| Subject: | Re: pgstat: Flush some statistics within running transactions, take 2 |
| Date: | 2026-12-01 22:10:57 |
| Message-ID: | CAN12+Y+wrdFAPtNXscxak7baWh2zuZkswzM=gK_7iwjXy2uKKw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Thanks for the review, Michael!
v23 attached, split into 6 patches:
0001 pgstat: Track HOT and new-page updates per (sub)transaction
0002 pgstat: Add xact_boundary to flush callbacks and a flush result type
0003 pgstat: Move pending index and function counts into a sub-struct
0004 pgstat: Allow pg_stat_force_next_flush() to work in transaction
0005 test_custom_stats: Show transactional counters in a custom stats kind
0006 pgstat: Make in-transaction flushes of pending stats interruptible
> - The DROP queries in stats.sql.
I removed these. Looking back in the thread, you did mention that
"sometimes we keep around a few objects for the sake of pg_upgrade, so
I would recommend to just leave that be."
> - Addition of tuples_hot_updated and tuples_newpage_updated to
> PgStat_TableXactStatus, which is something that you require for the
> in-transaction flushes.
This is 0001.
> - Introduction of xact_boundary, which reflects most of the mechanical
> changes in the patch across all the stats kinds. At least that should
> remove some churn from the main patch.
This is 0002. I also split out 0003, which moves the pending index and
function counts into a sub-struct, so that 0004 can keep a flushed
baseline next to them. That removes more churn from the main patch.
> I'm wondering whether the CFI in the flush loop should be a patch of
> its own, as well.. Or perhaps not.
I think it should be. 0006 adds the CFI, and keeps the shutdown hook
from reentering the flush when a FATAL is raised there, which is only
needed once the flush can be interrupted. The rest of the flush state
handling is in 0004, since it matters as soon as a flush can run inside
a transaction.
v23 also restores the comments you pointed out in
pgstat_relation_flush_cb() and pgstat_index_flush_cb(), and reverts some
unrelated comment rewording v22 had in test_custom_var_stats.c. I also
made a few other small comment adjustments while going through it.
I ran check-world incrementally for each patch, and all pass.
WDYT?
--
Sami Imseih
Amazon Web Services (AWS)
| Attachment | Content-Type | Size |
|---|---|---|
| v23-0002-pgstat-Add-xact_boundary-to-flush-callbacks-and-.patch | application/octet-stream | 23.6 KB |
| v23-0004-pgstat-Allow-pg_stat_force_next_flush-to-work-in.patch | application/octet-stream | 70.0 KB |
| v23-0005-test_custom_stats-Show-transactional-counters-in.patch | application/octet-stream | 14.6 KB |
| v23-0003-pgstat-Move-pending-index-and-function-counts-in.patch | application/octet-stream | 10.0 KB |
| v23-0006-pgstat-Make-in-transaction-flushes-of-pending-st.patch | application/octet-stream | 5.2 KB |
| v23-0001-pgstat-Track-HOT-and-new-page-updates-per-sub-tr.patch | application/octet-stream | 5.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sami Imseih | 2026-12-01 22:17:09 | Re: pgstat: Flush some statistics within running transactions, take 2 |
| Previous Message | Zsolt Parragi | 2026-12-01 22:09:48 | Re: pgstat: Flush some statistics within running transactions, take 2 |