Обсуждение: pgsql: Fix some sloppiness in the new BufFileSize() andBufFileAppend()

Поиск
Список
Период
Сортировка

pgsql: Fix some sloppiness in the new BufFileSize() andBufFileAppend()

От
Heikki Linnakangas
Дата:
Fix some sloppiness in the new BufFileSize() and BufFileAppend() functions.

There were three related issues:

* BufFileAppend() incorrectly reset the seek position on the 'source' file.
  As a result, if you had called BufFileRead() on the file before calling
  BufFileAppend(), it got confused, and subsequent calls would read/write
  at wrong position.

* BufFileSize() did not work with files opened with BufFileOpenShared().

* FileGetSize() only worked on temporary files.

To fix, change the way BufFileSize() works so that it works on shared
files. Remove FileGetSize() altogether, as it's no longer needed. Remove
buffilesize from TapeShare struct, as the leader process can simply call
BufFileSize() to get the tape's size, there's no need to pass it through
shared memory anymore.

Discussion: https://www.postgresql.org/message-id/CAH2-WznEDYe_NZXxmnOfsoV54oFkTdMy7YLE2NPBLuttO96vTQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/445e31bdc749e56376993232e5c2cc4931161322

Modified Files
--------------
src/backend/storage/file/buffile.c | 18 ++++++++++++++----
src/backend/storage/file/fd.c      | 10 ----------
src/backend/utils/sort/logtape.c   | 11 ++++++++---
src/backend/utils/sort/tuplesort.c |  1 -
src/include/storage/fd.h           |  1 -
src/include/utils/logtape.h        |  7 ++-----
6 files changed, 24 insertions(+), 24 deletions(-)