pgsql: Rethink the way FSM truncation works.

From: heikki(at)postgresql(dot)org (Heikki Linnakangas)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Rethink the way FSM truncation works.
Date: 2008-11-19 10:34:53
Message-ID: 20081119103453.1919C7545A4@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/access/gin:
gininsert.c (r1.16 -> r1.17)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/gin/gininsert.c?r1=1.16&r2=1.17)
ginvacuum.c (r1.25 -> r1.26)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/gin/ginvacuum.c?r1=1.25&r2=1.26)
pgsql/src/backend/access/gist:
gist.c (r1.154 -> r1.155)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/gist/gist.c?r1=1.154&r2=1.155)
gistvacuum.c (r1.40 -> r1.41)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/gist/gistvacuum.c?r1=1.40&r2=1.41)
pgsql/src/backend/access/heap:
heapam.c (r1.269 -> r1.270)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c?r1=1.269&r2=1.270)
pgsql/src/backend/access/nbtree:
nbtree.c (r1.165 -> r1.166)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtree.c?r1=1.165&r2=1.166)
pgsql/src/backend/access/transam:
rmgr.c (r1.26 -> r1.27)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/rmgr.c?r1=1.26&r2=1.27)
twophase.c (r1.47 -> r1.48)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/twophase.c?r1=1.47&r2=1.48)
xact.c (r1.268 -> r1.269)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xact.c?r1=1.268&r2=1.269)
xlogutils.c (r1.62 -> r1.63)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xlogutils.c?r1=1.62&r2=1.63)
pgsql/src/backend/catalog:
Makefile (r1.66 -> r1.67)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/Makefile?r1=1.66&r2=1.67)
heap.c (r1.344 -> r1.345)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/heap.c?r1=1.344&r2=1.345)
index.c (r1.309 -> r1.310)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/index.c?r1=1.309&r2=1.310)
pgsql/src/backend/commands:
tablecmds.c (r1.270 -> r1.271)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.270&r2=1.271)
vacuum.c (r1.380 -> r1.381)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c?r1=1.380&r2=1.381)
vacuumlazy.c (r1.110 -> r1.111)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuumlazy.c?r1=1.110&r2=1.111)
pgsql/src/backend/rewrite:
rewriteDefine.c (r1.132 -> r1.133)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteDefine.c?r1=1.132&r2=1.133)
pgsql/src/backend/storage/buffer:
bufmgr.c (r1.241 -> r1.242)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/buffer/bufmgr.c?r1=1.241&r2=1.242)
pgsql/src/backend/storage/freespace:
freespace.c (r1.66 -> r1.67)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/freespace/freespace.c?r1=1.66&r2=1.67)
indexfsm.c (r1.2 -> r1.3)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/freespace/indexfsm.c?r1=1.2&r2=1.3)
pgsql/src/backend/storage/smgr:
smgr.c (r1.113 -> r1.114)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/smgr/smgr.c?r1=1.113&r2=1.114)
pgsql/src/include/access:
rmgr.h (r1.18 -> r1.19)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/access/rmgr.h?r1=1.18&r2=1.19)
xact.h (r1.95 -> r1.96)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/access/xact.h?r1=1.95&r2=1.96)
pgsql/src/include/storage:
bufmgr.h (r1.117 -> r1.118)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/bufmgr.h?r1=1.117&r2=1.118)
freespace.h (r1.30 -> r1.31)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/freespace.h?r1=1.30&r2=1.31)
indexfsm.h (r1.2 -> r1.3)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/indexfsm.h?r1=1.2&r2=1.3)
relfilenode.h (r1.19 -> r1.20)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/relfilenode.h?r1=1.19&r2=1.20)
smgr.h (r1.63 -> r1.64)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/smgr.h?r1=1.63&r2=1.64)

Added Files:
-----------
pgsql/src/backend/catalog:
storage.c (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/storage.c?rev=1.1&content-type=text/x-cvsweb-markup)
pgsql/src/include/catalog:
storage.h (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/storage.h?rev=1.1&content-type=text/x-cvsweb-markup)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message User Mkz 2008-11-19 11:27:33 plproxy - plproxy: If query is canceled by user, send cancel request to
Previous Message Teodor Sigaev 2008-11-19 10:23:21 pgsql: Fix compiler warning "res may be used uninitialized in this

Browse pgsql-hackers by date

  From Date Subject
Next Message Rushabh Lathia 2008-11-19 10:56:44 Problem with Bitmap Heap Scan
Previous Message Teodor Sigaev 2008-11-19 10:24:39 Re: Re: Replace plain-memory ordered array by binary tree in ts_stat() function.