Fixup for prefetching support on macOS
authorPeter Eisentraut <[email protected]>
Thu, 29 Aug 2024 06:22:28 +0000 (08:22 +0200)
committerPeter Eisentraut <[email protected]>
Thu, 29 Aug 2024 06:22:28 +0000 (08:22 +0200)
The new code path (commit 6654bb92047) should call FileAccess() first,
like the posix_fadvise() path.

Reported-by: Thomas Munro <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/0827edec-1317-4917-a186-035eb1e3241d%40eisentraut.org

src/backend/storage/file/fd.c

index c84f089665c92229b06e03459d9c76622bcd063a..368cc9455cf7612fefe5ef03bde416f984776ec0 100644 (file)
@@ -2110,6 +2110,10 @@ retry:
        }           ra;
        int         returnCode;
 
+       returnCode = FileAccess(file);
+       if (returnCode < 0)
+           return returnCode;
+
        ra.ra_offset = offset;
        ra.ra_count = amount;
        pgstat_report_wait_start(wait_event_info);