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
07140ee0
Commit
07140ee0
authored
May 19, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow cancel from client of backend query. Change some int variables
to bool's.
parent
ef567413
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
45 deletions
+82
-45
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+7
-7
src/backend/executor/execProcnode.c
src/backend/executor/execProcnode.c
+7
-1
src/backend/libpq/pqcomm.c
src/backend/libpq/pqcomm.c
+5
-8
src/backend/tcop/dest.c
src/backend/tcop/dest.c
+3
-2
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+45
-16
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+2
-2
src/backend/utils/init/globals.c
src/backend/utils/init/globals.c
+5
-3
src/include/libpq/libpq.h
src/include/libpq/libpq.h
+2
-2
src/include/miscadmin.h
src/include/miscadmin.h
+4
-3
src/include/tcop/tcopprot.h
src/include/tcop/tcopprot.h
+2
-1
No files found.
src/backend/bootstrap/bootstrap.c
View file @
07140ee0
...
...
@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.4
0 1998/04/26 04:06:0
4 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.4
1 1998/05/19 18:05:4
4 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -312,8 +312,8 @@ BootstrapMain(int argc, char *argv[])
*/
/* Set defaults, to be overriden by explicit options below */
Quiet
=
0
;
Noversion
=
0
;
Quiet
=
false
;
Noversion
=
false
;
dbName
=
NULL
;
DataDir
=
getenv
(
"PGDATA"
);
/* Null if no PGDATA variable */
...
...
@@ -325,19 +325,19 @@ BootstrapMain(int argc, char *argv[])
DataDir
=
optarg
;
break
;
case
'd'
:
DebugMode
=
1
;
/* print out debugging info while parsing */
DebugMode
=
true
;
/* print out debugging info while parsing */
break
;
case
'C'
:
Noversion
=
1
;
Noversion
=
true
;
break
;
case
'F'
:
fsyncOff
=
1
;
fsyncOff
=
true
;
break
;
case
'O'
:
override
=
true
;
break
;
case
'Q'
:
Quiet
=
1
;
Quiet
=
true
;
break
;
case
'P'
:
/* specify port */
portFd
=
atoi
(
optarg
);
...
...
src/backend/executor/execProcnode.c
View file @
07140ee0
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.
9 1998/02/26 04:31:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.
10 1998/05/19 18:05:45
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -74,6 +74,8 @@
*/
#include "postgres.h"
#include "miscadmin.h"
#include "tcop/tcopprot.h"
#include "executor/executor.h"
#include "executor/nodeResult.h"
#include "executor/nodeAppend.h"
...
...
@@ -233,6 +235,10 @@ ExecProcNode(Plan *node, Plan *parent)
* deal with NULL nodes..
* ----------------
*/
if
(
QueryCancel
)
CancelQuery
();
if
(
node
==
NULL
)
return
NULL
;
...
...
src/backend/libpq/pqcomm.c
View file @
07140ee0
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.4
0 1998/03/02 05:41:53 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.4
1 1998/05/19 18:05:46 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -409,18 +409,15 @@ pq_sendoob(char *msg, int len)
{
int
fd
=
fileno
(
Pfout
);
return
(
send
(
fd
,
msg
,
len
,
MSG_OOB
)
);
return
send
(
fd
,
msg
,
len
,
MSG_OOB
);
}
int
pq_recvoob
(
char
*
msgPtr
,
int
*
lenPtr
)
pq_recvoob
(
char
*
msgPtr
,
int
len
)
{
int
fd
=
fileno
(
Pfout
);
int
len
=
0
;
len
=
recv
(
fd
,
msgPtr
+
len
,
*
lenPtr
,
MSG_OOB
);
*
lenPtr
=
len
;
return
(
len
);
return
recv
(
fd
,
msgPtr
,
len
,
MSG_OOB
);
}
/* --------------------------------
...
...
@@ -523,7 +520,7 @@ pq_async_notify()
/* int len = sizeof(msg); */
int
len
=
20
;
if
(
pq_recvoob
(
msg
,
&
len
)
>=
0
)
if
(
pq_recvoob
(
msg
,
len
)
>=
0
)
{
/* debugging */
printf
(
"received notification: %s
\n
"
,
msg
);
...
...
src/backend/tcop/dest.c
View file @
07140ee0
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.
19 1998/05/14 17:18:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.
20 1998/05/19 18:05:47
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -288,7 +288,8 @@ BeginCommand(char *pname,
* oops.. */
pq_putint
((
int
)
attrs
[
i
]
->
atttypid
,
sizeof
(
attrs
[
i
]
->
atttypid
));
pq_putint
(
attrs
[
i
]
->
attlen
,
sizeof
(
attrs
[
i
]
->
attlen
));
pq_putint
(
attrs
[
i
]
->
atttypmod
,
sizeof
(
attrs
[
i
]
->
atttypmod
));
if
(
PG_PROTOCOL_MAJOR
(
FrontendProtocol
)
>=
2
)
pq_putint
(
attrs
[
i
]
->
atttypmod
,
sizeof
(
attrs
[
i
]
->
atttypmod
));
}
}
break
;
...
...
src/backend/tcop/postgres.c
View file @
07140ee0
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.6
8 1998/05/06 23:50:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.6
9 1998/05/19 18:05:48
momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -119,7 +119,7 @@ jmp_buf Warn_restart;
sigjmp_buf
Warn_restart
;
#endif
/* defined(nextstep) */
int
InError
;
bool
InError
;
extern
int
NBuffers
;
...
...
@@ -618,6 +618,9 @@ pg_exec_query_dest(char *query_string, /* string to execute */
/* plan the queries */
plan_list
=
pg_parse_and_plan
(
query_string
,
typev
,
nargs
,
&
querytree_list
,
dest
);
if
(
QueryCancel
)
CancelQuery
();
/* pg_parse_and_plan could have failed */
if
(
querytree_list
==
NULL
)
return
;
...
...
@@ -776,6 +779,26 @@ FloatExceptionHandler(SIGNAL_ARGS)
}
/* signal handler for query cancel */
static
void
QueryCancelHandler
(
SIGNAL_ARGS
)
{
QueryCancel
=
true
;
}
void
CancelQuery
(
void
)
{
char
dummy
;
/* throw it away */
while
(
pq_recvoob
(
&
dummy
,
1
)
>
0
)
;
/* QueryCancel reset in longjump after elog() call */
elog
(
ERROR
,
"Query was cancelled."
);
}
static
void
usage
(
char
*
progname
)
{
...
...
@@ -819,11 +842,11 @@ usage(char *progname)
int
PostgresMain
(
int
argc
,
char
*
argv
[])
{
int
flagC
;
int
flagQ
;
int
flagE
;
int
flagEu
;
int
flag
;
bool
flagC
=
false
,
flagQ
=
false
,
flagE
=
false
,
flagEu
=
false
;
int
flag
;
char
*
DBName
=
NULL
;
int
errs
=
0
;
...
...
@@ -865,7 +888,7 @@ PostgresMain(int argc, char *argv[])
/*
* Set default values.
*/
flagC
=
flagQ
=
flagE
=
flagEu
=
ShowStats
=
0
;
ShowStats
=
0
;
ShowParserStats
=
ShowPlannerStats
=
ShowExecutorStats
=
0
;
#ifdef LOCK_MGR_DEBUG
lockDebug
=
0
;
...
...
@@ -928,14 +951,14 @@ PostgresMain(int argc, char *argv[])
* don't print version string (don't know why this is 'C' --mao)
* ----------------
*/
flagC
=
1
;
flagC
=
true
;
break
;
case
'D'
:
/* PGDATA directory */
DataDir
=
optarg
;
case
'd'
:
/* debug level */
flagQ
=
0
;
flagQ
=
false
;
DebugLvl
=
(
short
)
atoi
(
optarg
);
if
(
DebugLvl
>
1
)
DebugPrintQuery
=
true
;
...
...
@@ -952,7 +975,7 @@ PostgresMain(int argc, char *argv[])
* E - echo the query the user entered
* ----------------
*/
flagE
=
1
;
flagE
=
true
;
break
;
case
'e'
:
...
...
@@ -960,7 +983,7 @@ PostgresMain(int argc, char *argv[])
* Use european date formats.
* --------------------------
*/
flagEu
=
1
;
flagEu
=
true
;
break
;
case
'F'
:
...
...
@@ -1064,7 +1087,7 @@ PostgresMain(int argc, char *argv[])
* Q - set Quiet mode (reduce debugging output)
* ----------------
*/
flagQ
=
1
;
flagQ
=
true
;
break
;
case
'S'
:
...
...
@@ -1252,6 +1275,7 @@ PostgresMain(int argc, char *argv[])
}
pq_init
(
Portfd
);
whereToSendOutput
=
Remote
;
pq_regoob
(
QueryCancelHandler
);
/* we do it here so the backend it connected */
}
else
whereToSendOutput
=
Debug
;
...
...
@@ -1282,7 +1306,7 @@ PostgresMain(int argc, char *argv[])
if
(
sigsetjmp
(
Warn_restart
,
1
)
!=
0
)
{
InError
=
1
;
InError
=
true
;
time
(
&
tim
);
...
...
@@ -1292,8 +1316,10 @@ PostgresMain(int argc, char *argv[])
MemSet
(
parser_input
,
0
,
MAX_PARSE_BUFFER
);
AbortCurrentTransaction
();
}
InError
=
0
;
InError
=
false
;
/* ----------------
* POSTGRES main processing loop begins here
...
...
@@ -1302,7 +1328,7 @@ PostgresMain(int argc, char *argv[])
if
(
IsUnderPostmaster
==
false
)
{
puts
(
"
\n
POSTGRES backend interactive interface"
);
puts
(
"$Revision: 1.6
8 $ $Date: 1998/05/06 23:50:19
$"
);
puts
(
"$Revision: 1.6
9 $ $Date: 1998/05/19 18:05:48
$"
);
}
/* ----------------
...
...
@@ -1329,6 +1355,9 @@ PostgresMain(int argc, char *argv[])
MemSet
(
parser_input
,
0
,
MAX_PARSE_BUFFER
);
firstchar
=
ReadCommand
(
parser_input
);
QueryCancel
=
false
;
/* process the command */
switch
(
firstchar
)
{
...
...
src/backend/utils/error/elog.c
View file @
07140ee0
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.2
7 1998/02/26 04:37:34
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.2
8 1998/05/19 18:05:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -175,7 +175,7 @@ elog(int lev, const char *fmt,...)
if
(
lev
==
ERROR
)
{
extern
int
InError
;
extern
bool
InError
;
ProcReleaseSpins
(
NULL
);
/* get rid of spinlocks we hold */
if
(
!
InError
)
...
...
src/backend/utils/init/globals.c
View file @
07140ee0
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.2
1 1998/02/26 04:37:56
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.2
2 1998/05/19 18:05:51
momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
...
...
@@ -37,8 +37,10 @@
ProtocolVersion
FrontendProtocol
=
PG_PROTOCOL_LATEST
;
int
Portfd
=
-
1
;
int
Noversion
=
0
;
int
Quiet
=
1
;
bool
Noversion
=
false
;
bool
Quiet
=
false
;
bool
QueryCancel
=
false
;
int
MyProcPid
;
...
...
src/include/libpq/libpq.h
View file @
07140ee0
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq.h,v 1.1
3 1998/03/02 05:42:06 scrappy
Exp $
* $Id: libpq.h,v 1.1
4 1998/05/19 18:05:55 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -269,7 +269,7 @@ extern void pq_putstr(char *s);
extern
void
pq_putnchar
(
char
*
s
,
int
n
);
extern
void
pq_putint
(
int
i
,
int
b
);
extern
int
pq_sendoob
(
char
*
msg
,
int
len
);
extern
int
pq_recvoob
(
char
*
msgPtr
,
int
*
lenPtr
);
extern
int
pq_recvoob
(
char
*
msgPtr
,
int
len
);
extern
int
pq_getinaddr
(
struct
sockaddr_in
*
sin
,
char
*
host
,
int
port
);
extern
int
pq_getinserv
(
struct
sockaddr_in
*
sin
,
char
*
host
,
char
*
serv
);
extern
int
...
...
src/include/miscadmin.h
View file @
07140ee0
...
...
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.2
2 1998/04/05 21:04:50
momjian Exp $
* $Id: miscadmin.h,v 1.2
3 1998/05/19 18:05:52
momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
...
...
@@ -35,8 +35,9 @@ extern int PostmasterMain(int argc, char *argv[]);
* from utils/init/globals.c
*/
extern
int
Portfd
;
extern
int
Noversion
;
extern
int
Quiet
;
extern
bool
Noversion
;
extern
bool
Quiet
;
extern
bool
QueryCancel
;
extern
char
*
DataDir
;
extern
int
MyProcPid
;
...
...
src/include/tcop/tcopprot.h
View file @
07140ee0
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tcopprot.h,v 1.1
1 1998/02/26 04:43:41
momjian Exp $
* $Id: tcopprot.h,v 1.1
2 1998/05/19 18:05:58
momjian Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
...
...
@@ -34,6 +34,7 @@ pg_exec_query_dest(char *query_string, char **argv, Oid *typev,
extern
void
handle_warn
(
SIGNAL_ARGS
);
extern
void
die
(
SIGNAL_ARGS
);
extern
void
CancelQuery
(
void
);
extern
int
PostgresMain
(
int
argc
,
char
*
argv
[]);
extern
void
ResetUsage
(
void
);
extern
void
ShowUsage
(
void
);
...
...
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