aboutsummaryrefslogtreecommitdiff
path: root/src/include/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/storage')
-rw-r--r--src/include/storage/buf_internals.h66
-rw-r--r--src/include/storage/bufmgr.h4
-rw-r--r--src/include/storage/fd.h4
-rw-r--r--src/include/storage/ipc.h10
-rw-r--r--src/include/storage/lock.h34
-rw-r--r--src/include/storage/proc.h23
-rw-r--r--src/include/storage/relfilenode.h6
-rw-r--r--src/include/storage/sinval.h8
-rw-r--r--src/include/storage/smgr.h18
9 files changed, 91 insertions, 82 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index f83ad939c45..355859faa3b 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -2,13 +2,13 @@
*
* buf_internals.h
* Internal definitions for buffer manager and the buffer replacement
- * strategy.
+ * strategy.
*
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.72 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.73 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,12 +24,15 @@
/*
* Flags for buffer descriptors
*/
-#define BM_DIRTY (1 << 0) /* data needs writing */
-#define BM_VALID (1 << 1) /* data is valid */
-#define BM_IO_IN_PROGRESS (1 << 2) /* read or write in progress */
-#define BM_IO_ERROR (1 << 3) /* previous I/O failed */
-#define BM_JUST_DIRTIED (1 << 4) /* dirtied since write started */
-#define BM_PIN_COUNT_WAITER (1 << 5) /* have waiter for sole pin */
+#define BM_DIRTY (1 << 0) /* data needs writing */
+#define BM_VALID (1 << 1) /* data is valid */
+#define BM_IO_IN_PROGRESS (1 << 2) /* read or write in
+ * progress */
+#define BM_IO_ERROR (1 << 3) /* previous I/O failed */
+#define BM_JUST_DIRTIED (1 << 4) /* dirtied since write
+ * started */
+#define BM_PIN_COUNT_WAITER (1 << 5) /* have waiter for sole
+ * pin */
typedef bits16 BufFlags;
@@ -137,13 +140,13 @@ typedef struct
*/
typedef struct
{
- int prev; /* list links */
- int next;
- short list; /* ID of list it is currently in */
- bool t1_vacuum; /* t => present only because of VACUUM */
- TransactionId t1_xid; /* the xid this entry went onto T1 */
- BufferTag buf_tag; /* page identifier */
- int buf_id; /* currently assigned data buffer, or -1 */
+ int prev; /* list links */
+ int next;
+ short list; /* ID of list it is currently in */
+ bool t1_vacuum; /* t => present only because of VACUUM */
+ TransactionId t1_xid; /* the xid this entry went onto T1 */
+ BufferTag buf_tag; /* page identifier */
+ int buf_id; /* currently assigned data buffer, or -1 */
} BufferStrategyCDB;
/*
@@ -151,22 +154,23 @@ typedef struct
*/
typedef struct
{
- int target_T1_size; /* What T1 size are we aiming for */
- int listUnusedCDB; /* All unused StrategyCDB */
- int listHead[STRAT_NUM_LISTS]; /* ARC lists B1, T1, T2 and B2 */
- int listTail[STRAT_NUM_LISTS];
- int listSize[STRAT_NUM_LISTS];
- Buffer listFreeBuffers; /* List of unused buffers */
-
- long num_lookup; /* Some hit statistics */
- long num_hit[STRAT_NUM_LISTS];
- time_t stat_report;
+ int target_T1_size; /* What T1 size are we aiming for */
+ int listUnusedCDB; /* All unused StrategyCDB */
+ int listHead[STRAT_NUM_LISTS]; /* ARC lists B1, T1, T2
+ * and B2 */
+ int listTail[STRAT_NUM_LISTS];
+ int listSize[STRAT_NUM_LISTS];
+ Buffer listFreeBuffers; /* List of unused buffers */
+
+ long num_lookup; /* Some hit statistics */
+ long num_hit[STRAT_NUM_LISTS];
+ time_t stat_report;
/* Array of CDB's starts here */
- BufferStrategyCDB cdb[1]; /* VARIABLE SIZE ARRAY */
+ BufferStrategyCDB cdb[1]; /* VARIABLE SIZE ARRAY */
} BufferStrategyControl;
-
+
/* counters in buf_init.c */
extern long int ReadBufferCount;
extern long int ReadLocalBufferCount;
@@ -184,19 +188,19 @@ extern long int LocalBufferFlushCount;
/* freelist.c */
extern BufferDesc *StrategyBufferLookup(BufferTag *tagPtr, bool recheck,
- int *cdb_found_index);
+ int *cdb_found_index);
extern BufferDesc *StrategyGetBuffer(int *cdb_replace_index);
extern void StrategyReplaceBuffer(BufferDesc *buf, BufferTag *newTag,
- int cdb_found_index, int cdb_replace_index);
+ int cdb_found_index, int cdb_replace_index);
extern void StrategyInvalidateBuffer(BufferDesc *buf);
extern void StrategyHintVacuum(bool vacuum_active);
extern int StrategyDirtyBufferList(BufferDesc **buffers, BufferTag *buftags,
- int max_buffers);
+ int max_buffers);
extern void StrategyInitialize(bool init);
/* buf_table.c */
extern void InitBufTable(int size);
-extern int BufTableLookup(BufferTag *tagPtr);
+extern int BufTableLookup(BufferTag *tagPtr);
extern void BufTableInsert(BufferTag *tagPtr, int cdb_id);
extern void BufTableDelete(BufferTag *tagPtr);
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 704efac27d9..cb8feda8bdf 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.85 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.86 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -131,7 +131,7 @@ extern void RelationTruncate(Relation rel, BlockNumber nblocks);
extern void FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock);
extern void DropRelationBuffers(Relation rel);
extern void DropRelFileNodeBuffers(RelFileNode rnode, bool istemp,
- BlockNumber firstDelBlock);
+ BlockNumber firstDelBlock);
extern void DropBuffers(Oid dbid);
#ifdef NOT_USED
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h
index 6eac14344a9..11ce7f1112b 100644
--- a/src/include/storage/fd.h
+++ b/src/include/storage/fd.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.47 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.48 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,7 +86,7 @@ extern void set_max_safe_fds(void);
extern void closeAllVfds(void);
extern void AtEOXact_Files(void);
extern void AtEOSubXact_Files(bool isCommit, TransactionId myXid,
- TransactionId parentXid);
+ TransactionId parentXid);
extern void RemovePgTempFiles(void);
extern int pg_fsync(int fd);
extern int pg_fdatasync(int fd);
diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h
index 95259b97b0a..1920dd688e3 100644
--- a/src/include/storage/ipc.h
+++ b/src/include/storage/ipc.h
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.67 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.68 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,13 +30,13 @@ extern void on_exit_reset(void);
/* ipci.c */
extern void CreateSharedMemoryAndSemaphores(bool makePrivate,
- int maxBackends,
- int port);
+ int maxBackends,
+ int port);
#ifdef EXEC_BACKEND
/* postmaster.c */
-extern size_t ShmemBackendArraySize(void);
-extern void ShmemBackendArrayAllocation(void);
+extern size_t ShmemBackendArraySize(void);
+extern void ShmemBackendArrayAllocation(void);
#endif
#endif /* IPC_H */
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index bd6f7783989..277efa70f0e 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.82 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.83 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,6 +48,7 @@ extern bool Debug_deadlocks;
*/
typedef int LOCKMASK;
typedef int LOCKMODE;
+
/* MAX_LOCKMODES cannot be larger than the # of bits in LOCKMASK */
#define MAX_LOCKMODES 10
@@ -60,6 +61,7 @@ typedef int LOCKMODE;
* Lock methods are identified by LOCKMETHODID.
*/
typedef uint16 LOCKMETHODID;
+
/* MAX_LOCK_METHODS is the number of distinct lock control tables allowed */
#define MAX_LOCK_METHODS 3
@@ -69,12 +71,12 @@ typedef uint16 LOCKMETHODID;
#define LockMethodIsValid(lockmethodid) ((lockmethodid) != INVALID_LOCKMETHOD)
-extern int NumLockMethods;
+extern int NumLockMethods;
/*
* This is the control structure for a lock table. It lives in shared
- * memory. Currently, none of these fields change after startup. In addition
+ * memory. Currently, none of these fields change after startup. In addition
* to the LockMethodData, a lock table has a shared "lockHash" table holding
* per-locked-object lock information, and a shared "proclockHash" table
* holding per-lock-holder/waiter lock information.
@@ -90,9 +92,9 @@ extern int NumLockMethods;
*/
typedef struct LockMethodData
{
- LWLockId masterLock;
- int numLockModes;
- LOCKMASK conflictTab[MAX_LOCKMODES];
+ LWLockId masterLock;
+ int numLockModes;
+ LOCKMASK conflictTab[MAX_LOCKMODES];
} LockMethodData;
typedef LockMethodData *LockMethod;
@@ -114,12 +116,12 @@ typedef struct LOCKTAG
/*
* offnum should be part of objId union above, but doing that would
- * increase sizeof(LOCKTAG) due to padding. Currently used by userlocks
- * only.
+ * increase sizeof(LOCKTAG) due to padding. Currently used by
+ * userlocks only.
*/
OffsetNumber offnum;
- LOCKMETHODID lockmethodid; /* needed by userlocks */
+ LOCKMETHODID lockmethodid; /* needed by userlocks */
} LOCKTAG;
@@ -174,7 +176,7 @@ typedef struct LOCK
*
* Currently, session proclocks are used for user locks and for cross-xact
* locks obtained for VACUUM. Note that a single backend can hold locks
- * under several different XIDs at once (including session locks). We treat
+ * under several different XIDs at once (including session locks). We treat
* such locks as never conflicting (a backend can never block itself).
*
* The holdMask field shows the already-granted locks represented by this
@@ -213,7 +215,7 @@ typedef struct PROCLOCK
/*
* Each backend also maintains a local hash table with information about each
- * lock it is currently interested in. In particular the local table counts
+ * lock it is currently interested in. In particular the local table counts
* the number of times that lock has been acquired. This allows multiple
* requests for the same lock to be executed without additional accesses to
* shared memory. We also track the number of lock acquisitions per
@@ -230,8 +232,8 @@ typedef struct LOCALLOCKTAG
typedef struct LOCALLOCKOWNER
{
/*
- * Note: owner can be NULL to indicate a non-transactional lock.
- * Must use a forward struct reference to avoid circularity.
+ * Note: owner can be NULL to indicate a non-transactional lock. Must
+ * use a forward struct reference to avoid circularity.
*/
struct ResourceOwnerData *owner;
int nLocks; /* # of times held by this owner */
@@ -248,7 +250,7 @@ typedef struct LOCALLOCK
int nLocks; /* total number of times lock is held */
int numLockOwners; /* # of relevant ResourceOwners */
int maxLockOwners; /* allocated size of array */
- LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */
+ LOCALLOCKOWNER *lockOwners; /* dynamically resizable array */
} LOCALLOCK;
#define LOCALLOCK_LOCKMETHOD(llock) ((llock).tag.lock.lockmethodid)
@@ -278,8 +280,8 @@ typedef struct
extern void InitLocks(void);
extern LockMethod GetLocksMethodTable(LOCK *lock);
extern LOCKMETHODID LockMethodTableInit(const char *tabName,
- const LOCKMASK *conflictsP,
- int numModes, int maxBackends);
+ const LOCKMASK *conflictsP,
+ int numModes, int maxBackends);
extern LOCKMETHODID LockMethodTableRename(LOCKMETHODID lockmethodid);
extern bool LockAcquire(LOCKMETHODID lockmethodid, LOCKTAG *locktag,
TransactionId xid, LOCKMODE lockmode, bool dontWait);
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index aa9d6d73aa4..4cff8d24320 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.74 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.75 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,7 +22,7 @@
/*
* Each backend advertises up to PGPROC_MAX_CACHED_SUBXIDS TransactionIds
- * for non-aborted subtransactions of its current top transaction. These
+ * for non-aborted subtransactions of its current top transaction. These
* have to be treated as running XIDs by other backends.
*
* We also keep track of whether the cache overflowed (ie, the transaction has
@@ -31,12 +31,13 @@
* listed anywhere in the PGPROC array is not a running transaction. Else we
* have to look at pg_subtrans.
*/
-#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */
+#define PGPROC_MAX_CACHED_SUBXIDS 64 /* XXX guessed-at value */
-struct XidCache {
- bool overflowed;
- int nxids;
- TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS];
+struct XidCache
+{
+ bool overflowed;
+ int nxids;
+ TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS];
};
/*
@@ -88,7 +89,7 @@ struct PGPROC
SHM_QUEUE procLocks; /* list of PROCLOCK objects for locks held
* or awaited by this backend */
- struct XidCache subxids; /* cache for subtransaction XIDs */
+ struct XidCache subxids; /* cache for subtransaction XIDs */
};
/* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */
@@ -107,9 +108,9 @@ typedef struct PROC_HDR
} PROC_HDR;
-#define DUMMY_PROC_DEFAULT 0
-#define DUMMY_PROC_BGWRITER 1
-#define NUM_DUMMY_PROCS 2
+#define DUMMY_PROC_DEFAULT 0
+#define DUMMY_PROC_BGWRITER 1
+#define NUM_DUMMY_PROCS 2
/* configurable options */
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h
index 8ac3fa3a2fb..adbff149f20 100644
--- a/src/include/storage/relfilenode.h
+++ b/src/include/storage/relfilenode.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.10 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.11 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,7 +21,7 @@
* spcNode identifies the tablespace of the relation. It corresponds to
* pg_tablespace.oid.
*
- * dbNode identifies the database of the relation. It is zero for
+ * dbNode identifies the database of the relation. It is zero for
* "shared" relations (those common to all databases of a cluster).
* Nonzero dbNode values correspond to pg_database.oid.
*
@@ -57,4 +57,4 @@ typedef struct RelFileNode
(node1).dbNode == (node2).dbNode && \
(node1).spcNode == (node2).spcNode)
-#endif /* RELFILENODE_H */
+#endif /* RELFILENODE_H */
diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h
index ae55f2c7281..9d0a9513445 100644
--- a/src/include/storage/sinval.h
+++ b/src/include/storage/sinval.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/sinval.h,v 1.37 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/sinval.h,v 1.38 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,7 +71,8 @@ typedef struct
int16 id; /* type field --- must be first */
Oid dbId; /* database ID, or 0 if a shared relation */
Oid relId; /* relation ID */
- RelFileNode physId; /* physical file ID */
+ RelFileNode physId; /* physical file ID */
+
/*
* Note: it is likely that RelFileNode will someday be changed to
* include database ID. In that case the dbId field will be redundant
@@ -101,11 +102,12 @@ extern bool IsBackendPid(int pid);
extern TransactionId GetOldestXmin(bool allDbs);
extern int CountActiveBackends(void);
extern int CountEmptyBackendSlots(void);
+
/* Use "struct PGPROC", not PGPROC, to avoid including proc.h here */
extern struct PGPROC *BackendIdGetProc(BackendId procId);
extern void XidCacheRemoveRunningXids(TransactionId xid,
- int nxids, TransactionId *xids);
+ int nxids, TransactionId *xids);
/* signal handler for catchup events (SIGUSR1) */
extern void CatchupInterruptHandler(SIGNAL_ARGS);
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 43441daac62..7ef336374af 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.47 2004/08/29 04:13:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.48 2004/08/29 05:06:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,13 +31,13 @@
typedef struct SMgrRelationData
{
/* rnode is the hashtable lookup key, so it must be first! */
- RelFileNode smgr_rnode; /* relation physical identifier */
+ RelFileNode smgr_rnode; /* relation physical identifier */
/* additional public fields may someday exist here */
/*
* Fields below here are intended to be private to smgr.c and its
- * submodules. Do not touch them from elsewhere.
+ * submodules. Do not touch them from elsewhere.
*/
int smgr_which; /* storage manager selector */
@@ -56,13 +56,13 @@ extern void smgrcreate(SMgrRelation reln, bool isTemp, bool isRedo);
extern void smgrscheduleunlink(SMgrRelation reln, bool isTemp);
extern void smgrdounlink(SMgrRelation reln, bool isTemp, bool isRedo);
extern void smgrextend(SMgrRelation reln, BlockNumber blocknum, char *buffer,
- bool isTemp);
+ bool isTemp);
extern void smgrread(SMgrRelation reln, BlockNumber blocknum, char *buffer);
extern void smgrwrite(SMgrRelation reln, BlockNumber blocknum, char *buffer,
- bool isTemp);
+ bool isTemp);
extern BlockNumber smgrnblocks(SMgrRelation reln);
extern BlockNumber smgrtruncate(SMgrRelation reln, BlockNumber nblocks,
- bool isTemp);
+ bool isTemp);
extern void smgrimmedsync(SMgrRelation reln);
extern void smgrDoPendingDeletes(bool isCommit);
extern int smgrGetPendingDeletes(bool forCommit, RelFileNode **ptr);
@@ -85,13 +85,13 @@ extern bool mdclose(SMgrRelation reln);
extern bool mdcreate(SMgrRelation reln, bool isRedo);
extern bool mdunlink(RelFileNode rnode, bool isRedo);
extern bool mdextend(SMgrRelation reln, BlockNumber blocknum, char *buffer,
- bool isTemp);
+ bool isTemp);
extern bool mdread(SMgrRelation reln, BlockNumber blocknum, char *buffer);
extern bool mdwrite(SMgrRelation reln, BlockNumber blocknum, char *buffer,
- bool isTemp);
+ bool isTemp);
extern BlockNumber mdnblocks(SMgrRelation reln);
extern BlockNumber mdtruncate(SMgrRelation reln, BlockNumber nblocks,
- bool isTemp);
+ bool isTemp);
extern bool mdimmedsync(SMgrRelation reln);
extern bool mdsync(void);