Remove unnecessary calls of FlushRelationBuffers: there is no need
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/nbtree/nbtree.c | modified | +1 −12 |
| src/backend/catalog/heap.c | modified | +3 −21 |
| src/backend/catalog/index.c | modified | +3 −12 |
| src/backend/commands/cluster.c | modified | +2 −17 |
| src/backend/commands/tablecmds.c | modified | +5 −6 |
| src/backend/commands/vacuum.c | modified | +5 −33 |
| src/backend/commands/vacuumlazy.c | modified | +1 −11 |
| src/backend/storage/buffer/bufmgr.c | modified | +59 −117 |
| src/backend/storage/smgr/smgr.c | modified | +11 −5 |
| src/include/storage/bufmgr.h | modified | +2 −3 |