|From:||Heikki Linnakangas <hlinnaka(at)iki(dot)fi>|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
xlog.c is very large. We've split off some functions from it over the
years, but it's still large and it keeps growing.
Attached is a proposal to split functions related to WAL replay, standby
mode, fetching files from archive, computing the recovery target and so
on, to new source file called xlogrecovery.c. That's a fairly clean
split. StartupXLOG() stays in xlog.c, but much of the code from it has
been moved to new functions InitWalRecovery(), PerformWalRecovery() and
EndWalRecovery(). The general idea is that xlog.c is still responsible
for orchestrating the servers startup, but xlogrecovery.c is responsible
for figuring out whether WAL recovery is needed, performing it, and
deciding when it can stop.
There's surely more refactoring we could do. xlog.c has a lot of global
variables, with similar names but slightly different meanings for
example. (Quick: what's the difference between InRedo, InRecovery,
InArchiveRecovery, and RecoveryInProgress()? I have to go check the code
every time to remind myself). But this patch tries to just move source
code around for clarity.
There are small changes in the order that some of things are done in
StartupXLOG(), for readability. I tried to be careful and check that the
changes are safe, but a second pair of eyes would be appreciated on that.
|Next Message||Daniel Gustafsson||2021-06-16 13:31:42||Re: Support for NSS as a libpq TLS backend|
|Previous Message||Stephen Frost||2021-06-16 13:19:51||Re: Duplicate history file?|