win32 open patch for held unlink
For application to HEAD, following community review. [open.c destined for
src/port]
Win32 people: This has been kicked around on the thread for a bit, I've not
been able to break it, but am still uncomfortable that it appears a novel
solution. If you can see any reason why this approach should not be adopted,
speak up now (or forever hold your transactions?).
heers,
Claudio
---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
Claudio, how does this handle renames if the file is open by someone
else? Does this remove the need to loop over the rename?
---------------------------------------------------------------------------
Claudio Natoli wrote:
For application to HEAD, following community review. [open.c destined for
src/port]Win32 people: This has been kicked around on the thread for a bit, I've not
been able to break it, but am still uncomfortable that it appears a novel
solution. If you can see any reason why this approach should not be adopted,
speak up now (or forever hold your transactions?).heers,
Claudio--- Certain disclaimers and policies apply to all email sent from Memetrics. For the full text of these disclaimers and policies see <a href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em ailpolicy.html</a>
[ Attachment, skipping... ]
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Claudio, how does this handle renames if the file is open by someone
else? Does this remove the need to loop over the rename?
To be honest, I don't know that it does. [Will report back later.]
Two points though:
a) This could doesn't alleviate the needs for dirmod.c, as far as I'm aware.
That seems to be there for a different reason, namely that there appears to
be some timing issue between creating a file and issuing an unlink/rename.
b) Do we have a case where rename's can block because of the file being held
open by another process? I haven't tripped over this yet...
Cheers,
Claudio
---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
Import Notes
Resolved by subject fallback
a) This could doesn't alleviate the needs for dirmod.c, as
This CODE doesn't alleviate the NEED for...
Sheesh,
Claudio
---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
Import Notes
Resolved by subject fallback
Claudio Natoli wrote:
Claudio, how does this handle renames if the file is open by someone
else? Does this remove the need to loop over the rename?To be honest, I don't know that it does. [Will report back later.]
Two points though:
a) This could doesn't alleviate the needs for dirmod.c, as far as I'm aware.
That seems to be there for a different reason, namely that there appears to
be some timing issue between creating a file and issuing an unlink/rename.b) Do we have a case where rename's can block because of the file being held
open by another process? I haven't tripped over this yet...
Agreed, we still need dirmod.c in case someone has opened it using a
non-unix mode. My only question was whether this new mode makes rename
possible on a target file opened by another backend.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Agreed, we still need dirmod.c in case someone has opened it using a
non-unix mode.
Ok. Wanted to make sure I was on the same page.
My only question was whether this new mode makes rename
possible on a target file opened by another backend.
Looks good. Wrote a pair of 2 liner driver programs to test. Renaming fails
when the file is open()'d, but proceeds correctly when win32_open()'d.
Cheers,
Claudio
---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
Import Notes
Resolved by subject fallback
Claudio Natoli wrote:
Agreed, we still need dirmod.c in case someone has opened it using a
non-unix mode.
Ok. Wanted to make sure I was on the same page.
My only question was whether this new mode makes rename
possible on a target file opened by another backend.Looks good. Wrote a pair of 2 liner driver programs to test. Renaming fails
when the file is open()'d, but proceeds correctly when win32_open()'d.
I've run into lots of trouble with 3rd party programs opening any files
that change on the system and locking them down. For example, real-time
virus scanners, indexing software, and some builtin Win32 service that I
haven't pinpointed yet (it runs under a generic svchost.exe on XP).
These extremely annoying programs do not play nice and use
FILE_SHARE_DELETE, at least not in my experience.
There are large threads about this problem on the Subversion mailing
list (search for 'access denied') and some mentions of it on the CVSNT
mailing list, I believe.
Subversion ended up with a looping hack for Win32, at least until
something better is found.
DJ
**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email
in error please notify the system manager.
This footnote also confirms that this email message has been
swept by MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
D.J. Heap wrote:
Claudio Natoli wrote:
Agreed, we still need dirmod.c in case someone has opened it using a
non-unix mode.
Ok. Wanted to make sure I was on the same page.
My only question was whether this new mode makes rename
possible on a target file opened by another backend.Looks good. Wrote a pair of 2 liner driver programs to test. Renaming fails
when the file is open()'d, but proceeds correctly when win32_open()'d.I've run into lots of trouble with 3rd party programs opening any files
that change on the system and locking them down. For example, real-time
virus scanners, indexing software, and some builtin Win32 service that I
haven't pinpointed yet (it runs under a generic svchost.exe on XP).
These extremely annoying programs do not play nice and use
FILE_SHARE_DELETE, at least not in my experience.There are large threads about this problem on the Subversion mailing
list (search for 'access denied') and some mentions of it on the CVSNT
mailing list, I believe.Subversion ended up with a looping hack for Win32, at least until
something better is found.
We are going to use Claudio's fix, and do looping if the rename/unlink
fails, so I think we have it covered as best we can.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Revised patch, for application to HEAD [open.c destined for src/port]
---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>
Import Notes
Resolved by subject fallback
Allow unlink/rename of files open by another process on Win32, using a
special Win32 open flag FILE_SHARE_DELETE.
Patch applied. Thanks.
---------------------------------------------------------------------------
Claudio Natoli wrote:
Revised patch, for application to HEAD [open.c destined for src/port]
--- Certain disclaimers and policies apply to all email sent from Memetrics. For the full text of these disclaimers and policies see <a href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em ailpolicy.html</a>
[ Attachment, skipping... ]
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073