diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-02 02:57:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-02 02:57:50 +0000 |
commit | 68c323483c36b351883899c35a68c7bf496c0d4b (patch) | |
tree | dc79afde89a3ff7c867de1117dc7860d7e0224b0 /src/backend/storage/smgr/smgr.c | |
parent | 4478d299e187500ad64fc990fa09c0c3728ffd63 (diff) |
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.
Diffstat (limited to 'src/backend/storage/smgr/smgr.c')
-rw-r--r-- | src/backend/storage/smgr/smgr.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index ef2818e16ec..a1c86a60d33 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.28 1999/07/17 20:17:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.29 1999/09/02 02:57:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -191,13 +191,12 @@ smgropen(int16 which, Relation reln) /* * smgrclose() -- Close a relation. * - * NOTE: mdclose frees fd vector! It may be re-used for other relation! - * reln should be flushed from cache after closing !.. - * Currently, smgrclose is calling by - * relcache.c:RelationPurgeLocalRelation() only. - * It would be nice to have smgrfree(), but because of - * smgrclose is called from single place... - vadim 05/22/97 - * + * NOTE: underlying manager should allow case where relation is + * already closed. Indeed relation may have been unlinked! + * This is currently called only from RelationFlushRelation() when + * the relation cache entry is about to be dropped; could be doing + * simple relation cache clear, or finishing up DROP TABLE. + * * Returns SM_SUCCESS on success, aborts on failure. */ int |