]> git.ipfire.org Git - thirdparty/postgresql.git/commit
On Windows, wait a little to see if ERROR_ACCESS_DENIED goes away.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 16 Dec 2019 20:10:55 +0000 (15:10 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 16 Dec 2019 20:10:55 +0000 (15:10 -0500)
commitcd03803512bf9484d2a045bf877a8ddc2cb47059
tree111e70932126fbee00cbd3313d6d7c3f2e29f6af
parent323c47925af9e53c4c0476553e3e13a86f3d8173
On Windows, wait a little to see if ERROR_ACCESS_DENIED goes away.

Attempting to open a file fails with ERROR_ACCESS_DENIED if the file
is flagged for deletion but not yet actually gone (another in a long
list of reasons why Windows is broken, if you ask me).  This seems
likely to explain a lot of irreproducible failures we see in the
buildfarm.  This state generally persists for only a millisecond or so,
so just wait a bit and retry.  If it's a real permissions problem,
we'll eventually give up and report it as such.  If it's the pending
deletion case, we'll see file-not-found and report that after the
deletion completes, and the caller will treat that in an appropriate
way.

In passing, rejigger the existing retry logic for some other error
cases so that we don't uselessly wait an extra time when we're
not going to retry anymore.

Alexander Lakhin (with cosmetic tweaks by me).  Back-patch to all
supported branches, since this seems like a pretty safe change and
the problem is definitely real.

Discussion: https://postgr.es/m/16161-7a985d2f1bbe8f71@postgresql.org
src/port/open.c