postgresql/src/test/modules
Tom Lane 887feefe87 Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch.
This coding pattern creates a race condition, because if an interesting
interrupt happens after we've checked InterruptPending but before we reset
our latch, the latch-setting done by the signal handler would get lost,
and then we might block at WaitLatch in the next iteration without ever
noticing the interrupt condition.  You can put the CHECK_FOR_INTERRUPTS
before WaitLatch or after ResetLatch, but not between them.

Aside from fixing the bugs, add some explanatory comments to latch.h
to perhaps forestall the next person from making the same mistake.

In HEAD, also replace gather_readnext's direct call of
HandleParallelMessages with CHECK_FOR_INTERRUPTS.  It does not seem clean
or useful for this one caller to bypass ProcessInterrupts and go straight
to HandleParallelMessages; not least because that fails to consider the
InterruptPending flag, resulting in useless work both here
(if InterruptPending isn't set) and in the next CHECK_FOR_INTERRUPTS call
(if it is).

This thinko seems to have been introduced in the initial coding of
storage/ipc/shm_mq.c (commit ec9037df2), and then blindly copied into all
the subsequent parallel-query support logic.  Back-patch relevant hunks
to 9.4 to extirpate the error everywhere.

Discussion: <1661.1469996911@sss.pgh.pa.us>
2016-08-01 15:13:53 -04:00
..
brin Fix phony .PHONY. 2016-03-19 17:19:37 -04:00
commit_ts Finish pgindent run for 9.6: Perl files. 2016-06-12 04:19:56 -04:00
dummy_seclabel Establish conventions about global object names used in regression tests. 2016-07-17 18:42:43 -04:00
snapshot_too_old Fix whitespace 2016-04-11 14:44:51 -04:00
test_ddl_deparse Establish conventions about global object names used in regression tests. 2016-07-17 18:42:43 -04:00
test_extensions Message style improvements 2016-07-25 22:07:44 -04:00
test_parser Update copyright for 2016 2016-01-02 13:33:40 -05:00
test_pg_dump Correctly handle owned sequences with extensions 2016-07-31 10:57:15 -04:00
test_rls_hooks Establish conventions about global object names used in regression tests. 2016-07-17 18:42:43 -04:00
test_shm_mq Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch. 2016-08-01 15:13:53 -04:00
worker_spi Update copyright for 2016 2016-01-02 14:19:48 -05:00
Makefile Provide and use a makefile target to build all generated headers. 2016-07-01 15:09:02 -04:00
README Add README in src/test and src/test/modules 2016-02-25 21:08:32 -03:00

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".

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.