rename/unlink handling for Win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: rename/unlink handling for Win32
Date: 2003-04-20 02:39:49
Message-ID: 200304200239.h3K2dnO24218@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Here is my approach to the use of rename/unlink on Win32. The full
discussion is at:

http://momjian.postgresql.org/cgi-bin/pgtodo?win32

Basically, rename/unlink will fail if the file is opened. You can move
the open file to another name, but that then requires open to loop in
case the file is missing.

The following patch loops over rename/unlink every 1/10th of second,
printing a warning message after 1 second, and printing a completion
message if a warning message was printed.

I looked at PeerDirect's and SRA's port, and neither provides a better
method. I looked at PeerDirect's and it actually has some conditional
code for rename. For example, it has a signal that is sent to all
backends to inform them to close their open WAL files. I am not sure if
that is required for us because there is some replication stuff in
there that we aren't using. Jan? In a few other places, it allows the
rename to fail.

I am inclined to implement it as shown, then see what delayed
rename/unlinks we get in testing.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.8 KB
unknown_filename text/plain 2.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-04-20 02:47:38 Re: rename/unlink handling for Win32
Previous Message You Lun 2003-04-19 22:35:37 Priority queue of tuples in PostgreSQL source code.

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-04-20 02:47:38 Re: rename/unlink handling for Win32
Previous Message Nic Ferrier 2003-04-19 21:13:18 build patch