PostgreSQL Source Code: src/include/access/xlogreader.h Source File (original) (raw)
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#ifndef XLOGREADER_H
35#define XLOGREADER_H
36
37#ifndef FRONTEND
39#endif
40
43
44
46{
51
52
54{
58
60
61
64 int reqLen,
71
73{
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
95
96
97
98
99
100
101
102
103
104
105
106
107
109
110
111
112
113
116
117#define XL_ROUTINE(...) &(XLogReaderRoutine){__VA_ARGS__}
118
119typedef struct
120{
121
123
124
128
129
131
132
134
135
137 bool apply_image;
143
144
150
151
152
153
154
155
157{
158
162
163
171 int max_block_id;
174
176{
177
178
179
181
182
183
184
185
186
187
188
189
190
192
193
194
195
197
198
199
200
201
202
203
204
205
208
209
210
211
212
213
216
218
219
220
221
222
223
224
225
226
227
228
229
230
234
235
237
238
239
240
241
242
243
244
245
246
247
248
254
255
256
257
258
259
262
263
264
265
266
269
270
274
275
276
277
278
281
282
284
286
287
288
289
290
291
292
293
294
296
297
298
299
300
302
303
304
305
306
309
310
313
314
315
316
317
319};
320
321
322
323
324static inline bool
326{
327 return (state->decode_queue_head != NULL) || state->errormsg_deferred;
328}
329
330
332 const char *waldir,
334 void *private_data);
335
336
338
339
341 void *buffer,
342 size_t size);
343
344
347
348
350{
352 XLREAD_FAIL = -1,
355
356
358 char **errormsg);
359
360
362 char **errormsg);
363
364
366
367
369 bool nonblocking);
370
371
374
375
377
378
379
380
381
383{
390
394
395
396
402 char **errormsg);
403
404
405
406
407
408#define XLogRecGetTotalLen(decoder) ((decoder)->record->header.xl_tot_len)
409#define XLogRecGetPrev(decoder) ((decoder)->record->header.xl_prev)
410#define XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info)
411#define XLogRecGetRmid(decoder) ((decoder)->record->header.xl_rmid)
412#define XLogRecGetXid(decoder) ((decoder)->record->header.xl_xid)
413#define XLogRecGetOrigin(decoder) ((decoder)->record->record_origin)
414#define XLogRecGetTopXid(decoder) ((decoder)->record->toplevel_xid)
415#define XLogRecGetData(decoder) ((decoder)->record->main_data)
416#define XLogRecGetDataLen(decoder) ((decoder)->record->main_data_len)
417#define XLogRecHasAnyBlockRefs(decoder) ((decoder)->record->max_block_id >= 0)
418#define XLogRecMaxBlockId(decoder) ((decoder)->record->max_block_id)
419#define XLogRecGetBlock(decoder, i) (&(decoder)->record->blocks[(i)])
420#define XLogRecHasBlockRef(decoder, block_id) \
421 (((decoder)->record->max_block_id >= (block_id)) && \
422 ((decoder)->record->blocks[block_id].in_use))
423#define XLogRecHasBlockImage(decoder, block_id) \
424 ((decoder)->record->blocks[block_id].has_image)
425#define XLogRecBlockImageApply(decoder, block_id) \
426 ((decoder)->record->blocks[block_id].apply_image)
427#define XLogRecHasBlockData(decoder, block_id) \
428 ((decoder)->record->blocks[block_id].has_data)
429
430#ifndef FRONTEND
432#endif
433
442 Buffer *prefetch_buffer);
443
444#endif
#define FLEXIBLE_ARRAY_MEMBER
struct DecodedXLogRecord * next
TransactionId toplevel_xid
RepOriginId record_origin
DecodedBkpBlock blocks[FLEXIBLE_ARRAY_MEMBER]
WALSegmentCloseCB segment_close
WALSegmentOpenCB segment_open
XLogRecPtr missingContrecPtr
DecodedXLogRecord * record
size_t decode_buffer_size
DecodedXLogRecord * decode_queue_head
XLogRecPtr currTLIValidUntil
DecodedXLogRecord * decode_queue_tail
XLogReaderRoutine routine
char * decode_buffer_head
XLogRecPtr overwrittenRecPtr
char * decode_buffer_tail
bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum, Buffer *prefetch_buffer)
XLogReaderState * XLogReaderAllocate(int wal_segment_size, const char *waldir, XLogReaderRoutine *routine, void *private_data)
struct XLogRecord * XLogReadRecord(XLogReaderState *state, char **errormsg)
void XLogReaderSetDecodeBuffer(XLogReaderState *state, void *buffer, size_t size)
DecodedXLogRecord * XLogReadAhead(XLogReaderState *state, bool nonblocking)
char * XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len)
DecodedXLogRecord * XLogNextRecord(XLogReaderState *state, char **errormsg)
static bool XLogReaderHasQueuedRecordOrError(XLogReaderState *state)
struct DecodedXLogRecord DecodedXLogRecord
bool WALRead(XLogReaderState *state, char *buf, XLogRecPtr startptr, Size count, TimeLineID tli, WALReadError *errinfo)
struct WALReadError WALReadError
void(* WALSegmentCloseCB)(XLogReaderState *xlogreader)
void XLogReaderResetError(XLogReaderState *state)
bool XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr, char *phdr)
FullTransactionId XLogRecGetFullXid(XLogReaderState *record)
void XLogReaderFree(XLogReaderState *state)
void XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum)
bool DecodeXLogRecord(XLogReaderState *state, DecodedXLogRecord *decoded, XLogRecord *record, XLogRecPtr lsn, char **errormsg)
struct WALOpenSegment WALOpenSegment
size_t DecodeXLogRecordRequiredSpace(size_t xl_tot_len)
XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr)
void XLogBeginRead(XLogReaderState *state, XLogRecPtr RecPtr)
struct WALSegmentContext WALSegmentContext
bool RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
void(* WALSegmentOpenCB)(XLogReaderState *xlogreader, XLogSegNo nextSegNo, TimeLineID *tli_p)
int(* XLogPageReadCB)(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf)
struct XLogReaderRoutine XLogReaderRoutine
XLogRecPtr XLogReleasePreviousRecord(XLogReaderState *state)
static XLogReaderState * xlogreader