]> granicus.if.org Git - postgresql/commit
Repair a bunch of problems in md.c. This builds on Hiroshi's
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Sep 1999 02:57:50 +0000 (02:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Sep 1999 02:57:50 +0000 (02:57 +0000)
commit68c323483c36b351883899c35a68c7bf496c0d4b
treedc79afde89a3ff7c867de1117dc7860d7e0224b0
parent4478d299e187500ad64fc990fa09c0c3728ffd63
Repair a bunch of problems in md.c.  This builds on Hiroshi's
insight that RelationFlushRelation ought to invoke smgrclose, and that the
way to make that work is to ensure that mdclose doesn't fail if the relation
is already closed (or unlinked, if we are looking at a DROP TABLE).  While
I was testing that, I was able to identify several problems that we had
with multiple-segment relations.  The system is now able to do initdb and
pass the regression tests with a very small segment size (I had it set to
64Kb per segment for testing).  I don't believe that ever worked before.
File descriptor leaks seem to be gone too.
I have partially addressed the concerns we had about mdtruncate(), too.
On a Win32 or NFS filesystem it is not possible to unlink a file that
another backend is holding open, so what md.c now does is to truncate
unwanted files to zero length before trying to unlink them.  The other
backends will be forced to close their open files by relation cache
invalidation --- but I think it would take considerable work to make
that happen before vacuum truncates the relation rather than after.
Leaving zero-length files lying around seems a usable compromise.
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/backend/utils/cache/relcache.c