a problem about XLogReader callback system
Hi, hackers
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.
Is it necessary to set a segment_close callback?
Best regards
Wang
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