knownrecoverystate.patch
text/x-patch
Filename: knownrecoverystate.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 6 | 0 |
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 158,163 **** static XLogRecPtr LastRec;
--- 158,164 ----
* known, need to check the shared state".
*/
static bool LocalRecoveryInProgress = true;
+ static bool KnownRecoveryState = false;
/*
* Local state for XLogInsertAllowed():
***************
*** 6524,6537 **** CheckRecoveryConsistency(void)
bool
RecoveryInProgress(void)
{
! /*
! * We check shared state each time only until we leave recovery mode. We
! * can't re-enter recovery, so there's no need to keep checking after the
! * shared variable has once been seen false.
! */
! if (!LocalRecoveryInProgress)
! return false;
! else
{
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
--- 6525,6533 ----
bool
RecoveryInProgress(void)
{
! if (KnownRecoveryState)
! return LocalRecoveryInProgress;
! else
{
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
***************
*** 6541,6546 **** RecoveryInProgress(void)
--- 6537,6544 ----
LocalRecoveryInProgress = xlogctl->SharedRecoveryInProgress;
SpinLockRelease(&xlogctl->info_lck);
+ KnownRecoveryState = true;
+
/*
* Initialize TimeLineID and RedoRecPtr when we discover that recovery
* is finished. InitPostgres() relies upon this behaviour to ensure