-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostgres_control.hexpat
More file actions
123 lines (104 loc) · 2.41 KB
/
Copy pathpostgres_control.hexpat
File metadata and controls
123 lines (104 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#pragma author "Anthonin Bonnefoy"
#pragma description "PostgreSQL Control Format"
#pragma little endian
import type.time;
using pg_time_t = type::time64_t;
using TimeLineID = u32;
using XLogRecPtr = u64 [[format("format_xlogrecptr")]];
using TransactionId = u32;
using FullTransactionId = u64;
using MultiXactId = TransactionId;
using MultiXactOffset = u32;
using MultiXactOffset_PG19 = u64;
using Oid = u32;
u32 pg_version = 19;
fn format_xlogrecptr(auto rec_ptr) {
return std::format("{:X}/{:X}", rec_ptr >> 32, rec_ptr & 0xffffffff);
};
enum DBState: u8 {
DB_STARTUP = 0,
DB_SHUTDOWNED,
DB_SHUTDOWNED_IN_RECOVERY,
DB_SHUTDOWNING,
DB_IN_CRASH_RECOVERY,
DB_IN_ARCHIVE_RECOVERY,
DB_IN_PRODUCTION,
};
struct CheckPoint
{
XLogRecPtr redo;
TimeLineID ThisTimeLineID;
TimeLineID PrevTimeLineID;
bool fullPageWrites;
padding[3];
u32 wal_level;
if (pg_version >= 19) {
bool logicalDecodingEnabled;
padding[7];
}
FullTransactionId nextXid;
Oid nextOid;
MultiXactId nextMulti;
if (pg_version >= 19) {
MultiXactOffset_PG19 nextMultiOffset;
} else {
MultiXactOffset nextMultiOffset;
}
padding[4];
TransactionId oldestXid;
Oid oldestXidDB;
MultiXactId oldestMulti;
Oid oldestMultiDB;
pg_time_t time;
TransactionId oldestCommitTsXid;
TransactionId newestCommitTsXid;
TransactionId oldestActiveXid;
padding[4];
};
struct Control {
u64 system_identifier;
u32 pg_control_version;
u32 catalog_version_no;
DBState state;
padding[7];
pg_time_t time;
XLogRecPtr checkPoint;
CheckPoint checkPointCopy;
XLogRecPtr unloggedLSN;
XLogRecPtr minRecoveryPoint;
TimeLineID minRecoveryPointTLI;
padding[4];
XLogRecPtr backupStartPoint;
XLogRecPtr backupEndPoint;
bool backupEndRequired;
padding[3];
u32 wal_level;
bool wal_log_hints;
padding[3];
u32 MaxConnections;
u32 max_worker_processes;
u32 max_wal_senders;
u32 max_prepared_xacts;
u32 max_locks_per_xact;
bool track_commit_timestamp;
padding[3];
u32 maxAlign;
double floatFormat;
u32 blcksz;
u32 relseg_size;
u32 slru_pages_per_segment;
u32 xlog_blcksz;
u32 xlog_seg_size;
u32 nameDataLen;
u32 indexMaxKeys;
u32 toast_max_chunk_size;
u32 loblksize;
padding[3];
bool float8ByVal;
u32 data_checksum_version;
bool default_char_signedness;
char mock_authentication_nonce[32];
padding[3];
u32 crc;
} [[inline]];
Control control @ 0x0;