4 * Postgres transaction log manager record pointer and
5 * system startup number definitions
7 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $Id: xlogdefs.h,v 1.2 2001/03/13 01:17:06 tgl 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 */
37 * Macros for comparing XLogRecPtrs
39 * Beware of passing expressions with side-effects to these macros,
40 * since the arguments may be evaluated multiple times.
42 #define XLByteLT(a, b) \
43 ((a).xlogid < (b).xlogid || \
44 ((a).xlogid == (b).xlogid && (a).xrecoff < (b).xrecoff))
46 #define XLByteLE(a, b) \
47 ((a).xlogid < (b).xlogid || \
48 ((a).xlogid == (b).xlogid && (a).xrecoff <= (b).xrecoff))
50 #define XLByteEQ(a, b) \
51 ((a).xlogid == (b).xlogid && (a).xrecoff == (b).xrecoff)
54 * StartUpID (SUI) - system startups counter. It's to allow removing
55 * pg_log after shutdown, in future.
57 typedef uint32 StartUpID;
59 #endif /* XLOG_DEFS_H */