pgsql: Fix handling of copy_file_range() return value

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix handling of copy_file_range() return value
Date: 2026-06-29 11:09:34
Message-ID: E1we9rq-000dxb-0u@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling of copy_file_range() return value

Treat copy_file_range() return value of zero as an error: it indicates
that no bytes could be copied (perhaps the source file is shorter than
expected), and the existing retry loop would otherwise spin forever
since nwritten would never reach BLCKSZ.

The other uses of copy_file_range() in the tree don't have this
problem.

Reviewed-by: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Reviewed-by: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Reviewed-by: Yingying Chen <cyy9255(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/3208cf7a-c7f3-41eb-92f6-33cbeff4df40%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/994f770a0fd55dfdeb96d1d60d35545ba2d51480

Modified Files
--------------
src/bin/pg_combinebackup/reconstruct.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-06-29 13:26:52 pgsql: Forbid FOR PORTION OF with WHERE CURRENT OF
Previous Message Richard Guo 2026-06-29 05:22:13 pgsql: Use plpythonu in plpython tests added by commit 0b7719f74