pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: niallfr@btinternet.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13518: CancelRequest lacks statement identifier
Date: Fri, 24 Jul 2015 18:02:36 +0000
Message-ID: <20150724180236.2737.27011@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13518
Logged by:          Niall Ross
Email address:      niallfr@btinternet.com
PostgreSQL version: 9.3.1
Operating system:   Mac OSX 10.9.5, Windows 7, Linux RHel 5.6
Description:        

Postgres lacks a way to cancel a specific identified statement.  Sending
CancelRequest cancels the current statement running on a connection.  But
this means the current statement when the cancel reaches the server, _not_
the current statement when the cancel was sent.  Thus we are caught between
a rock and a hard place when our system has to dismiss an
incompletely-processed statement, since the system cannot tell which of the
following applies.

- If the statement will run on the server for a while yet, we have time to
send cancel-on-server and will complete the dismiss quicker by doing so
(because we buffer, draining all messages for that statement from the
socket, and cancelling on server truncates the flow of messages).

- If the statement will soon finish anyway, the asynchronous
cancel-on-server can kill the _next_ statement on that connection, not the
one our system seeks to dismiss, exactly the opposite of what is wanted.

When dismissing a query, the aim is to do so as fast as possible.  For a
long-running query, sending CancelRequest to the server is exactly what you
want, but until Postgres knows which session is meant, we can see no way for
an automatic system to do this safely (unless by a post-send delay,
defeating the aim, which is performance).

If CancelRequest could include a statement name (or other means of
identifying a statement) and did nothing if that statement was no longer
running by the time the server processed it, the usability of CancelRequest
would be significantly enhanced.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (7+ messages)  latest in thread

Message-ID: <20150724180236.2737.27011@wrigleys.postgresql.org>
Permalink:  ../20150724180236.2737.27011@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150724180236.2737.27011@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: niallfr@btinternet.com
  Subject: Re: BUG #13518: CancelRequest lacks statement identifier
  In-Reply-To: <20150724180236.2737.27011@wrigleys.postgresql.org>
  References: <20150724180236.2737.27011@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox