diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/vacuum.h | 7 | ||||
| -rw-r--r-- | src/include/storage/freespace.h | 53 | ||||
| -rw-r--r-- | src/include/storage/ipc.h | 3 | ||||
| -rw-r--r-- | src/include/storage/lock.h | 17 | ||||
| -rw-r--r-- | src/include/storage/smgr.h | 15 | ||||
| -rw-r--r-- | src/include/utils/rel.h | 13 |
6 files changed, 79 insertions, 29 deletions
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 87bb0007aa0..0d9f66d04b3 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: vacuum.h,v 1.35 2001/05/07 00:43:25 tgl Exp $ + * $Id: vacuum.h,v 1.36 2001/06/27 23:31:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -15,11 +15,14 @@ #define VACUUM_H #include "nodes/parsenodes.h" +#include "storage/block.h" /* in commands/vacuum.c */ extern void vacuum(VacuumStmt *vacstmt); -extern void vac_update_relstats(Oid relid, long num_pages, double num_tuples, +extern void vac_update_relstats(Oid relid, + BlockNumber num_pages, + double num_tuples, bool hasindex); /* in commands/analyze.c */ extern void analyze_rel(Oid relid, VacuumStmt *vacstmt); diff --git a/src/include/storage/freespace.h b/src/include/storage/freespace.h new file mode 100644 index 00000000000..083accccab8 --- /dev/null +++ b/src/include/storage/freespace.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * freespace.h + * POSTGRES free space map for quickly finding free space in relations + * + * + * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id: freespace.h,v 1.1 2001/06/27 23:31:39 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef FREESPACE_H_ +#define FREESPACE_H_ + +#include "storage/block.h" +#include "storage/relfilenode.h" +#include "storage/spin.h" + + +extern SPINLOCK FreeSpaceLock; + +extern int MaxFSMRelations; +extern int MaxFSMPages; + + +/* + * function prototypes + */ +extern void InitFreeSpaceMap(void); +extern int FreeSpaceShmemSize(void); + +extern BlockNumber GetPageWithFreeSpace(RelFileNode *rel, Size spaceNeeded); +extern void RecordFreeSpace(RelFileNode *rel, BlockNumber page, + Size spaceAvail); +extern BlockNumber RecordAndGetPageWithFreeSpace(RelFileNode *rel, + BlockNumber oldPage, + Size oldSpaceAvail, + Size spaceNeeded); +extern void MultiRecordFreeSpace(RelFileNode *rel, + BlockNumber minPage, + BlockNumber maxPage, + int nPages, + BlockNumber *pages, + Size *spaceAvail); +extern void FreeSpaceMapForgetRel(RelFileNode *rel); + +#ifdef FREESPACE_DEBUG +extern void DumpFreeSpace(void); +#endif + +#endif /* FREESPACE_H */ diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index aa685fc8ff6..8ce1a845930 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: ipc.h,v 1.49 2001/03/22 04:01:05 momjian Exp $ + * $Id: ipc.h,v 1.50 2001/06/27 23:31:39 tgl Exp $ * * Some files that would normally need to include only sys/ipc.h must * instead include this file because on Ultrix, sys/ipc.h is not designed @@ -74,6 +74,7 @@ typedef enum _LockId_ LOCKMGRLOCKID, SINVALLOCKID, PROCSTRUCTLOCKID, + FREESPACELOCKID, #ifdef STABLE_MEMORY_STORAGE MMCACHELOCKID, diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 2428a782a67..30a13649e43 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.49 2001/06/22 00:04:59 tgl Exp $ + * $Id: lock.h,v 1.50 2001/06/27 23:31:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,8 @@ typedef struct proc PROC; extern SPINLOCK LockMgrLock; +extern int max_locks_per_xact; + #ifdef LOCK_DEBUG extern int Trace_lock_oidmin; extern bool Trace_locks; @@ -41,19 +43,6 @@ extern bool Debug_deadlocks; #endif /* LOCK_DEBUG */ -/* ---------------------- - * The following defines are used to estimate how much shared - * memory the lock manager is going to require. - * See LockShmemSize() in lock.c. - * - * NLOCKS_PER_XACT - The number of unique objects locked in a transaction - * (this should be configurable!) - * NLOCKENTS - The maximum number of lock entries in the lock table. - * ---------------------- - */ -#define NLOCKS_PER_XACT 64 -#define NLOCKENTS(maxBackends) (NLOCKS_PER_XACT*(maxBackends)) - typedef int LOCKMASK; typedef int LOCKMODE; diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index b6c5af72dec..b4193b5fa82 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: smgr.h,v 1.29 2001/05/10 20:38:49 tgl Exp $ + * $Id: smgr.h,v 1.30 2001/06/27 23:31:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -43,8 +43,9 @@ extern int smgrblindwrt(int16 which, RelFileNode rnode, extern int smgrblindmarkdirty(int16 which, RelFileNode rnode, BlockNumber blkno); extern int smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno); -extern int smgrnblocks(int16 which, Relation reln); -extern int smgrtruncate(int16 which, Relation reln, int nblocks); +extern BlockNumber smgrnblocks(int16 which, Relation reln); +extern BlockNumber smgrtruncate(int16 which, Relation reln, + BlockNumber nblocks); extern int smgrDoPendingDeletes(bool isCommit); extern int smgrcommit(void); extern int smgrabort(void); @@ -71,8 +72,8 @@ extern int mdmarkdirty(Relation reln, BlockNumber blkno); extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno, char *buffer, bool dofsync); extern int mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno); -extern int mdnblocks(Relation reln); -extern int mdtruncate(Relation reln, int nblocks); +extern BlockNumber mdnblocks(Relation reln); +extern BlockNumber mdtruncate(Relation reln, BlockNumber nblocks); extern int mdcommit(void); extern int mdabort(void); extern int mdsync(void); @@ -95,8 +96,8 @@ extern int mmblindwrt(char *dbname, char *relname, Oid dbid, Oid relid, extern int mmmarkdirty(Relation reln, BlockNumber blkno); extern int mmblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, BlockNumber blkno); -extern int mmnblocks(Relation reln); -extern int mmtruncate(Relation reln, int nblocks); +extern BlockNumber mmnblocks(Relation reln); +extern BlockNumber mmtruncate(Relation reln, BlockNumber nblocks); extern int mmcommit(void); extern int mmabort(void); diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index c2a9d0982f7..ef74317fda5 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: rel.h,v 1.50 2001/06/22 19:16:24 wieck Exp $ + * $Id: rel.h,v 1.51 2001/06/27 23:31:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,8 +19,9 @@ #include "catalog/pg_am.h" #include "catalog/pg_class.h" #include "rewrite/prs2lock.h" -#include "storage/relfilenode.h" +#include "storage/block.h" #include "storage/fd.h" +#include "storage/relfilenode.h" /* added to prevent circular dependency. bjm 1999/11/15 */ extern char *get_temp_rel_by_physicalname(const char *relname); @@ -105,9 +106,11 @@ typedef struct PgStat_Info typedef struct RelationData { File rd_fd; /* open file descriptor, or -1 if none */ - RelFileNode rd_node; /* relation file node */ - int rd_nblocks; /* number of blocks in rel */ - uint16 rd_refcnt; /* reference count */ + RelFileNode rd_node; /* file node (physical identifier) */ + BlockNumber rd_nblocks; /* number of blocks in rel */ + BlockNumber rd_targblock; /* current insertion target block, + * or InvalidBlockNumber */ + int rd_refcnt; /* reference count */ bool rd_myxactonly; /* rel uses the local buffer mgr */ bool rd_isnailed; /* rel is nailed in cache */ bool rd_indexfound; /* true if rd_indexlist is valid */ |
