diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-08-11 11:05:11 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-08-11 11:05:11 +0000 |
commit | 3f0e808c4a487b1c12546acd80e6140d5093227b (patch) | |
tree | 2ebd25f364f751d6591ae27f18588041dec4d978 /src/backend/access/heap/heapam.c | |
parent | eca1388629facd9e65d2c7ce405e079ba2bc60c4 (diff) |
Introduce the concept of relation forks. An smgr relation can now consist
of multiple forks, and each fork can be created and grown separately.
The bulk of this patch is about changing the smgr API to include an extra
ForkNumber argument in every smgr function. Also, smgrscheduleunlink and
smgrdounlink no longer implicitly call smgrclose, because other forks might
still exist after unlinking one. The callers of those functions have been
modified to call smgrclose instead.
This patch in itself doesn't have any user-visible effect, but provides the
infrastructure needed for upcoming patches. The additional forks envisioned
are a rewritten FSM implementation that doesn't rely on a fixed-size shared
memory block, and a visibility map to allow skipping portions of a table in
VACUUM that have no dead tuples.
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index cb2f428afe6..6d3528323bf 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.261 2008/07/13 20:45:47 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.262 2008/08/11 11:05:10 heikki Exp $ * * * INTERFACE ROUTINES @@ -3906,7 +3906,8 @@ log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from, * not do anything that assumes we are touching a heap. */ XLogRecPtr -log_newpage(RelFileNode *rnode, BlockNumber blkno, Page page) +log_newpage(RelFileNode *rnode, ForkNumber forkNum, BlockNumber blkno, + Page page) { xl_heap_newpage xlrec; XLogRecPtr recptr; @@ -3916,6 +3917,7 @@ log_newpage(RelFileNode *rnode, BlockNumber blkno, Page page) START_CRIT_SECTION(); xlrec.node = *rnode; + xlrec.forknum = forkNum; xlrec.blkno = blkno; rdata[0].data = (char *) &xlrec; @@ -4714,7 +4716,7 @@ heap_sync(Relation rel) /* main heap */ FlushRelationBuffers(rel); /* FlushRelationBuffers will have opened rd_smgr */ - smgrimmedsync(rel->rd_smgr); + smgrimmedsync(rel->rd_smgr, MAIN_FORKNUM); /* toast heap, if any */ if (OidIsValid(rel->rd_rel->reltoastrelid)) @@ -4723,7 +4725,7 @@ heap_sync(Relation rel) toastrel = heap_open(rel->rd_rel->reltoastrelid, AccessShareLock); FlushRelationBuffers(toastrel); - smgrimmedsync(toastrel->rd_smgr); + smgrimmedsync(toastrel->rd_smgr, MAIN_FORKNUM); heap_close(toastrel, AccessShareLock); } } |