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/relfilenode.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/relfilenode.h')
| -rw-r--r-- | src/include/storage/relfilenode.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h index 9638294b4a4..8ac8147ed93 100644 --- a/src/include/storage/relfilenode.h +++ b/src/include/storage/relfilenode.h @@ -7,7 +7,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/relfilenode.h,v 1.15 2008/01/01 19:45:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.16 2008/08/11 11:05:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -15,8 +15,25 @@ #define RELFILENODE_H /* + * The physical storage of a relation consists of one or more forks. The + * main fork is always created, but in addition to that there can be + * additional forks for storing various metadata. ForkNumber is used when + * we need to refer to a specific fork in a relation. + */ +typedef enum ForkNumber +{ + InvalidForkNumber = -1, + MAIN_FORKNUM = 0 + /* NOTE: change NUM_FORKS below when you add new forks */ +} ForkNumber; + +#define MAX_FORKNUM MAIN_FORKNUM + +/* * RelFileNode must provide all that we need to know to physically access - * a relation. + * a relation. Note, however, that a "physical" relation is comprised of + * multiple files on the filesystem, as each fork is stored as a separate + * file, and each fork can be divided into multiple segments. See md.c. * * spcNode identifies the tablespace of the relation. It corresponds to * pg_tablespace.oid. @@ -57,4 +74,13 @@ typedef struct RelFileNode (node1).dbNode == (node2).dbNode && \ (node1).spcNode == (node2).spcNode) +/* + * RelFileFork identifies a particular fork of a relation. + */ +typedef struct RelFileFork +{ + RelFileNode rnode; + ForkNumber forknum; +} RelFileFork; + #endif /* RELFILENODE_H */ |
