On 2020-Mar-26, Michael Paquier wrote: > I was looking at this patch again today and I am rather fine with the > existing semantics. Still I don't like much to name the frontend-side > routine FrontendRestoreArchivedFile() and use a different name than > the backend counterpart because we have to include xlog_internal.h in > fe_archive.c to be able to grab XLOGDIR.
Uh, is XLOGDIR the only reason to include xlog_internal.h? Maybe it would be easier to have a routine in xlog.c that returns the path? There's a few functions in xlog.c that could use it, as well. Altough ... looking at xlog.h, that one is even worse, so I'm not sure *where* you'd put the prototype for the new function I'm proposing. > So here is an idea: let's move the declaration of the routines part of > xlogarchive.c to a new header, called xlogarchive.h, and then let's > use the same routine name for the frontend and the backend in this > second patch. We include xlog_internal.h already in many frontend > tools, so that would clean up things a bit. The patch downthread looks decent cleanup, but I'm not sure how it helps further the objective. (A really good cleanup could be a situation where frontend files don't need xlog_internal.h -- for example, maybe a new file xlogpage.h could contain struct defs that relate to page and segment headers and the like, as well as useful macros. I don't know if this can be made to work -- but xlog_internal.h contains stuff like xl_parameter_change etc as well as RmgrData which surely are of no interest to readers of wal files ... or, say, RequestXLogSwitch.) I don't think any such cleanup should hamper the patch at hand anyway. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services