Clean up latch related code.
Andres Freund <andres@anarazel.de>
Clean up latch related code.
The larger part of this patch replaces usages of MyProc->procLatch
with MyLatch. The latter works even early during backend startup,
where MyProc->procLatch doesn't yet. While the affected code
shouldn't run in cases where it's not initialized, it might get copied
into places where it might. Using MyLatch is simpler and a bit faster
to boot, so there's little point to stick with the previous coding.
While doing so I noticed some weaknesses around newly introduced uses
of latches that could lead to missed events, and an omitted
CHECK_FOR_INTERRUPTS() call in worker_spi.
As all the actual bugs are in v10 code, there doesn't seem to be
sufficient reason to backpatch this.
Author: Andres Freund
Discussion:
https://postgr.es/m/20170606195321.sjmenrfgl2nu6j63@alap3.anarazel.de
https://postgr.es/m/20170606210405.sim3yl6vpudhmufo@alap3.anarazel.de
Backpatch: -
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/parallel.c | modified | +2 −2 |
| src/backend/libpq/pqmq.c | modified | +2 −2 |
| src/backend/postmaster/bgworker.c | modified | +2 −2 |
| src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | modified | +7 −6 |
| src/backend/replication/logical/launcher.c | modified | +25 −10 |
| src/backend/replication/logical/tablesync.c | modified | +6 −6 |
| src/backend/replication/logical/worker.c | modified | +7 −3 |
| src/backend/storage/lmgr/condition_variable.c | modified | +3 −3 |
| src/test/modules/worker_spi/worker_spi.c | modified | +2 −0 |