summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/storage/buffer/bufmgr.c3
-rw-r--r--src/backend/storage/lmgr/proc.c10
2 files changed, 6 insertions, 7 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 5420dbe61a1..4c7cfb0b404 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -2449,10 +2449,11 @@ LockBufferForCleanup(Buffer buffer)
/* Wait to be signaled by UnpinBuffer() */
if (InHotStandby)
{
- /* Share the bufid that Startup process waits on */
+ /* Publish the bufid that Startup process waits on */
SetStartupBufferPinWaitBufId(buffer - 1);
/* Set alarm and then wait to be signaled by UnpinBuffer() */
ResolveRecoveryConflictWithBufferPin();
+ /* Reset the published bufid */
SetStartupBufferPinWaitBufId(-1);
}
else
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 44399d822c6..78d1fd29343 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -180,6 +180,9 @@ InitProcGlobal(void)
*/
ProcGlobal->freeProcs = NULL;
ProcGlobal->autovacFreeProcs = NULL;
+ ProcGlobal->startupProc = NULL;
+ ProcGlobal->startupProcPid = 0;
+ ProcGlobal->startupBufferPinWaitBufId = -1;
ProcGlobal->spins_per_delay = DEFAULT_SPINS_PER_DELAY;
@@ -499,7 +502,6 @@ PublishStartupProcessInformation(void)
procglobal->startupProc = MyProc;
procglobal->startupProcPid = MyProcPid;
- procglobal->startupBufferPinWaitBufId = 0;
SpinLockRelease(ProcStructLock);
}
@@ -526,14 +528,10 @@ SetStartupBufferPinWaitBufId(int bufid)
int
GetStartupBufferPinWaitBufId(void)
{
- int bufid;
-
/* use volatile pointer to prevent code rearrangement */
volatile PROC_HDR *procglobal = ProcGlobal;
- bufid = procglobal->startupBufferPinWaitBufId;
-
- return bufid;
+ return procglobal->startupBufferPinWaitBufId;
}
/*