diff options
author | Robert Haas <rhaas@postgresql.org> | 2021-11-16 09:43:17 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2021-11-16 09:43:17 -0500 |
commit | e51c46991f0ee99cca222305619dee5543a1290a (patch) | |
tree | 1a3a0cff28fc4578bf70972897529526a15d478a /src/backend/utils/init/postinit.c | |
parent | 354a1f8d220fbbb07b0ded32c5ade72646afb801 (diff) |
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
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r-- | src/backend/utils/init/postinit.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 78bc64671ec..0c56c38a141 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -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(); } |