postgresql/src/include/commands
Andres Freund 4f85fde8eb Introduce and use infrastructure for interrupt processing during client reads.
Up to now large swathes of backend code ran inside signal handlers
while reading commands from the client, to allow for speedy reaction to
asynchronous events. Most prominently shared invalidation and NOTIFY
handling. That means that complex code like the starting/stopping of
transactions is run in signal handlers...  The required code was
fragile and verbose, and is likely to contain bugs.

That approach also severely limited what could be done while
communicating with the client. As the read might be from within
openssl it wasn't safely possible to trigger an error, e.g. to cancel
a backend in idle-in-transaction state. We did that in some cases,
namely fatal errors, nonetheless.

Now that FE/BE communication in the backend employs non-blocking
sockets and latches to block, we can quite simply interrupt reads from
signal handlers by setting the latch. That allows us to signal an
interrupted read, which is supposed to be retried after returning from
within the ssl library.

As signal handlers now only need to set the latch to guarantee timely
interrupt processing, remove a fair amount of complicated & fragile
code from async.c and sinval.c.

We could now actually start to process some kinds of interrupts, like
sinval ones, more often that before, but that seems better done
separately.

This work will hopefully allow to handle cases like being blocked by
sending data, interrupting idle transactions and similar to be
implemented without too much effort.  In addition to allowing getting
rid of ImmediateInterruptOK, that is.

Author: Andres Freund
Reviewed-By: Heikki Linnakangas
2015-02-03 22:25:20 +01:00
..
alter.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
async.h Introduce and use infrastructure for interrupt processing during client reads. 2015-02-03 22:25:20 +01:00
cluster.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
collationcmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
comment.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
conversioncmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
copy.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
createas.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
dbcommands.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
defrem.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
discard.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
event_trigger.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
explain.h Rearrange explain.c's API so callers need not embed sizeof(ExplainState). 2015-01-15 13:39:33 -05:00
extension.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
lockcmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
matview.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
policy.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
portalcmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
prepare.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
proclang.h pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
schemacmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
seclabel.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
sequence.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
tablecmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
tablespace.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
trigger.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
typecmds.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
user.h ALTER TABLESPACE ... MOVE ... OWNED BY 2014-01-23 23:52:40 -05:00
vacuum.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
variable.h Update copyright for 2015 2015-01-06 11:43:47 -05:00
view.h Update copyright for 2015 2015-01-06 11:43:47 -05:00