4
* Postgres transaction log manager record pointer and
5
* timeline number definitions
7
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
10
* $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.14 2004-12-31 22:03:21 pgsql Exp $
16
* Pointer to a location in the XLOG. These pointers are 64 bits wide,
17
* because we don't want them ever to overflow.
19
* NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK
20
* because we use page headers in the XLOG, so no XLOG record can start
21
* right at the beginning of a file.
23
* NOTE: the "log file number" is somewhat misnamed, since the actual files
24
* making up the XLOG are much smaller than 4Gb. Each actual file is an
25
* XLogSegSize-byte "segment" of a logical log file having the indicated
26
* xlogid. The log file number and segment number together identify a
27
* physical XLOG file. Segment number and offset within the physical file
28
* are computed from xrecoff div and mod XLogSegSize.
30
typedef struct XLogRecPtr
32
uint32 xlogid; /* log file #, 0 based */
33
uint32 xrecoff; /* byte offset of location in log file */
38
* Macros for comparing XLogRecPtrs
40
* Beware of passing expressions with side-effects to these macros,
41
* since the arguments may be evaluated multiple times.
43
#define XLByteLT(a, b) \
44
((a).xlogid < (b).xlogid || \
45
((a).xlogid == (b).xlogid && (a).xrecoff < (b).xrecoff))
47
#define XLByteLE(a, b) \
48
((a).xlogid < (b).xlogid || \
49
((a).xlogid == (b).xlogid && (a).xrecoff <= (b).xrecoff))
51
#define XLByteEQ(a, b) \
52
((a).xlogid == (b).xlogid && (a).xrecoff == (b).xrecoff)
56
* TimeLineID (TLI) - identifies different database histories to prevent
57
* confusion after restoring a prior state of a database installation.
58
* TLI does not change in a normal stop/restart of the database (including
59
* crash-and-recover cases); but we must assign a new TLI after doing
60
* a recovery to a prior state, a/k/a point-in-time recovery. This makes
61
* the new WAL logfile sequence we generate distinguishable from the
62
* sequence that was generated in the previous incarnation.
64
typedef uint32 TimeLineID;
66
#endif /* XLOG_DEFS_H */