| From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <akapila(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pgsql: Prevent invalidation of newly synced replication slots. |
| Date: | 2026-01-28 07:22:59 |
| Message-ID: | CA+hUKGKx+-g9w9XUHBp8oRDc_3yOMtbSg3Se-rAy=2WzT4oqNg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers pgsql-hackers |
On Tue, Jan 27, 2026 at 5:37 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2026-01-28 05:16:13 +1300, Thomas Munro wrote:
> > But I wonder if you can't rename("old", "new") where "new" is a file that
> > has already been unlinked (or renamed over) that someone still holds open,
> > or something like that...
>
> I don't see a source of that that would be specific to this test though :(. We
> do wait for pg_basebackup to have shut down, which wrote backup.label (which
> was "manifactured" during streaming by basebackup.c).
I have no specific ideas, but just in case it's helpful for this
discussion, I looked at my old test suite[1] where I tried to
catalogue all the edge conditions around this sort of stuff
empirically, and saw that rename() always fails like that if the file
is open (that is, it doesn't require a more complicated sequence with
an earlier unlink/rename of the new name):
+ /*
+ * Windows can't rename over an open non-unlinked file, even with
+ * have_posix_unlink_semantics.
+ */
+ pgwin32_dirmod_loops = 2; /* minimize looping to fail fast in testing */
+ PG_EXPECT_SYS(rename(path, path2) == -1,
+ "Windows: can't rename name1.txt -> name2.txt while name2.txt is open");
+ PG_EXPECT_EQ(errno, EACCES);
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-01-28 10:44:41 | Re: pgsql: Prevent invalidation of newly synced replication slots. |
| Previous Message | Amit Kapila | 2026-01-28 05:47:57 | Re: pgsql: Prevent invalidation of newly synced replication slots. |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | tushar | 2026-01-28 07:34:11 | Re: Non-text mode for pg_dumpall |
| Previous Message | Richard Guo | 2026-01-28 06:42:11 | Re: Optimize IS DISTINCT FROM with non-nullable inputs |