diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/commands/vacuum.h | 4 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 13 | ||||
-rw-r--r-- | src/include/utils/rel.h | 31 |
3 files changed, 35 insertions, 13 deletions
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 6527aa72342..ef568e9dcd5 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/vacuum.h,v 1.88 2010/02/08 04:33:54 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/vacuum.h,v 1.89 2010/02/09 21:43:30 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -145,7 +145,7 @@ extern void vac_update_datfrozenxid(void); extern void vacuum_delay_point(void); /* in commands/vacuumlazy.c */ -extern bool lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, +extern void lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, BufferAccessStrategy bstrategy, bool *scanned_all); /* in commands/analyze.c */ diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index 3cf02776311..d7e267729d3 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.69 2010/01/02 16:58:08 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.70 2010/02/09 21:43:30 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -43,6 +43,17 @@ typedef struct SMgrRelationData /* pointer to owning pointer, or NULL if none */ struct SMgrRelationData **smgr_owner; + /* + * These next three fields are not actually used or manipulated by smgr, + * except that they are reset to InvalidBlockNumber upon a cache flush + * event (in particular, upon truncation of the relation). Higher levels + * store cached state here so that it will be reset when truncation + * happens. In all three cases, InvalidBlockNumber means "unknown". + */ + BlockNumber smgr_targblock; /* current insertion target block */ + BlockNumber smgr_fsm_nblocks; /* last known size of fsm fork */ + BlockNumber smgr_vm_nblocks; /* last known size of vm fork */ + /* additional public fields may someday exist here */ /* diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index c4a1fcf7b64..405ff18e0ba 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.122 2010/02/07 20:48:13 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.123 2010/02/09 21:43:30 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -125,8 +125,6 @@ typedef struct RelationData RelFileNode rd_node; /* relation physical identifier */ /* use "struct" here to avoid needing to include smgr.h: */ struct SMgrRelationData *rd_smgr; /* cached file handle, or NULL */ - BlockNumber rd_targblock; /* current insertion target block, or - * InvalidBlockNumber */ int rd_refcnt; /* reference count */ bool rd_istemp; /* rel is a temporary relation */ bool rd_islocaltemp; /* rel is a temp rel of this session */ @@ -212,13 +210,6 @@ typedef struct RelationData */ Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */ - /* - * sizes of the free space and visibility map forks, or InvalidBlockNumber - * if not known yet - */ - BlockNumber rd_fsm_nblocks; - BlockNumber rd_vm_nblocks; - /* use "struct" here to avoid needing to include pgstat.h: */ struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ } RelationData; @@ -375,6 +366,26 @@ typedef struct StdRdOptions } while (0) /* + * RelationGetTargetBlock + * Fetch relation's current insertion target block. + * + * Returns InvalidBlockNumber if there is no current target block. Note + * that the target block status is discarded on any smgr-level invalidation. + */ +#define RelationGetTargetBlock(relation) \ + ( (relation)->rd_smgr != NULL ? (relation)->rd_smgr->smgr_targblock : InvalidBlockNumber ) + +/* + * RelationSetTargetBlock + * Set relation's current insertion target block. + */ +#define RelationSetTargetBlock(relation, targblock) \ + do { \ + RelationOpenSmgr(relation); \ + (relation)->rd_smgr->smgr_targblock = (targblock); \ + } while (0) + +/* * RELATION_IS_LOCAL * If a rel is either temp or newly created in the current transaction, * it can be assumed to be visible only to the current backend. |