Refactor code in charge of running shell-based recovery commands
Michael Paquier <michael@paquier.xyz>
Refactor code in charge of running shell-based recovery commands The code specific to the execution of archive_cleanup_command, recovery_end_command and restore_command is moved to a new file named shell_restore.c. The code is split into three functions: - shell_restore(), that attempts the execution of a shell-based restore_command. - shell_archive_cleanup(), for archive_cleanup_command. - shell_recovery_end(), for recovery_end_command. This introduces no functional changes, with failure patterns and logs generated in consequence being the same as before (one case actually generates one less DEBUG2 message "could not restore" when a restore command succeeds but the follow-up stat() to check the size fails, but that only matters with a elevel high enough). This is preparatory work for allowing recovery modules, a facility similar to archive modules, with callbacks shaped similarly to the functions introduced here. Author: Nathan Bossart Reviewed-by: Andres Freund, Michael Paquier Discussion: https://postgr.es/m/20221227192449.GA3672473@nathanxps13
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/Makefile | modified | +1 −0 |
| src/backend/access/transam/meson.build | modified | +1 −0 |
| src/backend/access/transam/shell_restore.c | added | +175 −0 |
| src/backend/access/transam/xlogarchive.c | modified | +3 −117 |
| src/backend/access/transam/xlog.c | modified | +29 −8 |
| src/include/access/xlogarchive.h | modified | +5 −2 |
Discussion
- recovery modules 90 messages · 2022-12-27 → 2024-07-19