Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite51c469

Browse files
committed
Move InitXLogInsert() call from InitXLOGAccess() to BaseInit().
At present, there is an undocumented coding rule that you must callRecoveryInProgress(), or do something else that results in a callto InitXLogInsert(), before trying to write WAL. Otherwise, theWAL construction buffers won't be initialized, resulting infailures.Since it's not good to rely on a status inquiry function likeRecoveryInProgress() having the side effect of initializingcritical 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
1 parent354a1f8 commite51c469

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8677,9 +8677,6 @@ InitXLOGAccess(void)
86778677
(void)GetRedoRecPtr();
86788678
/* Also update our copy of doPageWrites. */
86798679
doPageWrites= (Insert->fullPageWrites||Insert->forcePageWrites);
8680-
8681-
/* Also initialize the working areas for constructing WAL records */
8682-
InitXLogInsert();
86838680
}
86848681

86858682
/*
@@ -9129,16 +9126,6 @@ CreateCheckPoint(int flags)
91299126
if (RecoveryInProgress()&& (flags&CHECKPOINT_END_OF_RECOVERY)==0)
91309127
elog(ERROR,"can't create a checkpoint during recovery");
91319128

9132-
/*
9133-
* Initialize InitXLogInsert working areas before entering the critical
9134-
* section. Normally, this is done by the first call to
9135-
* RecoveryInProgress() or LocalSetXLogInsertAllowed(), but when creating
9136-
* an end-of-recovery checkpoint, the LocalSetXLogInsertAllowed call is
9137-
* done below in a critical section, and InitXLogInsert cannot be called
9138-
* in a critical section.
9139-
*/
9140-
InitXLogInsert();
9141-
91429129
/*
91439130
* Prepare to accumulate statistics.
91449131
*

‎src/backend/utils/init/postinit.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,12 @@ BaseInit(void)
541541
* file shutdown hook can report temporary file statistics.
542542
*/
543543
InitTemporaryFileAccess();
544+
545+
/*
546+
* Initialize local buffers for WAL record construction, in case we
547+
* ever try to insert XLOG.
548+
*/
549+
InitXLogInsert();
544550
}
545551

546552

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp