mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.280 2005/01/27 03:17:17 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.281 2005/03/20 22:00:51 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -1174,12 +1174,6 @@ heap_drop_with_catalog(Oid relid)
|
||||
*/
|
||||
rel = relation_open(relid, AccessExclusiveLock);
|
||||
|
||||
/*
|
||||
* Release all buffers that belong to this relation, after writing any
|
||||
* that are dirty
|
||||
*/
|
||||
FlushRelationBuffers(rel, (BlockNumber) 0);
|
||||
|
||||
/*
|
||||
* Schedule unlinking of the relation's physical file at commit.
|
||||
*/
|
||||
@@ -1958,13 +1952,7 @@ RelationTruncateIndexes(Oid heapId)
|
||||
/* Fetch info needed for index_build */
|
||||
indexInfo = BuildIndexInfo(currentIndex);
|
||||
|
||||
/*
|
||||
* Drop any buffers associated with this index. If they're dirty,
|
||||
* they're just dropped without bothering to flush to disk.
|
||||
*/
|
||||
DropRelationBuffers(currentIndex);
|
||||
|
||||
/* Now truncate the actual data */
|
||||
/* Now truncate the actual file (and discard buffers) */
|
||||
RelationTruncate(currentIndex, 0);
|
||||
|
||||
/* Initialize the index and rebuild */
|
||||
@@ -2024,13 +2012,7 @@ heap_truncate(List *relids)
|
||||
{
|
||||
Relation rel = lfirst(cell);
|
||||
|
||||
/*
|
||||
* Release any buffers associated with this relation. If they're
|
||||
* dirty, they're just dropped without bothering to flush to disk.
|
||||
*/
|
||||
DropRelationBuffers(rel);
|
||||
|
||||
/* Now truncate the actual data */
|
||||
/* Truncate the actual file (and discard buffers) */
|
||||
RelationTruncate(rel, 0);
|
||||
|
||||
/* If this relation has indexes, truncate the indexes too */
|
||||
|
Reference in New Issue
Block a user