diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-02 13:24:06 -0400 | 
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-02 13:24:06 -0400 | 
| commit | 0f904c95a4000caa717868d9bfaf5a423eefdb0b (patch) | |
| tree | 96de5a526adace0462393665b47d71a05d843b23 /src/backend/storage/lmgr/proc.c | |
| parent | f00fbad6bd43141faae05cd13a518fd28ae94673 (diff) | |
Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.
It was initialized in the wrong place and to the wrong value.  With bad
luck this could result in incorrect query-cancellation failures in hot
standby sessions, should a HS backend be holding pin on buffer number 1
while trying to acquire a lock.
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
| -rw-r--r-- | src/backend/storage/lmgr/proc.c | 10 | 
1 files changed, 4 insertions, 6 deletions
| diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index c9993a79dba..2608fea9451 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -179,6 +179,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; @@ -487,7 +490,6 @@ PublishStartupProcessInformation(void)  	procglobal->startupProc = MyProc;  	procglobal->startupProcPid = MyProcPid; -	procglobal->startupBufferPinWaitBufId = 0;  	SpinLockRelease(ProcStructLock);  } @@ -514,14 +516,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;  }  /* | 
