Re: faulty error handling around pgstat_count_io_op_time()

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: faulty error handling around pgstat_count_io_op_time()
Date: 2026-06-17 05:12:34
Message-ID: ajIswokltYDV9M1X@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Jun 17, 2026 at 09:26:22AM +0900, Michael Paquier wrote:
>
> In XLogFileInitInternal(), the first pgstat_count_io_op_time() is not
> completely right, no? pg_pwrite_zeros() or pg_pwrite() could fail,
> and it does not make sense to me to count data if we have a
> save_errno, and the files are unlinked in the error path. I'd propose
> to delay the count() call to happen after the error check is done.

I think you are right. This one was not handled because it's not a type
conversion bug but we should not count I/O on a failed operation.

> This leads me to the v2 attached. This is your v1 plus the extra
> change for XLogFileInitInternal() when the segments are initialized.

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 jian he 2026-06-17 05:14:09 Re: Row pattern recognition
Previous Message Paul A Jungwirth 2026-06-17 05:10:48 FOR PORTION OF should not allow WHERE CURRENT OF