Skip site navigation (1) Skip section navigation (2)

Re: rmtree() failure on Windows

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Reini Urban <rurban(at)x-ray(dot)at>,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rmtree() failure on Windows
Date: 2004-10-27 15:42:32
Message-ID: 417FC1E8.4010102@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches

Tom Lane wrote:

>Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>  
>
>>Before I tried anything like that I tried one more thing. I disabled the 
>>background writer and the problem stopped. So now we know the "culprit".
>>    
>>
>
>Okay.  So what that says is that win32_open's claim to allow unlinking
>an open file is a lie; or at least, it does not work the way the
>equivalent facility on Unix does.  It sounds to me like Windows is
>simply marking the open file as to be deleted on last close --- the
>directory entry remains present and so the directory can't be dropped
>either.
>  
>

Looks that way to me too.

>One relatively low-impact workaround would be to force a checkpoint
>(on Windows only) during DROP DATABASE, just before we actually fire
>the rmtree() operation.  The bgwriter is already coded to close all its
>open files after a checkpoint ...
>
>
>  
>

Works for me. If someone gives me a patch I'll be happy to test it.

I did wonder if there should be a call that instead of forcing a flush 
could tell bgwriter just to forget about the file(s) because we're 
discarding them. But that was just idle speculation - I haven't looked 
at bgwriter at all.

cheers

andrew

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2004-10-27 15:43:39
Subject: Re: rmtree() failure on Windows
Previous:From: Tom LaneDate: 2004-10-27 15:23:00
Subject: Re: rmtree() failure on Windows

pgsql-patches by date

Next:From: Devrim GUNDUZDate: 2004-10-27 15:57:00
Subject: Updated Turkish translations
Previous:From: Tom LaneDate: 2004-10-27 15:23:00
Subject: Re: rmtree() failure on Windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group