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
This commit is contained in:
parent
418611c84d
commit
f7400823c3
|
@ -7998,17 +7998,16 @@ StartupXLOG(void)
|
||||||
* All done with end-of-recovery actions.
|
* All done with end-of-recovery actions.
|
||||||
*
|
*
|
||||||
* Now allow backends to write WAL and update the control file status in
|
* Now allow backends to write WAL and update the control file status in
|
||||||
* consequence. The boolean flag allowing backends to write WAL is
|
* consequence. SharedRecoveryState, that controls if backends can write
|
||||||
* updated while holding ControlFileLock to prevent other backends to look
|
* WAL, is updated while holding ControlFileLock to prevent other backends
|
||||||
* at an inconsistent state of the control file in shared memory. There
|
* to look at an inconsistent state of the control file in shared memory.
|
||||||
* is still a small window during which backends can write WAL and the
|
* There is still a small window during which backends can write WAL and
|
||||||
* control file is still referring to a system not in DB_IN_PRODUCTION
|
* the control file is still referring to a system not in DB_IN_PRODUCTION
|
||||||
* state while looking at the on-disk control file.
|
* state while looking at the on-disk control file.
|
||||||
*
|
*
|
||||||
* Also, although the boolean flag to allow WAL is probably atomic in
|
* Also, we use info_lck to update SharedRecoveryState to ensure that
|
||||||
* itself, we use the info_lck here to ensure that there are no race
|
* there are no race conditions concerning visibility of other recent
|
||||||
* conditions concerning visibility of other recent updates to shared
|
* updates to shared memory.
|
||||||
* memory.
|
|
||||||
*/
|
*/
|
||||||
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
|
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
|
||||||
ControlFile->state = DB_IN_PRODUCTION;
|
ControlFile->state = DB_IN_PRODUCTION;
|
||||||
|
|
Loading…
Reference in New Issue