Consistently use "superuser" instead of "super user"
[pgsql.git] / src / include / access / xlogdefs.h
blob60348d1850964238ab3c2ceb3af2abd7669b7511
1 /*
2 * xlogdefs.h
4 * Postgres write-ahead log manager record pointer and
5 * timeline number definitions
7 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/access/xlogdefs.h
12 #ifndef XLOG_DEFS_H
13 #define XLOG_DEFS_H
15 #include <fcntl.h> /* need open() flags */
18 * Pointer to a location in the XLOG. These pointers are 64 bits wide,
19 * because we don't want them ever to overflow.
21 typedef uint64 XLogRecPtr;
24 * Zero is used indicate an invalid pointer. Bootstrap skips the first possible
25 * WAL segment, initializing the first WAL page at WAL segment size, so no XLOG
26 * record can begin at zero.
28 #define InvalidXLogRecPtr 0
29 #define XLogRecPtrIsInvalid(r) ((r) == InvalidXLogRecPtr)
32 * First LSN to use for "fake" LSNs.
34 * Values smaller than this can be used for special per-AM purposes.
36 #define FirstNormalUnloggedLSN ((XLogRecPtr) 1000)
39 * Handy macro for printing XLogRecPtr in conventional format, e.g.,
41 * printf("%X/%X", LSN_FORMAT_ARGS(lsn));
43 #define LSN_FORMAT_ARGS(lsn) (AssertVariableIsOfTypeMacro((lsn), XLogRecPtr), (uint32) ((lsn) >> 32)), ((uint32) (lsn))
46 * XLogSegNo - physical log file sequence number.
48 typedef uint64 XLogSegNo;
51 * TimeLineID (TLI) - identifies different database histories to prevent
52 * confusion after restoring a prior state of a database installation.
53 * TLI does not change in a normal stop/restart of the database (including
54 * crash-and-recover cases); but we must assign a new TLI after doing
55 * a recovery to a prior state, a/k/a point-in-time recovery. This makes
56 * the new WAL logfile sequence we generate distinguishable from the
57 * sequence that was generated in the previous incarnation.
59 typedef uint32 TimeLineID;
62 * Replication origin id - this is located in this file to avoid having to
63 * include origin.h in a bunch of xlog related places.
65 typedef uint16 RepOriginId;
68 * This chunk of hackery attempts to determine which file sync methods
69 * are available on the current platform, and to choose an appropriate
70 * default method. We assume that fsync() is always available, and that
71 * configure determined whether fdatasync() is.
73 #if defined(O_SYNC)
74 #define OPEN_SYNC_FLAG O_SYNC
75 #elif defined(O_FSYNC)
76 #define OPEN_SYNC_FLAG O_FSYNC
77 #endif
79 #if defined(O_DSYNC)
80 #if defined(OPEN_SYNC_FLAG)
81 /* O_DSYNC is distinct? */
82 #if O_DSYNC != OPEN_SYNC_FLAG
83 #define OPEN_DATASYNC_FLAG O_DSYNC
84 #endif
85 #else /* !defined(OPEN_SYNC_FLAG) */
86 /* Win32 only has O_DSYNC */
87 #define OPEN_DATASYNC_FLAG O_DSYNC
88 #endif
89 #endif
91 #if defined(PLATFORM_DEFAULT_SYNC_METHOD)
92 #define DEFAULT_SYNC_METHOD PLATFORM_DEFAULT_SYNC_METHOD
93 #elif defined(OPEN_DATASYNC_FLAG)
94 #define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC
95 #elif defined(HAVE_FDATASYNC)
96 #define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
97 #else
98 #define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
99 #endif
101 #endif /* XLOG_DEFS_H */