]> granicus.if.org Git - postgresql/commit
On Windows, when a file is deleted and another process still has an open
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 10 Sep 2009 09:42:10 +0000 (09:42 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 10 Sep 2009 09:42:10 +0000 (09:42 +0000)
commit4e2d5efc6a45b1f9f96df42629f6d1c7740e657e
tree547cf75fbe278db9690864a47c1a5cc716d7a44e
parent3ab8b7fa6f9ac2fb04096f8860261dc42d59a570
On Windows, when a file is deleted and another process still has an open
file handle on it, the file goes into "pending deletion" state where it
still shows up in directory listing, but isn't accessible otherwise. That
confuses RemoveOldXLogFiles(), making it think that the file hasn't been
archived yet, while it actually was, and it was deleted along with the .done
file.

Fix that by renaming the file with ".deleted" extension before deleting it.
Also check the return value of rename() and unlink(), so that if the removal
fails for any reason (e.g another process is holding the file locked), we
don't delete the .done file until the WAL file is really gone.

Backpatch to 8.2, which is the oldest version supported on Windows.
src/backend/access/transam/xlog.c