improving basebackup.c's file-reading code

Поиск
Список
Период
Сортировка
От Robert Haas
Тема improving basebackup.c's file-reading code
Дата
Msg-id CA+TgmobBw-3573vMosGj06r72ajHsYeKtksT_oTxH8XvTL7DxA@mail.gmail.com
обсуждение исходный текст
Ответы Re: improving basebackup.c's file-reading code
Список pgsql-hackers
Hi,

basebackup.c's code to read from files uses fread() and friends. This
is not great, because it's not documented to set errno. See commit
286af0ce12117bc673b97df6228d1a666594d247 and related discussion. It
seems like a better idea would be to use pg_pgread(), which not only
does set errno, but also lets us eliminate a bit of code that uses
fseek().

There are a couple of other things here that can also be improved. One
is that it seems like a good idea to set a wait event while doing I/O
here, as we do elsewhere. Another is that it seems like a good idea to
report short reads in a non-confusing, non-wrong sort of way. I here
adopted the convention previously mentioned in
http://postgr.es/m/20200128020303.GA1552@paquier.xyz

Patch, for v14, attached.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: weird hash plan cost, starting with pg10
Следующее
От: "Jonah H. Harris"
Дата:
Сообщение: Proposing WITH ITERATIVE