Skip to content

Commit f740082

Browse files
committed
Clarify some comments around SharedRecoveryState in xlog.c
SharedRecoveryState has been switched from a boolean to an enum as of commit 4e87c48, but some comments still referred to it as a boolean. Author: Amul Sul Reviewed-by: Dilip Kumar, Kyotaro Horiguchi Discussion: https://postgr.es/m/CAAJ_b97Hf+1SXnm8jySpO+Fhm+-VKFAAce1T_cupUYtnE3Nxig
1 parent 418611c commit f740082

File tree

1 file changed

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

1 file changed

+8
-9
lines changed

src/backend/access/transam/xlog.c

+8-9
Original file line numberDiff line numberDiff line change
@@ -7998,17 +7998,16 @@ StartupXLOG(void)
79987998
* All done with end-of-recovery actions.
79997999
*
80008000
* Now allow backends to write WAL and update the control file status in
8001-
* consequence. The boolean flag allowing backends to write WAL is
8002-
* updated while holding ControlFileLock to prevent other backends to look
8003-
* at an inconsistent state of the control file in shared memory. There
8004-
* is still a small window during which backends can write WAL and the
8005-
* control file is still referring to a system not in DB_IN_PRODUCTION
8001+
* consequence. SharedRecoveryState, that controls if backends can write
8002+
* WAL, is updated while holding ControlFileLock to prevent other backends
8003+
* to look at an inconsistent state of the control file in shared memory.
8004+
* There is still a small window during which backends can write WAL and
8005+
* the control file is still referring to a system not in DB_IN_PRODUCTION
80068006
* state while looking at the on-disk control file.
80078007
*
8008-
* Also, although the boolean flag to allow WAL is probably atomic in
8009-
* itself, we use the info_lck here to ensure that there are no race
8010-
* conditions concerning visibility of other recent updates to shared
8011-
* memory.
8008+
* Also, we use info_lck to update SharedRecoveryState to ensure that
8009+
* there are no race conditions concerning visibility of other recent
8010+
* updates to shared memory.
80128011
*/
80138012
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
80148013
ControlFile->state = DB_IN_PRODUCTION;

0 commit comments

Comments
 (0)