Split fd.c into multiple source files - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Split fd.c into multiple source files
Date
Msg-id a5c1dc64-16e9-484a-9659-58793c6ef7ea@iki.fi
Whole thread
List pgsql-hackers
Hi,

I'd like to split fd.c into multiple source files. It's currently a mix 
of a few different things:

- the Virtual File Descriptor abstraction
- misc portability and utility functions, some of which have frontend 
counterparts in common/file_utils.c
- temporary file management stuff

I think it'd be good for readability to split it up. But the reason I'm 
thinking about this right now is that for multithreading, I think the 
Virtual File Descriptor abstraction needs changes. Before starting to 
mess with that, it'd be nice to isolate it from the rest of the stuff 
that's in fd.c now.

Attached patch set splits fd.c into:

- fd.c, containing the Virtual File Descriptor abstraction, i.e. 
functions that operate on 'File's
- file_utils.c, containing portability and utility functions like 
pg_fsync() and durable_rename()
- datadir.c, containing functions for creating/deleting directories 
(e.g. MakePGDirectory)
- tempfile.c, containing functions for creating temporary files, e.g. 
PathNameCreateTemporaryFile and all the temp tablespace stuff.


Patch 0001 is a little different in that it doesn't just move code 
around. It removes the check at end-of-xact to check that no xact-scoped 
temporary files are still open. It's been merely a redundant debugging 
cross-check since commit ab3148b712 in 2009, when we started to track 
temporary files with ResourceOwners. Let's just rely on ResourceOwners 
and remove that. There's no immediate need to do this right now, but 
simpler is better, and I don't remember that cross-check ever finding 
anything useful.

- Heikki

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: GIN index fast list search may become un-interruptible for long time.
Next
From: Tom Lane
Date:
Subject: Re: Improving display of octal GUCs