diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/htup.h | 7 | ||||
-rw-r--r-- | src/include/access/xact.h | 34 | ||||
-rw-r--r-- | src/include/access/xlog.h | 12 | ||||
-rw-r--r-- | src/include/catalog/pg_database.h | 10 | ||||
-rw-r--r-- | src/include/storage/buf_internals.h | 13 | ||||
-rw-r--r-- | src/include/storage/bufmgr.h | 16 | ||||
-rw-r--r-- | src/include/storage/bufpage.h | 3 | ||||
-rw-r--r-- | src/include/storage/itemid.h | 8 |
8 files changed, 93 insertions, 10 deletions
diff --git a/src/include/access/htup.h b/src/include/access/htup.h index f105dafee27..6f2b085b5c7 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: htup.h,v 1.35 2000/09/07 09:58:35 vadim Exp $ + * $Id: htup.h,v 1.36 2000/10/20 11:01:14 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -95,7 +95,7 @@ typedef struct xl_heap_delete xl_heaptid target; /* deleted tuple id */ } xl_heap_delete; -#define SizeOfHeapDelete (offsetof(xl_heaptid, tid) + SizeOfIptrData)) +#define SizeOfHeapDelete (offsetof(xl_heaptid, tid) + SizeOfIptrData) /* This is what we need to know about insert - 26 + data */ typedef struct xl_heap_insert @@ -111,12 +111,13 @@ typedef struct xl_heap_insert #define SizeOfHeapInsert (offsetof(xl_heap_insert, mask) + sizeof(uint8)) -/* This is what we need to know about update - 28 + data */ +/* This is what we need to know about update - 32 + data */ typedef struct xl_heap_update { xl_heaptid target; /* deleted tuple id */ ItemPointerData newtid; /* new inserted tuple id */ /* something from header of new tuple version */ + Oid t_oid; int16 t_natts; uint8 t_hoff; uint8 mask; /* low 8 bits of t_infomask */ diff --git a/src/include/access/xact.h b/src/include/access/xact.h index c512a4a66f9..712e88b6005 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: xact.h,v 1.27 2000/07/28 01:04:40 tgl Exp $ + * $Id: xact.h,v 1.28 2000/10/20 11:01:14 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -78,6 +78,35 @@ typedef TransactionStateData *TransactionState; (*((TransactionId*) (dest)) = NullTransactionId) +#ifdef XLOG + +/* + * XLOG allows to store some information in high 4 bits of log + * record xl_info field + */ +#define XLOG_XACT_COMMIT 0x00 +#define XLOG_XACT_ABORT 0x20 + +typedef struct xl_xact_commit +{ + time_t xtime; + /* + * Array of RelFileNode-s to drop may follow + * at the end of struct + */ +} xl_xact_commit; + +#define SizeOfXactCommit ((offsetof(xl_xact_commit, xtime) + sizeof(time_t))) + +typedef struct xl_xact_abort +{ + time_t xtime; +} xl_xact_abort; + +#define SizeOfXactAbort ((offsetof(xl_xact_abort, xtime) + sizeof(time_t))) + +#endif + /* ---------------- * extern definitions * ---------------- @@ -108,6 +137,9 @@ extern void AbortOutOfAnyTransaction(void); extern TransactionId DisabledTransactionId; +extern void XactPushRollback(void (*func) (void *), void* data); +extern void XactPopRollback(void); + /* defined in xid.c */ extern Datum xidin(PG_FUNCTION_ARGS); extern Datum xidout(PG_FUNCTION_ARGS); diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 69bf1487777..c73217f9ccc 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -72,12 +72,24 @@ typedef XLogPageHeaderData *XLogPageHeader; #define XLP_FIRST_IS_SUBRECORD 0x0001 +#define XLByteLT(left, right) \ + (right.xlogid > left.xlogid || \ + (right.xlogid == left.xlogid && right.xrecoff > left.xrecoff)) + +#define XLByteLE(left, right) \ + (right.xlogid > left.xlogid || \ + (right.xlogid == left.xlogid && right.xrecoff >= left.xrecoff)) + +#define XLByteEQ(left, right) \ + (right.xlogid == left.xlogid && right.xrecoff == left.xrecoff) + /* * StartUpID (SUI) - system startups counter. * It's to allow removing pg_log after shutdown. */ typedef uint32 StartUpID; extern StartUpID ThisStartUpID; +extern bool InRecovery; extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, char *hdr, uint32 hdrlen, diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index 99d4217d3e0..27acca85f44 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_database.h,v 1.10 2000/10/16 14:52:26 vadim Exp $ + * $Id: pg_database.h,v 1.11 2000/10/20 11:01:17 vadim Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -61,4 +61,12 @@ DESCR(""); #define TemplateDbOid 1 +/* Just to mark OID as used for unused_oid script -:) */ +#define DATAMARKOID(x) + +DATAMARKOID( = 2) +#define RecoveryDb 2 + +#undef DATAMARKOID + #endif /* PG_DATABASE_H */ diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 12bf6604da1..86512e50bf8 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: buf_internals.h,v 1.39 2000/10/18 05:50:16 vadim Exp $ + * $Id: buf_internals.h,v 1.40 2000/10/20 11:01:21 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -121,10 +121,19 @@ typedef struct sbufdesc * * Why we keep relId here? To re-use file descriptors. On rollback * WAL uses dummy relId - bad (more blind writes - open/close calls), - * but allowable. Obviously we should have another cache in file manager. + * but allowable. Obviously we should have another cache in file manager + * - fd is not relcache deal. */ LockRelId relId; BufferBlindId blind; /* was used to support blind write */ + + /* + * When we can't delete item from page (someone else has buffer pinned) + * we mark buffer for cleanup by specifying appropriate for buffer + * content cleanup function. Buffer will be cleaned up from release + * buffer functions. + */ + void (*CleanupFunc)(Buffer); } BufferDesc; /* diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 1a06953f513..551f98e75f9 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: bufmgr.h,v 1.40 2000/08/07 20:15:50 tgl Exp $ + * $Id: bufmgr.h,v 1.41 2000/10/20 11:01:21 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -44,6 +44,17 @@ extern int ShowPinTrace; #define BUFFER_LOCK_SHARE 1 #define BUFFER_LOCK_EXCLUSIVE 2 +#define UnlockAndReleaseBuffer(buffer) \ +( \ + LockBuffer(buffer, BUFFER_LOCK_UNLOCK), \ + ReleaseBuffer(buffer) \ +) + +#define UnlockAndWriteBuffer(buffer) \ +( \ + LockBuffer(buffer, BUFFER_LOCK_UNLOCK), \ + WriteBuffer(buffer) \ +) /* * BufferIsValid @@ -163,4 +174,7 @@ extern void UnlockBuffers(void); extern void LockBuffer(Buffer buffer, int mode); extern void AbortBufferIO(void); +extern bool BufferIsUpdatable(Buffer buffer); +extern void MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc)(Buffer)); + #endif diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index 58ba61f68d8..85e51122f9c 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: bufpage.h,v 1.32 2000/09/07 09:58:36 vadim Exp $ + * $Id: bufpage.h,v 1.33 2000/10/20 11:01:21 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -20,6 +20,7 @@ #include "storage/itemid.h" #include "storage/off.h" #include "storage/page.h" +#include "access/xlog.h" /* * a postgres disk page is an abstraction layered on top of a postgres diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h index 0b330ce56fe..a915f701684 100644 --- a/src/include/storage/itemid.h +++ b/src/include/storage/itemid.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: itemid.h,v 1.12 2000/09/07 09:58:36 vadim Exp $ + * $Id: itemid.h,v 1.13 2000/10/20 11:01:21 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -41,6 +41,12 @@ typedef ItemIdData *ItemId; #endif /* + * This bit may be passed to PageAddItem together with + * LP_USED & LP_DELETED bits to specify overwrite mode + */ +#define OverwritePageMode 0x10 + +/* * Item offsets, lengths, and flags are represented by these types when * they're not actually stored in an ItemIdData. */ |