Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e8ac82

Browse files
committed
Fix a variety of locking problems like newer lock waiters getting
lock before older waiters, and having readlock people not sharelocks if a writer is waiting for a lock, and waiting writers notgetting priority over waiting readers.
1 parent1de8926 commit0e8ac82

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

‎src/backend/storage/lmgr/lock.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.19 1998/01/2306:01:03 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.20 1998/01/2322:16:46 momjian Exp $
1111
*
1212
* NOTES
1313
* Outside modules can create a lock table and acquire/release
@@ -708,6 +708,20 @@ LockResolveConflicts(LOCKTAB *ltable,
708708
result->nHolding=0;
709709
}
710710

711+
{
712+
/* ------------------------
713+
* If someone with a greater priority is waiting for the lock,
714+
* do not continue and share the lock, even if we can. bjm
715+
* ------------------------
716+
*/
717+
intmyprio=ltable->ctl->prio[lockt];
718+
PROC_QUEUE*waitQueue=&(lock->waitProcs);
719+
PROC*topproc= (PROC*)MAKE_PTR(waitQueue->links.prev);
720+
721+
if (waitQueue->size&&topproc->prio>myprio)
722+
returnSTATUS_FOUND;
723+
}
724+
711725
/* ----------------------------
712726
* first check for global conflicts: If no locks conflict
713727
* with mine, then I get the lock.

‎src/backend/storage/lmgr/proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.26 1998/01/2306:01:05 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.27 1998/01/2322:16:48 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@
4646
*This is so that we can support more backends. (system-wide semaphore
4747
*sets run out pretty fast.) -ay 4/95
4848
*
49-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.26 1998/01/2306:01:05 momjian Exp $
49+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.27 1998/01/2322:16:48 momjian Exp $
5050
*/
5151
#include<sys/time.h>
5252
#include<unistd.h>
@@ -469,7 +469,7 @@ ProcSleep(PROC_QUEUE *queue,
469469
proc= (PROC*)MAKE_PTR(queue->links.prev);
470470
for (i=0;i<queue->size;i++)
471471
{
472-
if (proc->prio<prio)
472+
if (proc->prio>=prio)
473473
proc= (PROC*)MAKE_PTR(proc->links.prev);
474474
else
475475
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp