1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Move InitXLogInsert() call from InitXLOGAccess() to BaseInit().

At present, there is an undocumented coding rule that you must call
RecoveryInProgress(), or do something else that results in a call
to InitXLogInsert(), before trying to write WAL. Otherwise, the
WAL construction buffers won't be initialized, resulting in
failures.

Since it's not good to rely on a status inquiry function like
RecoveryInProgress() having the side effect of initializing
critical data structures, instead do the initialization eariler,
when the backend first starts up.

Patch by me. Reviewed by Nathan Bossart and Michael Paquier.

Discussion: http://postgr.es/m/CA+TgmoY7b65qRjzHN_tWUk8B4sJqk1vj1d31uepVzmgPnZKeLg@mail.gmail.com
This commit is contained in:
Robert Haas
2021-11-16 09:43:17 -05:00
parent 354a1f8d22
commit e51c46991f
2 changed files with 6 additions and 13 deletions

View File

@ -541,6 +541,12 @@ BaseInit(void)
* file shutdown hook can report temporary file statistics.
*/
InitTemporaryFileAccess();
/*
* Initialize local buffers for WAL record construction, in case we
* ever try to insert XLOG.
*/
InitXLogInsert();
}