From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix and document lock handling for in-memory replication slot da |
Date: | 2018-06-10 10:45:04 |
Message-ID: | E1fRxqK-0005pI-IA@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Fix and document lock handling for in-memory replication slot data
While debugging issues on HEAD for the new slot forwarding feature of
Postgres 11, some monitoring of the code surrounding in-memory slot data
has proved that the lock handling may cause inconsistent data to be read
by read-only callers of slot functions, particularly
pg_get_replication_slots() which fetches data for the system view
pg_replication_slots, or modules looking directly at slot information.
The code paths involved in those problems concern logical decoding
initialization (down to 9.4) and WAL reservation for slots (new as of
10).
A set of comments documenting all the lock handlings, particularly the
dependency with LW locks for slots and the in_use flag as well as the
internal mutex lock is added, based on a suggested by Simon Riggs.
Some of the fixed code exists down to 9.4 where WAL decoding has been
introduced, but as those race conditions are really unlikely going to
happen as those concern code paths for slot and decoding creation, just
fix the problem on HEAD.
Author: Michael Paquier
Discussion: https://postgr.es/m/20180528085747.GA27845@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9e149c847f398793ec1641885434dcd10837d89d
Modified Files
--------------
src/backend/replication/logical/logical.c | 13 +++++++++----
src/backend/replication/slot.c | 4 ++++
src/include/replication/slot.h | 13 +++++++++++++
3 files changed, 26 insertions(+), 4 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-06-10 13:52:27 | pgsql: Fix grammar in REVOKE documentation |
Previous Message | Thomas Munro | 2018-06-10 09:27:37 | pgsql: Limit Parallel Hash's bucket array to MaxAllocSize. |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-06-10 11:49:09 | Re: PostgreSQL vs SQL Standard |
Previous Message | Andrew Gierth | 2018-06-10 09:30:32 | Re: PostgreSQL vs SQL Standard |