Re: a problem about XLogReader callback system

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: a problem about XLogReader callback system
Дата
Msg-id 20200928135610.GA1123@alvherre.pgsql
обсуждение исходный текст
Ответ на a problem about XLogReader callback system  ("Wang, Shenhao" <wangsh.fnst@cn.fujitsu.com>)
Список pgsql-hackers
Hello,

On 2020-Sep-28, Wang, Shenhao wrote:

> I have a problem about XLogReader callback system
> 
> In xlog.c, function StartupXLOG
> 
>     xlogreader =
>         XLogReaderAllocate(wal_segment_size, NULL,
>                            XL_ROUTINE(.page_read = &XLogPageRead,
>                                       .segment_open = NULL,
>                                       .segment_close = wal_segment_close),
>                            &private);
> 
> XLogPageReader uses readFile to store the fd, and I can't find any
> location to set the value of seg.ws_file.

Hmm, AFAICS (admittedly a quick look) you're right: because XLogPageRead
does not touch ws_file, wal_segment_close would always find that it's
unset (-1) so XLogReaderFree would have nothing to do.

The whole XLogReader abstraction remains pretty leaky, I'm afraid :-(
Ideally we would plug those holes.  Perhaps getting rid of readFile
completely would be a solution, but I haven't analyzed it.

> Is it necessary to set a segment_close callback?

For this case it seems useless but not actually harmful.  Have you come
across some scenario in which it causes a problem?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Vladimir Sitnikov
Дата:
Сообщение: Re: BLOB / CLOB support in PostgreSQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: The return value of SPI_connect