Re: Show WAL write and fsync stats in pg_stat_io

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "bharath(dot)rupireddyforpostgres(at)gmail(dot)com" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Subject: Re: Show WAL write and fsync stats in pg_stat_io
Date: 2025-01-22 00:14:22
Message-ID: Z5A4Xu_UoYcMwFkU@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 16, 2025 at 11:40:51AM +0300, Nazir Bilal Yavuz wrote:
> I encountered another problem while rebasing the patch. The problem is
> basically we do not expect any pending stats while restoring the stats
> at the initdb. However, WAL IOs (WAL read and WAL init IOs for now)
> may happen before restoring the stats, so we end up having pending
> stats before restoring them and that causes initdb to fail.

On top of 4feba03d8b92, I've reused something close to the patch you
have posted previously in case, and the issue with allocations for
pending stats should be gone.

Could it be possible to post a new version of the patch? You should
be able to reuse pgstat_count_backend_io_op[_time]() for your work
with WAL data in pg_stat_io if you need a low-level control of things,
but I suspect that calling pgstat_count_io_op() & the other should be
enough to get the job done with a new IOObject.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-01-22 00:33:00 Re: improve DEBUG1 logging of parallel workers for CREATE INDEX?
Previous Message Jim Jones 2025-01-21 23:35:56 Re: XMLDocument (SQL/XML X030)