diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-02 13:24:00 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-02 13:24:00 -0400 |
commit | 0dd6a09e3d127e728b9f43cfaf19e5351f60a096 (patch) | |
tree | 73e01e7b41b2eacf6a9d0537c703429f615501d5 /src/backend/storage/lmgr/proc.c | |
parent | bc6616aaedbe4bcd2441334a3bf8f43fe9635bf1 (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 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; } /* |