| From: | Sami Imseih <samimseih(at)gmail(dot)com> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [Proposal] Adding callback support for custom statistics kinds |
| Date: | 2025-12-09 03:57:15 |
| Message-ID: | CAA5RZ0sg6gskHRgfymo9njEWuXDyn0Zwe+0bcX=nByyE7W+6bw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> + if (kind_info->from_serialized_extra_stats)
> + {
> + if (!kind_info->from_serialized_extra_stats(&key, header, fpin))
> + {
> + elog(WARNING, "could not read extra stats for entry %u/%u/%" PRIu64,
> + key.kind, key.dboid, key.objid);
> + goto error;
> + }
> + }
> ```
>
> When deserialize failed, it goes to error. In the error clause, it calls pgstat_reset_after_failure(), so do we want to give extensions a chance to do some reset operations? If yes, then we can add a reset_after_failure() callback.
The way v5 is dealing with a deserialize failure is that when
it goes to error, the pgstat_reset_after_failure() will reset the
stats for all kinds, since pgstat_drop_all_entries() is called
during that call. So there is nothing for an extension to have
to do on its own. The extension will then clean-up resources
at the end when all the kinds are iterated over and
kind_info->end_extra_stats(STATS_READ) is called for each
kind.
Let me know if I'm still missing something?
--
Sami Imseih
Amazon Web Services (AWS)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nitin Jadhav | 2025-12-09 04:00:41 | Re: Fix crash during recovery when redo segment is missing |
| Previous Message | Thomas Munro | 2025-12-09 03:47:08 | Re: Trying out read streams in pgvector (an extension) |