pgsql: Fix read_relmap_file() concurrency on Windows.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix read_relmap_file() concurrency on Windows.
Date: 2022-07-27 15:20:12
Message-ID: E1oGipX-001V42-T0@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix read_relmap_file() concurrency on Windows.

Commit d8cd0c6c95c0120168df93aae095df4e0682a08a introduced a file
rename that could fail on Windows, probably due to other backends
having an open file handle to the old file of the same name.
Re-arrange the locking slightly to prevent that, by making sure the
open() and close() run while we hold the lock.

Thomas Munro. I added an explanatory comment.

Discussion: https://postgr.es/m/CA%2BhUKGLZtCTgp4NTWV-wGbR2Nyag71%3DEfYTKjDKnk%2BfkhuFMHw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a2e97cb2b6fb64c3ca3198f5c5f31190bc14c703

Modified Files
--------------
src/backend/utils/cache/relmapper.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2022-07-27 15:20:46 Re: pgsql: Remove the restriction that the relmap must be 512 bytes.
Previous Message Michael Paquier 2022-07-27 10:51:25 pgsql: Refactor code in charge of grabbing the relations of a subscript