From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Getting rid of some more lseek() calls |
Date: | 2020-02-13 07:14:00 |
Message-ID: | 20200213071400.GH1520@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Feb 13, 2020 at 02:51:44PM +1300, Thomas Munro wrote:
> Ok, how about this?
Alvaro's point sounds sensible to me. I like the approach you are
taking in 0001. At least it avoids more issues with WIN32 and stat()
(I hope to work on that at some point, we'll see..).
+/*
+ * pg_file_size --- return the size of a file
+ */
+int64
+pg_file_size(int fd)
+{
This routine has nothing really dependent on the backend. Would it
make sense to put it in a different place where it can be used by the
frontend? The function should include at least a comment about why we
have a special path for Windows, aka not falling into the trap of the
4GB limit for stat().
The commit message of 0001 mentions pg_read(), and that should be
pg_pread().
There are two combinations of lseek/read that could be replaced: one
in pg_receivewal.c:FindStreamingStart(), and one in
SimpleXLogPageRead() for parsexlog.c as of pg_rewind.
Patch 0002 looks good to me. This actually removes a confusion when
failing to seek the end of the file as the offset referenced to would
be 0. Patch 0003 is also a very good thing.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-02-13 07:30:35 | Re: Wait event that should be reported while waiting for WAL archiving to finish |
Previous Message | Fujii Masao | 2020-02-13 06:35:50 | Re: Wait event that should be reported while waiting for WAL archiving to finish |