The existing PQcancel API uses blocking IO, which makes PQcancel impossible to use in an event loop based codebase without blocking the event loop until the call returns. It also doesn't encrypt the connection over which the cancel request is sent, even when the original connection required encryption. This commit adds a PQcancelConn struct and assorted functions, which provide a better mechanism of sending cancel requests; in particular all the encryption used in the original connection are also used in the cancel connection. The main entry points are: - PQcancelCreate creates the PQcancelConn based on the original connection (but does not establish an actual connection). - PQcancelStart can be used to initiate non-blocking cancel requests, using encryption if the original connection did so, which must be pumped using - PQcancelPoll. - PQcancelReset puts a PQcancelConn back in state so that it can be reused to send a new cancel request to the same connection. - PQcancelBlocking is a simpler-to-use blocking API that still uses encryption. Additional functions are - PQcancelStatus, mimicks PQstatus; - PQcancelSocket, mimicks PQcancelSocket; - PQcancelErrorMessage, mimicks PQerrorMessage; - PQcancelFinish, mimicks PQfinish. Author: Jelte Fennema-Nio <postgres@jeltef.nl> Reviewed-by: Denis Laxalde <denis.laxalde@dalibo.com> Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com |
||
---|---|---|
.. | ||
brin | ||
commit_ts | ||
delay_execution | ||
dummy_index_am | ||
dummy_seclabel | ||
gin | ||
injection_points | ||
ldap_password_func | ||
libpq_pipeline | ||
plsample | ||
spgist_name_ops | ||
ssl_passphrase_callback | ||
test_bloomfilter | ||
test_copy_callbacks | ||
test_custom_rmgrs | ||
test_ddl_deparse | ||
test_dsa | ||
test_dsm_registry | ||
test_extensions | ||
test_ginpostinglist | ||
test_integerset | ||
test_lfind | ||
test_misc | ||
test_oat_hooks | ||
test_parser | ||
test_pg_dump | ||
test_predtest | ||
test_radixtree | ||
test_rbtree | ||
test_regex | ||
test_resowner | ||
test_rls_hooks | ||
test_shm_mq | ||
test_slru | ||
unsafe_tests | ||
worker_spi | ||
xid_wraparound | ||
Makefile | ||
README | ||
meson.build |
README
Test extensions and libraries ============================= src/test/modules contains PostgreSQL extensions that are primarily or entirely intended for testing PostgreSQL and/or to serve as example code. The extensions here aren't intended to be installed in a production server and aren't suitable for "real work". Furthermore, while you can do "make install" and "make installcheck" in this directory or its children, it is NOT ADVISABLE to do so with a server containing valuable data. Some of these tests may have undesirable side-effects on roles or other global objects within the tested server. "make installcheck-world" at the top level does not recurse into this directory. Most extensions have their own pg_regress tests or isolationtester specs. Some are also used by tests elsewhere in the tree. If you're adding new hooks or other functionality exposed as C-level API this is where to add the tests for it.