After sending cancel req, wait for remote error
authorMarko Kreen <markokr@gmail.com>
Thu, 11 Oct 2012 09:06:37 +0000 (12:06 +0300)
committerMarko Kreen <markokr@gmail.com>
Fri, 12 Oct 2012 07:24:48 +0000 (10:24 +0300)
commit080f7d5526b4211419142e2958b6d7e597285148
treebcf9ce388d518500fdfda4eff6b693a9ef934bb6
parentccc9dbb8e6af5b050abbc76cad38a58f05b32cee
After sending cancel req, wait for remote error

Previously, as soon as cancel requests were send,
plproxy re-throwed the error, without waiting for
reaction from backend.  Such behaviour creates
2 problems:

- If plproxy backend is closed immediately, the bouncer will
  see plproxy close before cancel from backend, thus seeing
  mid-tx close, thus dropping the connection.

- If new query comes in to plproxy backend, plproxy itself
  will see dirty connection, closing it, thus also causing
  close of server connection in bouncer.

In both cases it can cause server connection drop in pooler.
New behaviour of waiting query result should fix it.
Makefile
src/execute.c
src/plproxy.h
test/expected/plproxy_cancel.out [new file with mode: 0644]
test/sql/plproxy_cancel.sql [new file with mode: 0644]