Re: Flush pgstats file during checkpoints

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Flush pgstats file during checkpoints
Date: 2024-08-28 03:43:43
Message-ID: Zs6c74aork939m2d@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Aug 26, 2024 at 01:56:40PM +0900, Michael Paquier wrote:
> On Fri, Aug 02, 2024 at 02:11:34AM +0900, Michael Paquier wrote:
> > Applied 0003 for now to add the redo LSN to the pgstats file, adding
> > the redo LSN to the two DEBUG2 entries when reading and writing while
> > on it, that I forgot. (It was not 01:57 where I am now.)
> >
> > Attached is the last one.
>
> The CF bot has been complaining in injection_points as an effect of
> the stats remaining after a crash, so rebased to adapt to that.

Thanks!

Checking the V7 diffs as compared to V4:

1. In pgstat_write_statsfile():

- elog(DEBUG2, "writing stats file \"%s\"", statfile);
+ elog(DEBUG2, "writing stats file \"%s\" with redo %X/%X", statfile,
+ LSN_FORMAT_ARGS(redo));

2. and the ones in injection_points/t/001_stats.pl:

+# On crash the stats are still there.
$node->stop('immediate');
$node->start;
$numcalls = $node->safe_psql('postgres',
"SELECT injection_points_stats_numcalls('stats-notice');");
-is($numcalls, '', 'number of stats after crash');
+is($numcalls, '3', 'number of stats after crash');
$fixedstats = $node->safe_psql('postgres',
"SELECT * FROM injection_points_stats_fixed();");
-is($fixedstats, '0|0|0|0|0', 'fixed stats after crash');
+is($fixedstats, '1|0|2|1|1', 'fixed stats after crash');

They both LGTM.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2024-08-28 03:52:46 Re: Significant Execution Time Difference Between PG13.14 and PG16.4 for Query on information_schema Tables.
Previous Message Thomas Munro 2024-08-28 03:31:13 Re: consider -Wmissing-variable-declarations