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
signature.asc
Description: PGP signature