Rethink the way FSM truncation works. Instead of WAL-logging FSM

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 3396000684b41e7e9467d1abc67152b39e697035
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2008-11-19T10:34:52Z
Releases: 8.4.0
Rethink the way FSM truncation works. Instead of WAL-logging FSM
truncations in FSM code, call FreeSpaceMapTruncateRel from smgr_redo. To
make that cleaner from modularity point of view, move the WAL-logging one
level up to RelationTruncate, and move RelationTruncate and all the
related WAL-logging to new src/backend/catalog/storage.c file. Introduce
new RelationCreateStorage and RelationDropStorage functions that are used
instead of calling smgrcreate/smgrscheduleunlink directly. Move the
pending rel deletion stuff from smgrcreate/smgrscheduleunlink to the new
functions. This leaves smgr.c as a thin wrapper around md.c; all the
transactional stuff is now in storage.c.

This will make it easier to add new forks with similar truncation logic,
like the visibility map.

Files

PathChange+/−
src/backend/access/gin/gininsert.c modified +1 −4
src/backend/access/gin/ginvacuum.c modified +2 −2
src/backend/access/gist/gist.c modified +1 −4
src/backend/access/gist/gistvacuum.c modified +2 −2
src/backend/access/heap/heapam.c modified +2 −4
src/backend/access/nbtree/nbtree.c modified +2 −5
src/backend/access/transam/rmgr.c modified +3 −3
src/backend/access/transam/twophase.c modified +42 −31
src/backend/access/transam/xact.c modified +28 −20
src/backend/access/transam/xlogutils.c modified +2 −2
src/backend/catalog/heap.c modified +6 −21
src/backend/catalog/index.c modified +9 −33
src/backend/catalog/Makefile modified +2 −2
src/backend/catalog/storage.c added +462 −0
src/backend/commands/tablecmds.c modified +13 −8
src/backend/commands/vacuum.c modified +2 −3
src/backend/commands/vacuumlazy.c modified +2 −2
src/backend/rewrite/rewriteDefine.c modified +3 −12
src/backend/storage/buffer/bufmgr.c modified +1 −23
src/backend/storage/freespace/freespace.c modified +32 −125
src/backend/storage/freespace/indexfsm.c modified +1 −27
src/backend/storage/smgr/smgr.c modified +4 −416
src/include/access/rmgr.h modified +1 −2
src/include/access/xact.h modified +7 −7
src/include/catalog/storage.h added +39 −0
src/include/storage/bufmgr.h modified +1 −2
src/include/storage/freespace.h modified +1 −5
src/include/storage/indexfsm.h modified +1 −3
src/include/storage/relfilenode.h modified +1 −10
src/include/storage/smgr.h modified +2 −16