Re: Add callbacks for fixed-numbered stats flush in pgstats

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add callbacks for fixed-numbered stats flush in pgstats
Date: 2024-09-09 02:20:54
Message-ID: Zt5bhjTiIwetb8Th@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 04, 2024 at 06:27:43AM +0000, Bertrand Drouvot wrote:
> Agree. The idea was to add an additional parameter (say "check_only") to the
> flush_fixed_cb. If this parameter is set to true then the flush_fixed_cb would
> do nothing (no flush at all) but return a boolean that would indicate if there
> is pending stats. In case it returns false, then we could avoid the clock check.

Hmm. It's the same thing in terms of logic, but I am not really
convinced that it is a good idea to mix a code path for a sanity check
with a code path dealing with the action, particularly considering
that there is the nowait option to think about in the flush callback
which would require one to think about 4 possible states rather than
two possibilities. So that's more error-prone for extension
developers, IMO.

At the end, I have used my original suggestions for the callbacks. If
there are voices in favor of something different, we still have a good
chunk of the development and beta cycle for that.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2024-09-09 02:47:19 Re: PostgreSQL 17 release announcement draft
Previous Message David G. Johnston 2024-09-09 02:20:27 Re: DOCS - pg_replication_slot . Fix the 'inactive_since' description