Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
dae52bf3
Commit
dae52bf3
authored
Jan 16, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oops, I had managed to break query-cancel-while-waiting-for-lock.
parent
64e6c608
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
10 deletions
+30
-10
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+13
-4
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+15
-4
src/include/storage/proc.h
src/include/storage/proc.h
+2
-2
No files found.
src/backend/storage/lmgr/proc.c
View file @
dae52bf3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.9
3 2001/01/16 06:11
:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.9
4 2001/01/16 20:59
:34 tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
* This is so that we can support more backends. (system-wide semaphore
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
* sets run out pretty fast.) -ay 4/95
*
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.9
3 2001/01/16 06:11
:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.9
4 2001/01/16 20:59
:34 tgl Exp $
*/
*/
#include "postgres.h"
#include "postgres.h"
...
@@ -353,16 +353,19 @@ RemoveFromWaitQueue(PROC *proc)
...
@@ -353,16 +353,19 @@ RemoveFromWaitQueue(PROC *proc)
/*
/*
* Cancel any pending wait for lock, when aborting a transaction.
* Cancel any pending wait for lock, when aborting a transaction.
*
*
* Returns true if we had been waiting for a lock, else false.
*
* (Normally, this would only happen if we accept a cancel/die
* (Normally, this would only happen if we accept a cancel/die
* interrupt while waiting; but an elog(ERROR) while waiting is
* interrupt while waiting; but an elog(ERROR) while waiting is
* within the realm of possibility, too.)
* within the realm of possibility, too.)
*/
*/
void
bool
LockWaitCancel
(
void
)
LockWaitCancel
(
void
)
{
{
/* Nothing to do if we weren't waiting for a lock */
/* Nothing to do if we weren't waiting for a lock */
if
(
!
waitingForLock
)
if
(
!
waitingForLock
)
return
;
return
false
;
waitingForLock
=
false
;
waitingForLock
=
false
;
/* Turn off the deadlock timer, if it's still running (see ProcSleep) */
/* Turn off the deadlock timer, if it's still running (see ProcSleep) */
...
@@ -395,6 +398,12 @@ LockWaitCancel(void)
...
@@ -395,6 +398,12 @@ LockWaitCancel(void)
* prematurely.
* prematurely.
*/
*/
ZeroProcSemaphore
(
MyProc
);
ZeroProcSemaphore
(
MyProc
);
/*
* Return true even if we were kicked off the lock before we were
* able to remove ourselves.
*/
return
true
;
}
}
...
...
src/backend/tcop/postgres.c
View file @
dae52bf3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.20
1 2001/01/14 05:08:16
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.20
2 2001/01/16 20:59:34
tgl Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -940,11 +940,14 @@ die(SIGNAL_ARGS)
...
@@ -940,11 +940,14 @@ die(SIGNAL_ARGS)
InterruptPending
=
true
;
InterruptPending
=
true
;
ProcDiePending
=
true
;
ProcDiePending
=
true
;
/*
/*
* If we're waiting for input, service the interrupt immediately
* If it's safe to interrupt, and we're waiting for input or a lock,
* service the interrupt immediately
*/
*/
if
(
ImmediateInterruptOK
&&
CritSectionCount
==
0
)
if
(
ImmediateInterruptOK
&&
CritSectionCount
==
0
)
{
{
DisableNotifyInterrupt
();
DisableNotifyInterrupt
();
/* Make sure HandleDeadLock won't run while shutting down... */
LockWaitCancel
();
ProcessInterrupts
();
ProcessInterrupts
();
}
}
}
}
...
@@ -967,8 +970,16 @@ QueryCancelHandler(SIGNAL_ARGS)
...
@@ -967,8 +970,16 @@ QueryCancelHandler(SIGNAL_ARGS)
InterruptPending
=
true
;
InterruptPending
=
true
;
QueryCancelPending
=
true
;
QueryCancelPending
=
true
;
/*
/*
* No point in raising Cancel if we are waiting for input ...
* If it's safe to interrupt, and we're waiting for a lock,
* service the interrupt immediately. No point in interrupting
* if we're waiting for input, however.
*/
*/
if
(
ImmediateInterruptOK
&&
CritSectionCount
==
0
&&
LockWaitCancel
())
{
DisableNotifyInterrupt
();
ProcessInterrupts
();
}
}
}
errno
=
save_errno
;
errno
=
save_errno
;
...
@@ -1668,7 +1679,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
...
@@ -1668,7 +1679,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.20
1 $ $Date: 2001/01/14 05:08:16
$
\n
"
);
puts
(
"$Revision: 1.20
2 $ $Date: 2001/01/16 20:59:34
$
\n
"
);
}
}
/*
/*
...
...
src/include/storage/proc.h
View file @
dae52bf3
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: proc.h,v 1.3
5 2001/01/16 06:11
:34 tgl Exp $
* $Id: proc.h,v 1.3
6 2001/01/16 20:59
:34 tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -140,7 +140,7 @@ extern PROC *ProcWakeup(PROC *proc, int errType);
...
@@ -140,7 +140,7 @@ extern PROC *ProcWakeup(PROC *proc, int errType);
extern
int
ProcLockWakeup
(
LOCKMETHOD
lockmethod
,
LOCK
*
lock
);
extern
int
ProcLockWakeup
(
LOCKMETHOD
lockmethod
,
LOCK
*
lock
);
extern
void
ProcAddLock
(
SHM_QUEUE
*
elem
);
extern
void
ProcAddLock
(
SHM_QUEUE
*
elem
);
extern
void
ProcReleaseSpins
(
PROC
*
proc
);
extern
void
ProcReleaseSpins
(
PROC
*
proc
);
extern
void
LockWaitCancel
(
void
);
extern
bool
LockWaitCancel
(
void
);
extern
void
HandleDeadLock
(
SIGNAL_ARGS
);
extern
void
HandleDeadLock
(
SIGNAL_ARGS
);
#endif
/* PROC_H */
#endif
/* PROC_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment