File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -2449,10 +2449,11 @@ LockBufferForCleanup(Buffer buffer)
24492449 /* Wait to be signaled by UnpinBuffer() */
24502450 if (InHotStandby )
24512451 {
2452- /* Share the bufid that Startup process waits on */
2452+ /* Publish the bufid that Startup process waits on */
24532453 SetStartupBufferPinWaitBufId (buffer - 1 );
24542454 /* Set alarm and then wait to be signaled by UnpinBuffer() */
24552455 ResolveRecoveryConflictWithBufferPin ();
2456+ /* Reset the published bufid */
24562457 SetStartupBufferPinWaitBufId (-1 );
24572458 }
24582459 else
Original file line number Diff line number Diff line change @@ -171,6 +171,9 @@ InitProcGlobal(void)
171171 ProcGlobal -> spins_per_delay = DEFAULT_SPINS_PER_DELAY ;
172172 ProcGlobal -> freeProcs = NULL ;
173173 ProcGlobal -> autovacFreeProcs = NULL ;
174+ ProcGlobal -> startupProc = NULL ;
175+ ProcGlobal -> startupProcPid = 0 ;
176+ ProcGlobal -> startupBufferPinWaitBufId = -1 ;
174177
175178 /*
176179 * Create and initialize all the PGPROC structures we'll need (except for
@@ -493,7 +496,6 @@ PublishStartupProcessInformation(void)
493496
494497 procglobal -> startupProc = MyProc ;
495498 procglobal -> startupProcPid = MyProcPid ;
496- procglobal -> startupBufferPinWaitBufId = 0 ;
497499
498500 SpinLockRelease (ProcStructLock );
499501}
@@ -520,14 +522,10 @@ SetStartupBufferPinWaitBufId(int bufid)
520522int
521523GetStartupBufferPinWaitBufId (void )
522524{
523- int bufid ;
524-
525525 /* use volatile pointer to prevent code rearrangement */
526526 volatile PROC_HDR * procglobal = ProcGlobal ;
527527
528- bufid = procglobal -> startupBufferPinWaitBufId ;
529-
530- return bufid ;
528+ return procglobal -> startupBufferPinWaitBufId ;
531529}
532530
533531/*
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ typedef struct PROC_HDR
178178 /* The proc of the Startup process, since not in ProcArray */
179179 PGPROC * startupProc ;
180180 int startupProcPid ;
181- /* Buffer id of the buffer that Startup process waits for pin on */
181+ /* Buffer id of the buffer that Startup process waits for pin on, or -1 */
182182 int startupBufferPinWaitBufId ;
183183} PROC_HDR ;
184184
You can’t perform that action at this time.
0 commit comments