Re: faulty error handling around pgstat_count_io_op_time() - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: faulty error handling around pgstat_count_io_op_time()
Date
Msg-id ajIswokltYDV9M1X@bdtpg
Whole thread
List 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



pgsql-hackers by date:

Previous
From: Paul A Jungwirth
Date:
Subject: FOR PORTION OF should not allow WHERE CURRENT OF
Next
From: jian he
Date:
Subject: Re: Row pattern recognition