Re: Attempt to consolidate reading of XLOG page
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Antonin Houska <ah@cybertec.at>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2019-05-06T18:21:34Z
Lists: pgsql-hackers
On 2019-May-06, Robert Haas wrote: > On Thu, May 2, 2019 at 12:18 PM Antonin Houska <ah@cybertec.at> wrote: > > The next version of the patch is attached. > > I don't think any of this looks acceptable: I agree. I inteded to suggest upthread to pass an additional argument to XLogRead, which is a function that takes a message string and SQLSTATE; in backend, the function does errstart / errstate / errmsg / errfinish, and in frontend programs it does pg_log_fatal (and ignores sqlstate). The message must be sprintf'ed and translated by XLogRead. (xlogreader.c could itself provide a default error reporting callback, at least for frontend, to avoid repeating the code). That way, if a different frontend program wants to do something different, it's fairly easy to pass a different function pointer. BTW, having frontend's XLogFileNameCommon use a totally unrelated variable for its printing is naughty. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Remove logical_read_local_xlog_page
- 5d0c2d5eba6b 13.0 landed
-
Refactor WAL file-reading code into WALRead()
- 0dc8ead46363 13.0 landed
-
Rework WAL-reading supporting structs
- 709d003fbd98 13.0 landed
-
Make XLogReaderInvalReadState static
- 25dcc9d35dfe 13.0 landed
-
Use pg_pread() and pg_pwrite() for data files and WAL.
- c24dcd0cfd94 12.0 cited