Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6c8671b

Browse files
author
Amit Kapila
committed
Fix assertion failure when updating full_page_writes for checkpointer.
When the checkpointer receives a SIGHUP signal to update its configuration, it may need to update the shared memory for full_page_writes and need to write a WAL record for it. Now, it is quite possible that the XLOG machinery has not been initialized by that time and it will lead to assertion failure while doing that. Fix is to allow the initialization of the XLOG machinery outside critical section. This bug has been introduced by the commit 2c03216 which added the XLOG machinery initialization in RecoveryInProgress code path. Reported-by: Dilip Kumar Author: Dilip Kumar Reviewed-by: Michael Paquier and Amit Kapila Backpatch-through: 9.5 Discussion: https://postgr.es/m/CAFiTN-u4BA8KXcQUWDPNgaKAjDXC=C2whnzBM8TAcv=stckYUw@mail.gmail.com
1 parent 88926fd commit 6c8671b

File tree

1 file changed

+9
-1
lines changed
  • src/backend/access/transam

1 file changed

+9
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9634,6 +9634,7 @@ void
96349634
UpdateFullPageWrites(void)
96359635
{
96369636
XLogCtlInsert *Insert = &XLogCtl->Insert;
9637+
bool recoveryInProgress;
96379638

96389639
/*
96399640
* Do nothing if full_page_writes has not been changed.
@@ -9645,6 +9646,13 @@ UpdateFullPageWrites(void)
96459646
if (fullPageWrites == Insert->fullPageWrites)
96469647
return;
96479648

9649+
/*
9650+
* Perform this outside critical section so that the WAL insert
9651+
* initialization done by RecoveryInProgress() doesn't trigger an
9652+
* assertion failure.
9653+
*/
9654+
recoveryInProgress = RecoveryInProgress();
9655+
96489656
START_CRIT_SECTION();
96499657

96509658
/*
@@ -9665,7 +9673,7 @@ UpdateFullPageWrites(void)
96659673
* Write an XLOG_FPW_CHANGE record. This allows us to keep track of
96669674
* full_page_writes during archive recovery, if required.
96679675
*/
9668-
if (XLogStandbyInfoActive() && !RecoveryInProgress())
9676+
if (XLogStandbyInfoActive() && !recoveryInProgress)
96699677
{
96709678
XLogBeginInsert();
96719679
XLogRegisterData((char *) (&fullPageWrites), sizeof(bool));

0 commit comments

Comments
 (0)