pgsql: Switch buffile.c/h to use pgoff_t instead of off_t

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Switch buffile.c/h to use pgoff_t instead of off_t
Дата
Msg-id E1vXofc-0029z3-1W@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Switch buffile.c/h to use pgoff_t instead of off_t

off_t was previously used for offsets, which is 4 bytes on Windows,
hence limiting the backend code to a hard limit for files longer than
2GB.  This leads to some simplification in these files, removing some
casts based on long, also 4 bytes on Windows.

This commit removes one comment introduced in db3c4c3a2d98, not relevant
anymore as pgoff_t is a safe 8-byte alternative on Windows.

This change is surprisingly not invasive, as the callers of
BufFileTell(), BufFileSeek() and BufFileTruncateFileSet() (worker.c,
tuplestore.c, etc.) track offsets in local structures that just to
switch from off_t to pgoff_t for the most part.

The file is still relying on a maximum file size of
MAX_PHYSICAL_FILESIZE (1GB).  This change allows the code to make this
maximum potentially larger in the future, or larger on a per-demand
basis.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e5f3839af685c303d8ebcc1ea0d407c124372931

Modified Files
--------------
src/backend/replication/logical/worker.c |  8 ++++----
src/backend/storage/file/buffile.c       | 23 +++++++++++------------
src/backend/utils/sort/tuplestore.c      | 12 ++++++------
src/include/storage/buffile.h            |  6 +++---
4 files changed, 24 insertions(+), 25 deletions(-)


В списке pgsql-committers по дате отправления: