1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

Good Bye, Time Travel!

This commit is contained in:
Vadim B. Mikheev
1997-11-02 15:27:14 +00:00
parent 6cc0a00dec
commit 32cd09ac6d
36 changed files with 265 additions and 1841 deletions

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: heapam.h,v 1.20 1997/10/30 23:37:01 momjian Exp $
* $Id: heapam.h,v 1.21 1997/11/02 15:26:37 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -142,7 +142,7 @@ extern void heap_restrpos(HeapScanDesc sdesc);
extern Size ComputeDataSize(TupleDesc tupleDesc, Datum value[], char nulls[]);
extern void
DataFill(char *data, TupleDesc tupleDesc,
Datum value[], char nulls[], char *infomask,
Datum value[], char nulls[], uint16 *infomask,
bits8 *bit);
extern int heap_attisnull(HeapTuple tup, int attnum);
extern int heap_sysattrlen(AttrNumber attno);

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: htup.h,v 1.6 1997/09/08 21:50:46 momjian Exp $
* $Id: htup.h,v 1.7 1997/11/02 15:26:42 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,33 +28,25 @@
*/
typedef struct HeapTupleData
{
unsigned int t_len; /* length of entire tuple */
unsigned int t_len; /* length of entire tuple */
Oid t_oid; /* OID of this tuple -- 4 bytes */
ItemPointerData t_ctid; /* current TID of this tuple */
CommandId t_cmin; /* insert CID stamp -- 4 bytes each */
CommandId t_cmax; /* delete CommandId stamp */
ItemPointerData t_chain; /* replaced tuple TID */
TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
TransactionId t_xmax; /* delete XID stamp */
Oid t_oid; /* OID of this tuple -- 4 bytes */
ItemPointerData t_ctid; /* current TID of this tuple */
int16 t_natts; /* number of attributes */
CommandId t_cmin; /* insert CID stamp -- 2 bytes each */
CommandId t_cmax; /* delete CommandId stamp */
uint16 t_infomask; /* various infos */
TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
TransactionId t_xmax; /* delete XID stamp */
uint8 t_hoff; /* sizeof tuple header */
AbsoluteTime t_tmin; /* time stamps -- 4 bytes each */
AbsoluteTime t_tmax;
int16 t_natts; /* number of attributes */
char t_vtype; /* not used - padding */
char t_infomask; /* whether tuple as null or variable
* length attributes */
uint8 t_hoff; /* sizeof tuple header */
bits8 t_bits[MinHeapTupleBitmapSize / 8];
bits8 t_bits[MinHeapTupleBitmapSize / 8];
/* bit map of domains */
/* MORE DATA FOLLOWS AT END OF STRUCT */
@@ -69,12 +61,7 @@ typedef HeapTupleData *HeapTuple;
#define MinCommandIdAttributeNumber (-4)
#define MaxTransactionIdAttributeNumber (-5)
#define MaxCommandIdAttributeNumber (-6)
#define ChainItemPointerAttributeNumber (-7)
#define AnchorItemPointerAttributeNumber (-8)
#define MinAbsoluteTimeAttributeNumber (-9)
#define MaxAbsoluteTimeAttributeNumber (-10)
#define VersionTypeAttributeNumber (-11)
#define FirstLowInvalidHeapAttributeNumber (-12)
#define FirstLowInvalidHeapAttributeNumber (-7)
/* ----------------
@@ -101,9 +88,15 @@ typedef HeapTupleData *HeapTuple;
/*
* information stored in t_infomask:
*/
#define HEAP_HASNULL 0x01 /* has null attribute(s) */
#define HEAP_HASVARLENA 0x02 /* has variable length
#define HEAP_HASNULL 0x0001 /* has null attribute(s) */
#define HEAP_HASVARLENA 0x0002 /* has variable length
* attribute(s) */
#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */
#define HEAP_XACT_MASK 0x0F00 /* */
#define HeapTupleNoNulls(tuple) \
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASNULL))

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: transam.h,v 1.11 1997/09/08 21:51:03 momjian Exp $
* $Id: transam.h,v 1.12 1997/11/02 15:26:44 vadim Exp $
*
* NOTES
* Transaction System Version 101 now support proper oid
@@ -18,7 +18,6 @@
#define TRANSAM_H
#include <storage/bufmgr.h>
#include <utils/nabstime.h>
/* ----------------
* transaction system version id
@@ -33,19 +32,19 @@
* even if their minor versions differ.
* ----------------
*/
#define TRANS_SYSTEM_VERSION 101
#define TRANS_SYSTEM_VERSION 200
/* ----------------
* transaction id status values
*
* someday we will use "11" = 3 = XID_INVALID to mean the
* starting of run-length encoded log data.
* someday we will use "11" = 3 = XID_COMMIT_CHILD to mean the
* commiting of child xactions.
* ----------------
*/
#define XID_COMMIT 2 /* transaction commited */
#define XID_ABORT 1 /* transaction aborted */
#define XID_INPROGRESS 0 /* transaction in progress */
#define XID_INVALID 3 /* other */
#define XID_COMMIT 2 /* transaction commited */
#define XID_ABORT 1 /* transaction aborted */
#define XID_INPROGRESS 0 /* transaction in progress */
#define XID_COMMIT_CHILD 3 /* child xact commited */
typedef unsigned char XidStatus;/* (2 bits) */
@@ -69,7 +68,6 @@ typedef unsigned char XidStatus;/* (2 bits) */
*/
#define TP_DataSize BLCKSZ
#define TP_NumXidStatusPerBlock (TP_DataSize * 4)
#define TP_NumTimePerBlock (TP_DataSize / 4)
/* ----------------
* LogRelationContents structure
@@ -90,25 +88,6 @@ typedef struct LogRelationContentsData
typedef LogRelationContentsData *LogRelationContents;
/* ----------------
* TimeRelationContents structure
*
* This structure describes the storage of the data in the
* first 2048 bytes of the time relation. This storage is never
* used for transaction commit times because transaction id's begin
* their numbering at 512.
*
* The first 4 bytes of this relation store the version
* number of the transction system.
* ----------------
*/
typedef struct TimeRelationContentsData
{
int TransSystemVersion;
} TimeRelationContentsData;
typedef TimeRelationContentsData *TimeRelationContents;
/* ----------------
* VariableRelationContents structure
*
@@ -127,10 +106,10 @@ typedef TimeRelationContentsData *TimeRelationContents;
*/
typedef struct VariableRelationContentsData
{
int TransSystemVersion;
TransactionId nextXidData;
TransactionId lastXidData;
Oid nextOid;
int TransSystemVersion;
TransactionId nextXidData;
TransactionId lastXidData; /* unused */
Oid nextOid;
} VariableRelationContentsData;
typedef VariableRelationContentsData *VariableRelationContents;
@@ -143,7 +122,6 @@ typedef VariableRelationContentsData *VariableRelationContents;
/*
* prototypes for functions in transam/transam.c
*/
extern AbsoluteTime TransactionIdGetCommitTime(TransactionId transactionId);
extern void InitializeTransactionLog(void);
extern bool TransactionIdDidCommit(TransactionId transactionId);
extern bool TransactionIdDidAbort(TransactionId transactionId);
@@ -162,18 +140,10 @@ extern void
TransBlockNumberSetXidStatus(Relation relation,
BlockNumber blockNumber, TransactionId xid, XidStatus xstatus,
bool *failP);
extern AbsoluteTime
TransBlockNumberGetCommitTime(Relation relation,
BlockNumber blockNumber, TransactionId xid, bool *failP);
extern void
TransBlockNumberSetCommitTime(Relation relation,
BlockNumber blockNumber, TransactionId xid, AbsoluteTime xtime,
bool *failP);
/* in transam/varsup.c */
extern void VariableRelationPutNextXid(TransactionId xid);
extern void GetNewTransactionId(TransactionId *xid);
extern void UpdateLastCommittedXid(TransactionId xid);
extern void GetNewObjectId(Oid *oid_return);
extern void CheckMaxObjectId(Oid assigned_oid);
@@ -184,11 +154,8 @@ extern void CheckMaxObjectId(Oid assigned_oid);
/* in transam.c */
extern Relation LogRelation;
extern Relation TimeRelation;
extern Relation VariableRelation;
extern TransactionId cachedGetCommitTimeXid;
extern AbsoluteTime cachedGetCommitTime;
extern TransactionId cachedTestXid;
extern XidStatus cachedTestXidStatus;

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: valid.h,v 1.8 1997/09/18 14:20:45 momjian Exp $
* $Id: valid.h,v 1.9 1997/11/02 15:26:46 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -122,8 +122,6 @@ do \
/* We use underscores to protect the variable passed in as parameters */ \
HeapTuple _tuple; \
bool _res; \
TransactionId _old_tmin, \
_old_tmax; \
\
if (!ItemIdIsUsed(itemId)) \
(result) = (HeapTuple) NULL; \
@@ -144,11 +142,10 @@ do \
(result) = _tuple; \
else \
{ \
_old_tmin = _tuple->t_tmin; \
_old_tmax = _tuple->t_tmax; \
uint16 _infomask = _tuple->t_infomask; \
\
_res = HeapTupleSatisfiesTimeQual(_tuple, (qual)); \
if (_tuple->t_tmin != _old_tmin || \
_tuple->t_tmax != _old_tmax) \
if (_tuple->t_infomask != _infomask) \
SetBufferCommitInfoNeedsSave(buffer); \
if (_res) \
(result) = _tuple; \

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: xact.h,v 1.9 1997/09/08 21:51:06 momjian Exp $
* $Id: xact.h,v 1.10 1997/11/02 15:26:48 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,12 @@ typedef struct TransactionStateData
typedef TransactionStateData *TransactionState;
#define TransactionIdIsValid(xid) ((bool) (xid != NullTransactionId))
#define TransactionIdStore(xid, dest) \
(*((TransactionId*)dest) = (TransactionId)xid)
#define StoreInvalidTransactionId(dest) \
(*((TransactionId*)dest) = NullTransactionId)
/* ----------------
* extern definitions
* ----------------
@@ -88,11 +94,6 @@ extern TransactionId DisabledTransactionId;
extern TransactionId xidin(char *representation);
extern char *xidout(TransactionId transactionId);
extern bool xideq(TransactionId xid1, TransactionId xid2);
extern bool TransactionIdIsValid(TransactionId transactionId);
extern void StoreInvalidTransactionId(TransactionId *destination);
extern void
TransactionIdStore(TransactionId transactionId,
TransactionId *destination);
extern bool TransactionIdEquals(TransactionId id1, TransactionId id2);
extern bool TransactionIdIsLessThan(TransactionId id1, TransactionId id2);
extern void TransactionIdAdd(TransactionId *xid, int value);