1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-02 11:44:50 +03:00

Use SetInstallXLogFileSegmentActive() in more places in xlog.c

This reduces the code paths where XLogCtl->InstallXLogFileSegmentActive
is directly touched, and this wrapper function does the same thing as
the original code replaced by the function call.

Author: Bharath Rupireddy
Reviewed-by: Nathan Bossart
Discussion: https://postgr.es/m/CALj2ACVhkf-bC5CX-=6iBUfkO5GqmBntQH+m=HpY0iQ=-g1pRg@mail.gmail.com
This commit is contained in:
Michael Paquier 2022-08-17 15:28:45 +09:00
parent 93f2349c36
commit d265cd2029

View File

@ -4501,9 +4501,7 @@ BootStrapXLOG(void)
pg_crc32c crc; pg_crc32c crc;
/* allow ordinary WAL segment creation, like StartupXLOG() would */ /* allow ordinary WAL segment creation, like StartupXLOG() would */
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); SetInstallXLogFileSegmentActive();
XLogCtl->InstallXLogFileSegmentActive = true;
LWLockRelease(ControlFileLock);
/* /*
* Select a hopefully-unique system identifier code for this installation. * Select a hopefully-unique system identifier code for this installation.
@ -5368,9 +5366,7 @@ StartupXLOG(void)
* Allow ordinary WAL segment creation before possibly switching to a new * Allow ordinary WAL segment creation before possibly switching to a new
* timeline, which creates a new segment, and after the last ReadRecord(). * timeline, which creates a new segment, and after the last ReadRecord().
*/ */
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); SetInstallXLogFileSegmentActive();
XLogCtl->InstallXLogFileSegmentActive = true;
LWLockRelease(ControlFileLock);
/* /*
* Consider whether we need to assign a new timeline ID. * Consider whether we need to assign a new timeline ID.