Re: [Proposal] Adding callback support for custom statistics kinds - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: [Proposal] Adding callback support for custom statistics kinds
Date
Msg-id CAA5RZ0sg6gskHRgfymo9njEWuXDyn0Zwe+0bcX=nByyE7W+6bw@mail.gmail.com
Whole thread Raw
In response to Re: [Proposal] Adding callback support for custom statistics kinds  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: [Proposal] Adding callback support for custom statistics kinds
List 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
togive 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)



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Trying out read streams in pgvector (an extension)
Next
From: Nitin Jadhav
Date:
Subject: Re: Fix crash during recovery when redo segment is missing