diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-20 22:00:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-20 22:00:54 +0000 |
commit | 354049c709c9d7d0918272e10e4f30d7f8f38788 (patch) | |
tree | 741c359a1e6494c3ef1b205b84603fd48239b015 /src/backend/commands/cluster.c | |
parent | 683f60da3d837236de5c4249fa2a62c8a94616ca (diff) | |
download | postgresql-354049c709c9d7d0918272e10e4f30d7f8f38788.tar.gz postgresql-354049c709c9d7d0918272e10e4f30d7f8f38788.zip |
Remove unnecessary calls of FlushRelationBuffers: there is no need
to write out data that we are about to tell the filesystem to drop.
smgr_internal_unlink already had a DropRelFileNodeBuffers call to
get rid of dead buffers without a write after it's no longer possible
to roll back the deleting transaction. Adding a similar call in
smgrtruncate simplifies callers and makes the overall division of
labor clearer. This patch removes the former behavior that VACUUM
would write all dirty buffers of a relation unconditionally.
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 17fcbb3afba..e9f364fa9aa 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.132 2005/02/06 20:19:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.133 2005/03/20 22:00:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -709,8 +709,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex) void swap_relation_files(Oid r1, Oid r2) { - Relation relRelation, - rel; + Relation relRelation; HeapTuple reltup1, reltup2; Form_pg_class relform1, @@ -736,20 +735,6 @@ swap_relation_files(Oid r1, Oid r2) relform2 = (Form_pg_class) GETSTRUCT(reltup2); /* - * The buffer manager gets confused if we swap relfilenodes for - * relations that are not both local or non-local to this transaction. - * Flush the buffers on both relations so the buffer manager can - * forget about'em. (XXX this might not be necessary anymore?) - */ - rel = relation_open(r1, NoLock); - FlushRelationBuffers(rel, 0); - relation_close(rel, NoLock); - - rel = relation_open(r2, NoLock); - FlushRelationBuffers(rel, 0); - relation_close(rel, NoLock); - - /* * Actually swap the fields in the two tuples */ swaptemp = relform1->relfilenode; |