From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Prevent race condition while reading relmapper file. |
Date: | 2021-06-24 07:46:43 |
Message-ID: | E1lwK4R-0008TR-EW@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Prevent race condition while reading relmapper file.
Contrary to the comment here, POSIX does not guarantee atomicity of a
read(), if another process calls write() concurrently. Or at least Linux
does not. Add locking to load_relmap_file() to avoid the race condition.
Fixes bug #17064. Thanks to Alexander Lakhin for the report and test case.
Backpatch-through: 9.6, all supported versions.
Discussion: https://www.postgresql.org/message-id/17064-bb0d7904ef72add3@postgresql.org
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/a5eacd86b71542d5e377d1fef628866dae859809
Modified Files
--------------
src/backend/utils/cache/relmapper.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2021-06-24 08:30:59 | pgsql: Another fix to relmapper race condition. |
Previous Message | Amit Kapila | 2021-06-24 06:23:20 | pgsql: Doc: Update logical replication message formats. |