aboutsummaryrefslogtreecommitdiff
path: root/src/include/common/file_utils.h
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-11-08 12:23:46 +0900
committerMichael Paquier <michael@paquier.xyz>2022-11-08 12:23:46 +0900
commit3bdbdf5d06f2179d4c17926d77ff734ea9e7d525 (patch)
tree2e541ce34d6b56af7d9db393424f36ea2cffa48d /src/include/common/file_utils.h
parentd7744d50a5394db8d973d1cfa034ed6640aec13c (diff)
downloadpostgresql-3bdbdf5d06f2179d4c17926d77ff734ea9e7d525.tar.gz
postgresql-3bdbdf5d06f2179d4c17926d77ff734ea9e7d525.zip
Introduce pg_pwrite_zeros() in fileutils.c
This routine is designed to write zeros to a file using vectored I/O, for a size given by its caller, being useful when it comes to initializing a file with a final size already known. XLogFileInitInternal() in xlog.c is changed to use this new routine when initializing WAL segments with zeros (wal_init_zero enabled). Note that the aligned buffers used for the vectored I/O writes have a size of XLOG_BLCKSZ, and not BLCKSZ anymore, as pg_pwrite_zeros() relies on PGAlignedBlock while xlog.c originally used PGAlignedXLogBlock. This routine will be used in a follow-up patch to do the pre-padding of WAL segments for pg_receivewal and pg_basebackup when these are not compressed. Author: Bharath Rupireddy Reviewed-by: Nathan Bossart, Andres Freund, Thomas Munro, Michael Paquier Discussion: https://www.postgresql.org/message-id/CALj2ACUq7nAb7%3DbJNbK3yYmp-SZhJcXFR_pLk8un6XgDzDF3OA%40mail.gmail.com
Diffstat (limited to 'src/include/common/file_utils.h')
-rw-r--r--src/include/common/file_utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h
index 2c5dbcb0b1e..d2c64c2196c 100644
--- a/src/include/common/file_utils.h
+++ b/src/include/common/file_utils.h
@@ -44,4 +44,6 @@ extern ssize_t pg_pwritev_with_retry(int fd,
int iovcnt,
off_t offset);
+extern ssize_t pg_pwrite_zeros(int fd, size_t size);
+
#endif /* FILE_UTILS_H */