Skip to content

[DO NOT MERGE] Allow cancel pg wire #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/backend/commands/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ CopyGetData(CopyState cstate, void *databuf, int minread, int maxread)
int mtype;

readmessage:
HOLD_CANCEL_INTERRUPTS();
//HOLD_CANCEL_INTERRUPTS();
pq_startmsgread();
mtype = pq_getbyte();
if (mtype == EOF)
Expand All @@ -608,7 +608,7 @@ CopyGetData(CopyState cstate, void *databuf, int minread, int maxread)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
errmsg("unexpected EOF on client connection with an open transaction")));
RESUME_CANCEL_INTERRUPTS();
//RESUME_CANCEL_INTERRUPTS();
switch (mtype)
{
case 'd': /* CopyData */
Expand Down
7 changes: 5 additions & 2 deletions src/backend/tcop/postgres.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ SocketBackend(StringInfo inBuf)
/*
* Get message type code from the frontend.
*/
HOLD_CANCEL_INTERRUPTS();
//HOLD_CANCEL_INTERRUPTS();
pq_startmsgread();
qtype = pq_getbyte();

Expand Down Expand Up @@ -480,7 +480,7 @@ SocketBackend(StringInfo inBuf)
}
else
pq_endmsgread();
RESUME_CANCEL_INTERRUPTS();
//RESUME_CANCEL_INTERRUPTS();

return qtype;
}
Expand Down Expand Up @@ -2649,6 +2649,8 @@ StatementCancelHandler(SIGNAL_ARGS)
{
int save_errno = errno;

elog(NOTICE, "StatementCancelHandler invoked on %d", MyProcPid);

/*
* Don't joggle the elbow of proc_exit
*/
Expand All @@ -2662,6 +2664,7 @@ StatementCancelHandler(SIGNAL_ARGS)
SetLatch(MyLatch);

errno = save_errno;
raise(SIGUSR1);
}

/* signal handler for floating point exception */
Expand Down
2 changes: 2 additions & 0 deletions src/backend/utils/init/postinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,8 @@ StatementTimeoutHandler(void)
{
int sig = SIGINT;


elog(NOTICE, "StatementTimeoutHandler invoked on %d", MyProcPid);
/*
* During authentication the timeout is used to deal with
* authentication_timeout - we want to quit in response to such timeouts.
Expand Down