stat() on Windows might cause error if target file is larger than 4GB

From: "Higuchi, Daisuke" <higuchi(dot)daisuke(at)jp(dot)fujitsu(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: stat() on Windows might cause error if target file is larger than 4GB
Date: 2018-09-10 02:01:53
Message-ID: 1803D792815FC24D871C00D17AE95905CF5099@g01jpexmbkw24
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

This mail is about following bug report post:
https://www.postgresql.org/message-id/flat/153442391458.1505.9181095584291689853%40wrigleys.postgresql.org

When pg_dump has '--format=directory' option and the dump file size become
4GB over, the strange error message 'Unknown error' will be output.

This is because _stat64i32() is used for stat() on Windows, I think.
Seeing following URL, _stat64i32() could use 32 bit, it means 4GB is max size.
https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx

When I create the simple application to use stat() on VS2013,
stat() could not deal with 4GB file and failed with errno=132.
I think the pg_dump occurs EOVERFLOW, but Windows' errno.h does not have
this errno, so 'Unknown error' is output.

So, pgwin32_safestat() should be changed to solve this problem.
Do you have any idea or comments?

Regards,
Daisuke Higuchi

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-09-10 03:27:12 SerializeParamList vs machines with strict alignment
Previous Message Hironobu SUZUKI 2018-09-09 22:35:30 Re: pgbench - add pseudo-random permutation function