diff options
| author | Heikki Linnakangas | 2008-08-11 11:05:11 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2008-08-11 11:05:11 +0000 |
| commit | 3f0e808c4a487b1c12546acd80e6140d5093227b (patch) | |
| tree | 2ebd25f364f751d6591ae27f18588041dec4d978 /src/include/storage/buf_internals.h | |
| 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/include/storage/buf_internals.h')
| -rw-r--r-- | src/include/storage/buf_internals.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 589baa0a7e5..a8861d29a8e 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.97 2008/06/19 00:46:06 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.98 2008/08/11 11:05:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -65,6 +65,7 @@ typedef bits16 BufFlags; typedef struct buftag { RelFileNode rnode; /* physical relation identifier */ + ForkNumber forkNum; BlockNumber blockNum; /* blknum relative to begin of reln */ } BufferTag; @@ -73,19 +74,22 @@ typedef struct buftag (a).rnode.spcNode = InvalidOid, \ (a).rnode.dbNode = InvalidOid, \ (a).rnode.relNode = InvalidOid, \ + (a).forkNum = InvalidForkNumber, \ (a).blockNum = InvalidBlockNumber \ ) -#define INIT_BUFFERTAG(a,xx_rnode,xx_blockNum) \ +#define INIT_BUFFERTAG(a,xx_rnode,xx_forkNum,xx_blockNum) \ ( \ (a).rnode = (xx_rnode), \ + (a).forkNum = (xx_forkNum), \ (a).blockNum = (xx_blockNum) \ ) #define BUFFERTAGS_EQUAL(a,b) \ ( \ RelFileNodeEquals((a).rnode, (b).rnode) && \ - (a).blockNum == (b).blockNum \ + (a).blockNum == (b).blockNum && \ + (a).forkNum == (b).forkNum \ ) /* @@ -202,10 +206,10 @@ extern int BufTableInsert(BufferTag *tagPtr, uint32 hashcode, int buf_id); extern void BufTableDelete(BufferTag *tagPtr, uint32 hashcode); /* localbuf.c */ -extern BufferDesc *LocalBufferAlloc(SMgrRelation reln, BlockNumber blockNum, - bool *foundPtr); +extern BufferDesc *LocalBufferAlloc(SMgrRelation reln, ForkNumber forkNum, + BlockNumber blockNum, bool *foundPtr); extern void MarkLocalBufferDirty(Buffer buffer); -extern void DropRelFileNodeLocalBuffers(RelFileNode rnode, +extern void DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum, BlockNumber firstDelBlock); extern void AtEOXact_LocalBuffers(bool isCommit); |
