~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/include/access/xlogdefs.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * xlogdefs.h
 
3
 *
 
4
 * Postgres transaction log manager record pointer and
 
5
 * timeline number definitions
 
6
 *
 
7
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
8
 * Portions Copyright (c) 1994, Regents of the University of California
 
9
 *
 
10
 * $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.14 2004-12-31 22:03:21 pgsql Exp $
 
11
 */
 
12
#ifndef XLOG_DEFS_H
 
13
#define XLOG_DEFS_H
 
14
 
 
15
/*
 
16
 * Pointer to a location in the XLOG.  These pointers are 64 bits wide,
 
17
 * because we don't want them ever to overflow.
 
18
 *
 
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.
 
22
 *
 
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.
 
29
 */
 
30
typedef struct XLogRecPtr
 
31
{
 
32
        uint32          xlogid;                 /* log file #, 0 based */
 
33
        uint32          xrecoff;                /* byte offset of location in log file */
 
34
} XLogRecPtr;
 
35
 
 
36
 
 
37
/*
 
38
 * Macros for comparing XLogRecPtrs
 
39
 *
 
40
 * Beware of passing expressions with side-effects to these macros,
 
41
 * since the arguments may be evaluated multiple times.
 
42
 */
 
43
#define XLByteLT(a, b)          \
 
44
                        ((a).xlogid < (b).xlogid || \
 
45
                         ((a).xlogid == (b).xlogid && (a).xrecoff < (b).xrecoff))
 
46
 
 
47
#define XLByteLE(a, b)          \
 
48
                        ((a).xlogid < (b).xlogid || \
 
49
                         ((a).xlogid == (b).xlogid && (a).xrecoff <= (b).xrecoff))
 
50
 
 
51
#define XLByteEQ(a, b)          \
 
52
                        ((a).xlogid == (b).xlogid && (a).xrecoff == (b).xrecoff)
 
53
 
 
54
 
 
55
/*
 
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.
 
63
 */
 
64
typedef uint32 TimeLineID;
 
65
 
 
66
#endif   /* XLOG_DEFS_H */