PostgreSQL Source Code git master
Loading...
Searching...
No Matches
heapam_xlog.h File Reference
#include "access/htup.h"
#include "access/xlogreader.h"
#include "lib/stringinfo.h"
#include "storage/buf.h"
#include "storage/bufpage.h"
#include "storage/relfilelocator.h"
#include "storage/sinval.h"
#include "utils/relcache.h"
Include dependency graph for heapam_xlog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  xl_heap_delete
 
struct  xl_heap_truncate
 
struct  xl_heap_header
 
struct  xl_heap_insert
 
struct  xl_heap_multi_insert
 
struct  xl_multi_insert_tuple
 
struct  xl_heap_update
 
struct  xl_heap_prune
 
struct  xlhp_freeze_plan
 
struct  xlhp_freeze_plans
 
struct  xlhp_prune_items
 
struct  xl_heap_lock
 
struct  xl_heap_lock_updated
 
struct  xl_heap_confirm
 
struct  xl_heap_inplace
 
struct  xl_heap_visible
 
struct  xl_heap_new_cid
 
struct  xl_heap_rewrite_mapping
 

Macros

#define XLOG_HEAP_INSERT   0x00
 
#define XLOG_HEAP_DELETE   0x10
 
#define XLOG_HEAP_UPDATE   0x20
 
#define XLOG_HEAP_TRUNCATE   0x30
 
#define XLOG_HEAP_HOT_UPDATE   0x40
 
#define XLOG_HEAP_CONFIRM   0x50
 
#define XLOG_HEAP_LOCK   0x60
 
#define XLOG_HEAP_INPLACE   0x70
 
#define XLOG_HEAP_OPMASK   0x70
 
#define XLOG_HEAP_INIT_PAGE   0x80
 
#define XLOG_HEAP2_REWRITE   0x00
 
#define XLOG_HEAP2_PRUNE_ON_ACCESS   0x10
 
#define XLOG_HEAP2_PRUNE_VACUUM_SCAN   0x20
 
#define XLOG_HEAP2_PRUNE_VACUUM_CLEANUP   0x30
 
#define XLOG_HEAP2_VISIBLE   0x40
 
#define XLOG_HEAP2_MULTI_INSERT   0x50
 
#define XLOG_HEAP2_LOCK_UPDATED   0x60
 
#define XLOG_HEAP2_NEW_CID   0x70
 
#define XLH_INSERT_ALL_VISIBLE_CLEARED   (1<<0)
 
#define XLH_INSERT_LAST_IN_MULTI   (1<<1)
 
#define XLH_INSERT_IS_SPECULATIVE   (1<<2)
 
#define XLH_INSERT_CONTAINS_NEW_TUPLE   (1<<3)
 
#define XLH_INSERT_ON_TOAST_RELATION   (1<<4)
 
#define XLH_INSERT_ALL_FROZEN_SET   (1<<5)
 
#define XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED   (1<<0)
 
#define XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED   (1<<1)
 
#define XLH_UPDATE_CONTAINS_OLD_TUPLE   (1<<2)
 
#define XLH_UPDATE_CONTAINS_OLD_KEY   (1<<3)
 
#define XLH_UPDATE_CONTAINS_NEW_TUPLE   (1<<4)
 
#define XLH_UPDATE_PREFIX_FROM_OLD   (1<<5)
 
#define XLH_UPDATE_SUFFIX_FROM_OLD   (1<<6)
 
#define XLH_UPDATE_CONTAINS_OLD    (XLH_UPDATE_CONTAINS_OLD_TUPLE | XLH_UPDATE_CONTAINS_OLD_KEY)
 
#define XLH_DELETE_ALL_VISIBLE_CLEARED   (1<<0)
 
#define XLH_DELETE_CONTAINS_OLD_TUPLE   (1<<1)
 
#define XLH_DELETE_CONTAINS_OLD_KEY   (1<<2)
 
#define XLH_DELETE_IS_SUPER   (1<<3)
 
#define XLH_DELETE_IS_PARTITION_MOVE   (1<<4)
 
#define XLH_DELETE_CONTAINS_OLD    (XLH_DELETE_CONTAINS_OLD_TUPLE | XLH_DELETE_CONTAINS_OLD_KEY)
 
#define SizeOfHeapDelete   (offsetof(xl_heap_delete, flags) + sizeof(uint8))
 
#define XLH_TRUNCATE_CASCADE   (1<<0)
 
#define XLH_TRUNCATE_RESTART_SEQS   (1<<1)
 
#define SizeOfHeapTruncate   (offsetof(xl_heap_truncate, relids))
 
#define SizeOfHeapHeader   (offsetof(xl_heap_header, t_hoff) + sizeof(uint8))
 
#define SizeOfHeapInsert   (offsetof(xl_heap_insert, flags) + sizeof(uint8))
 
#define SizeOfHeapMultiInsert   offsetof(xl_heap_multi_insert, offsets)
 
#define SizeOfMultiInsertTuple   (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8))
 
#define SizeOfHeapUpdate   (offsetof(xl_heap_update, new_offnum) + sizeof(OffsetNumber))
 
#define SizeOfHeapPrune   (offsetof(xl_heap_prune, flags) + sizeof(uint16))
 
#define XLHP_IS_CATALOG_REL   (1 << 1)
 
#define XLHP_CLEANUP_LOCK   (1 << 2)
 
#define XLHP_HAS_CONFLICT_HORIZON   (1 << 3)
 
#define XLHP_HAS_FREEZE_PLANS   (1 << 4)
 
#define XLHP_HAS_REDIRECTIONS   (1 << 5)
 
#define XLHP_HAS_DEAD_ITEMS   (1 << 6)
 
#define XLHP_HAS_NOW_UNUSED_ITEMS   (1 << 7)
 
#define XLHP_VM_ALL_VISIBLE   (1 << 8)
 
#define XLHP_VM_ALL_FROZEN   (1 << 9)
 
#define XLH_FREEZE_XVAC   0x02
 
#define XLH_INVALID_XVAC   0x04
 
#define XLHL_XMAX_IS_MULTI   0x01
 
#define XLHL_XMAX_LOCK_ONLY   0x02
 
#define XLHL_XMAX_EXCL_LOCK   0x04
 
#define XLHL_XMAX_KEYSHR_LOCK   0x08
 
#define XLHL_KEYS_UPDATED   0x10
 
#define XLH_LOCK_ALL_FROZEN_CLEARED   0x01
 
#define SizeOfHeapLock   (offsetof(xl_heap_lock, flags) + sizeof(uint8))
 
#define SizeOfHeapLockUpdated   (offsetof(xl_heap_lock_updated, flags) + sizeof(uint8))
 
#define SizeOfHeapConfirm   (offsetof(xl_heap_confirm, offnum) + sizeof(OffsetNumber))
 
#define MinSizeOfHeapInplace   (offsetof(xl_heap_inplace, nmsgs) + sizeof(int))
 
#define SizeOfHeapVisible   (offsetof(xl_heap_visible, flags) + sizeof(uint8))
 
#define SizeOfHeapNewCid   (offsetof(xl_heap_new_cid, target_tid) + sizeof(ItemPointerData))
 

Typedefs

typedef struct xl_heap_delete xl_heap_delete
 
typedef struct xl_heap_truncate xl_heap_truncate
 
typedef struct xl_heap_header xl_heap_header
 
typedef struct xl_heap_insert xl_heap_insert
 
typedef struct xl_heap_multi_insert xl_heap_multi_insert
 
typedef struct xl_multi_insert_tuple xl_multi_insert_tuple
 
typedef struct xl_heap_update xl_heap_update
 
typedef struct xl_heap_prune xl_heap_prune
 
typedef struct xlhp_freeze_plan xlhp_freeze_plan
 
typedef struct xlhp_freeze_plans xlhp_freeze_plans
 
typedef struct xlhp_prune_items xlhp_prune_items
 
typedef struct xl_heap_lock xl_heap_lock
 
typedef struct xl_heap_lock_updated xl_heap_lock_updated
 
typedef struct xl_heap_confirm xl_heap_confirm
 
typedef struct xl_heap_inplace xl_heap_inplace
 
typedef struct xl_heap_visible xl_heap_visible
 
typedef struct xl_heap_new_cid xl_heap_new_cid
 
typedef struct xl_heap_rewrite_mapping xl_heap_rewrite_mapping
 

Functions

void HeapTupleHeaderAdvanceConflictHorizon (HeapTupleHeader tuple, TransactionId *snapshotConflictHorizon)
 
void heap_redo (XLogReaderState *record)
 
void heap_desc (StringInfo buf, XLogReaderState *record)
 
const charheap_identify (uint8 info)
 
void heap_mask (char *pagedata, BlockNumber blkno)
 
void heap2_redo (XLogReaderState *record)
 
void heap2_desc (StringInfo buf, XLogReaderState *record)
 
const charheap2_identify (uint8 info)
 
void heap_xlog_logical_rewrite (XLogReaderState *r)
 
XLogRecPtr log_heap_visible (Relation rel, Buffer heap_buffer, Buffer vm_buffer, TransactionId snapshotConflictHorizon, uint8 vmflags)
 
void heap_xlog_deserialize_prune_and_freeze (char *cursor, uint16 flags, int *nplans, xlhp_freeze_plan **plans, OffsetNumber **frz_offsets, int *nredirected, OffsetNumber **redirected, int *ndead, OffsetNumber **nowdead, int *nunused, OffsetNumber **nowunused)
 

Macro Definition Documentation

◆ MinSizeOfHeapInplace

#define MinSizeOfHeapInplace   (offsetof(xl_heap_inplace, nmsgs) + sizeof(int))

Definition at line 444 of file heapam_xlog.h.

◆ SizeOfHeapConfirm

#define SizeOfHeapConfirm   (offsetof(xl_heap_confirm, offnum) + sizeof(OffsetNumber))

Definition at line 431 of file heapam_xlog.h.

◆ SizeOfHeapDelete

#define SizeOfHeapDelete   (offsetof(xl_heap_delete, flags) + sizeof(uint8))

Definition at line 121 of file heapam_xlog.h.

◆ SizeOfHeapHeader

#define SizeOfHeapHeader   (offsetof(xl_heap_header, t_hoff) + sizeof(uint8))

Definition at line 157 of file heapam_xlog.h.

◆ SizeOfHeapInsert

#define SizeOfHeapInsert   (offsetof(xl_heap_insert, flags) + sizeof(uint8))

Definition at line 168 of file heapam_xlog.h.

◆ SizeOfHeapLock

#define SizeOfHeapLock   (offsetof(xl_heap_lock, flags) + sizeof(uint8))

Definition at line 412 of file heapam_xlog.h.

◆ SizeOfHeapLockUpdated

#define SizeOfHeapLockUpdated   (offsetof(xl_heap_lock_updated, flags) + sizeof(uint8))

Definition at line 423 of file heapam_xlog.h.

◆ SizeOfHeapMultiInsert

#define SizeOfHeapMultiInsert   offsetof(xl_heap_multi_insert, offsets)

Definition at line 188 of file heapam_xlog.h.

◆ SizeOfHeapNewCid

#define SizeOfHeapNewCid   (offsetof(xl_heap_new_cid, target_tid) + sizeof(ItemPointerData))

Definition at line 478 of file heapam_xlog.h.

◆ SizeOfHeapPrune

#define SizeOfHeapPrune   (offsetof(xl_heap_prune, flags) + sizeof(uint16))

Definition at line 295 of file heapam_xlog.h.

◆ SizeOfHeapTruncate

#define SizeOfHeapTruncate   (offsetof(xl_heap_truncate, relids))

Definition at line 142 of file heapam_xlog.h.

◆ SizeOfHeapUpdate

#define SizeOfHeapUpdate   (offsetof(xl_heap_update, new_offnum) + sizeof(OffsetNumber))

Definition at line 233 of file heapam_xlog.h.

◆ SizeOfHeapVisible

#define SizeOfHeapVisible   (offsetof(xl_heap_visible, flags) + sizeof(uint8))

Definition at line 458 of file heapam_xlog.h.

◆ SizeOfMultiInsertTuple

#define SizeOfMultiInsertTuple   (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8))

Definition at line 199 of file heapam_xlog.h.

◆ XLH_DELETE_ALL_VISIBLE_CLEARED

#define XLH_DELETE_ALL_VISIBLE_CLEARED   (1<<0)

Definition at line 102 of file heapam_xlog.h.

◆ XLH_DELETE_CONTAINS_OLD

Definition at line 109 of file heapam_xlog.h.

113{
114 TransactionId xmax; /* xmax of the deleted tuple */
115 OffsetNumber offnum; /* deleted tuple's offset */
116 uint8 infobits_set; /* infomask bits */
117 uint8 flags;
119
120#define SizeOfHeapDelete (offsetof(xl_heap_delete, flags) + sizeof(uint8))
121
122/*
123 * xl_heap_truncate flag values, 8 bits are available.
124 */
125#define XLH_TRUNCATE_CASCADE (1<<0)
126#define XLH_TRUNCATE_RESTART_SEQS (1<<1)
127
128/*
129 * For truncate we list all truncated relids in an array, followed by all
130 * sequence relids that need to be restarted, if any.
131 * All rels are always within the same database, so we just list dbid once.
132 */
133typedef struct xl_heap_truncate
134{
135 Oid dbId;
137 uint8 flags;
140
141#define SizeOfHeapTruncate (offsetof(xl_heap_truncate, relids))
142
143/*
144 * We don't store the whole fixed part (HeapTupleHeaderData) of an inserted
145 * or updated tuple in WAL; we can save a few bytes by reconstructing the
146 * fields that are available elsewhere in the WAL record, or perhaps just
147 * plain needn't be reconstructed. These are the fields we must store.
148 */
149typedef struct xl_heap_header
150{
155
156#define SizeOfHeapHeader (offsetof(xl_heap_header, t_hoff) + sizeof(uint8))
157
158/* This is what we need to know about insert */
159typedef struct xl_heap_insert
160{
161 OffsetNumber offnum; /* inserted tuple's offset */
162 uint8 flags;
163
164 /* xl_heap_header & TUPLE DATA in backup block 0 */
166
167#define SizeOfHeapInsert (offsetof(xl_heap_insert, flags) + sizeof(uint8))
168
169/*
170 * This is what we need to know about a multi-insert.
171 *
172 * The main data of the record consists of this xl_heap_multi_insert header.
173 * 'offsets' array is omitted if the whole page is reinitialized
174 * (XLOG_HEAP_INIT_PAGE).
175 *
176 * In block 0's data portion, there is an xl_multi_insert_tuple struct,
177 * followed by the tuple data for each tuple. There is padding to align
178 * each xl_multi_insert_tuple struct.
179 */
180typedef struct xl_heap_multi_insert
181{
182 uint8 flags;
186
187#define SizeOfHeapMultiInsert offsetof(xl_heap_multi_insert, offsets)
188
189typedef struct xl_multi_insert_tuple
190{
191 uint16 datalen; /* size of tuple data that follows */
195 /* TUPLE DATA FOLLOWS AT END OF STRUCT */
197
198#define SizeOfMultiInsertTuple (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8))
199
200/*
201 * This is what we need to know about update|hot_update
202 *
203 * Backup blk 0: new page
204 *
205 * If XLH_UPDATE_PREFIX_FROM_OLD or XLH_UPDATE_SUFFIX_FROM_OLD flags are set,
206 * the prefix and/or suffix come first, as one or two uint16s.
207 *
208 * After that, xl_heap_header and new tuple data follow. The new tuple
209 * data doesn't include the prefix and suffix, which are copied from the
210 * old tuple on replay.
211 *
212 * If XLH_UPDATE_CONTAINS_NEW_TUPLE flag is given, the tuple data is
213 * included even if a full-page image was taken.
214 *
215 * Backup blk 1: old page, if different. (no data, just a reference to the blk)
216 */
217typedef struct xl_heap_update
218{
219 TransactionId old_xmax; /* xmax of the old tuple */
220 OffsetNumber old_offnum; /* old tuple's offset */
221 uint8 old_infobits_set; /* infomask bits to set on old tuple */
222 uint8 flags;
223 TransactionId new_xmax; /* xmax of the new tuple */
224 OffsetNumber new_offnum; /* new tuple's offset */
225
226 /*
227 * If XLH_UPDATE_CONTAINS_OLD_TUPLE or XLH_UPDATE_CONTAINS_OLD_KEY flags
228 * are set, xl_heap_header and tuple data for the old tuple follow.
229 */
231
232#define SizeOfHeapUpdate (offsetof(xl_heap_update, new_offnum) + sizeof(OffsetNumber))
233
234/*
235 * These structures and flags encode VACUUM pruning and freezing and on-access
236 * pruning page modifications.
237 *
238 * xl_heap_prune is the main record. The XLHP_HAS_* flags indicate which
239 * "sub-records" are included and the other XLHP_* flags provide additional
240 * information about the conditions for replay.
241 *
242 * The data for block reference 0 contains "sub-records" depending on which of
243 * the XLHP_HAS_* flags are set. See xlhp_* struct definitions below. The
244 * sub-records appear in the same order as the XLHP_* flags. An example
245 * record with every sub-record included:
246 *
247 *-----------------------------------------------------------------------------
248 * Main data section:
249 *
250 * xl_heap_prune
251 * uint16 flags
252 * TransactionId snapshot_conflict_horizon
253 *
254 * Block 0 data section:
255 *
256 * xlhp_freeze_plans
257 * uint16 nplans
258 * [2 bytes of padding]
259 * xlhp_freeze_plan plans[nplans]
260 *
261 * xlhp_prune_items
262 * uint16 nredirected
263 * OffsetNumber redirected[2 * nredirected]
264 *
265 * xlhp_prune_items
266 * uint16 ndead
267 * OffsetNumber nowdead[ndead]
268 *
269 * xlhp_prune_items
270 * uint16 nunused
271 * OffsetNumber nowunused[nunused]
272 *
273 * OffsetNumber frz_offsets[sum([plan.ntuples for plan in plans])]
274 *-----------------------------------------------------------------------------
275 *
276 * NOTE: because the record data is assembled from many optional parts, we
277 * have to pay close attention to alignment. In the main data section,
278 * 'snapshot_conflict_horizon' is stored unaligned after 'flags', to save
279 * space. In the block 0 data section, the freeze plans appear first, because
280 * they contain TransactionId fields that require 4-byte alignment. All the
281 * other fields require only 2-byte alignment. This is also the reason that
282 * 'frz_offsets' is stored separately from the xlhp_freeze_plan structs.
283 */
284typedef struct xl_heap_prune
285{
287
288 /*
289 * If XLHP_HAS_CONFLICT_HORIZON is set, the conflict horizon XID follows,
290 * unaligned
291 */
293
294#define SizeOfHeapPrune (offsetof(xl_heap_prune, flags) + sizeof(uint16))
295
296/* to handle recovery conflict during logical decoding on standby */
297#define XLHP_IS_CATALOG_REL (1 << 1)
298
299/*
300 * Does replaying the record require a cleanup-lock?
301 *
302 * Pruning, in VACUUM's first pass or when otherwise accessing a page,
303 * requires a cleanup lock. For freezing, and VACUUM's second pass which
304 * marks LP_DEAD line pointers as unused without moving any tuple data, an
305 * ordinary exclusive lock is sufficient.
306 */
307#define XLHP_CLEANUP_LOCK (1 << 2)
308
309/*
310 * If we remove or freeze any entries that contain xids, we need to include a
311 * snapshot conflict horizon. It's used in Hot Standby mode to ensure that
312 * there are no queries running for which the removed tuples are still
313 * visible, or which still consider the frozen XIDs as running.
314 */
315#define XLHP_HAS_CONFLICT_HORIZON (1 << 3)
316
317/*
318 * Indicates that an xlhp_freeze_plans sub-record and one or more
319 * xlhp_freeze_plan sub-records are present.
320 */
321#define XLHP_HAS_FREEZE_PLANS (1 << 4)
322
323/*
324 * XLHP_HAS_REDIRECTIONS, XLHP_HAS_DEAD_ITEMS, and XLHP_HAS_NOW_UNUSED_ITEMS
325 * indicate that xlhp_prune_items sub-records with redirected, dead, and
326 * unused item offsets are present.
327 */
328#define XLHP_HAS_REDIRECTIONS (1 << 5)
329#define XLHP_HAS_DEAD_ITEMS (1 << 6)
330#define XLHP_HAS_NOW_UNUSED_ITEMS (1 << 7)
331
332/*
333 * The xl_heap_prune record's flags may also contain which VM bits to set.
334 * xl_heap_prune should always use the XLHP_VM_ALL_VISIBLE and
335 * XLHP_VM_ALL_FROZEN flags and translate them to their visibilitymapdefs.h
336 * equivalents, VISIBILITYMAP_ALL_VISIBLE and VISIBILITYMAP_ALL_FROZEN.
337 */
338#define XLHP_VM_ALL_VISIBLE (1 << 8)
339#define XLHP_VM_ALL_FROZEN (1 << 9)
340
341/*
342 * xlhp_freeze_plan describes how to freeze a group of one or more heap tuples
343 * (appears in xl_heap_prune's xlhp_freeze_plans sub-record)
344 */
345/* 0x01 was XLH_FREEZE_XMIN */
346#define XLH_FREEZE_XVAC 0x02
347#define XLH_INVALID_XVAC 0x04
348
349typedef struct xlhp_freeze_plan
350{
355
356 /* Length of individual page offset numbers array for this plan */
359
360/*
361 * This is what we need to know about a block being frozen during vacuum
362 *
363 * The backup block's data contains an array of xlhp_freeze_plan structs (with
364 * nplans elements). The individual item offsets are located in an array at
365 * the end of the entire record with nplans * (each plan's ntuples) members
366 * Those offsets are in the same order as the plans. The REDO routine uses
367 * the offsets to freeze the corresponding heap tuples.
368 *
369 * (As of PostgreSQL 17, XLOG_HEAP2_PRUNE_VACUUM_SCAN records replace the
370 * separate XLOG_HEAP2_FREEZE_PAGE records.)
371 */
372typedef struct xlhp_freeze_plans
373{
377
378/*
379 * Generic sub-record type contained in block reference 0 of an xl_heap_prune
380 * record and used for redirect, dead, and unused items if any of
381 * XLHP_HAS_REDIRECTIONS/XLHP_HAS_DEAD_ITEMS/XLHP_HAS_NOW_UNUSED_ITEMS are
382 * set. Note that in the XLHP_HAS_REDIRECTIONS variant, there are actually 2
383 * * length number of OffsetNumbers in the data.
384 */
385typedef struct xlhp_prune_items
386{
390
391
392/* flags for infobits_set */
393#define XLHL_XMAX_IS_MULTI 0x01
394#define XLHL_XMAX_LOCK_ONLY 0x02
395#define XLHL_XMAX_EXCL_LOCK 0x04
396#define XLHL_XMAX_KEYSHR_LOCK 0x08
397#define XLHL_KEYS_UPDATED 0x10
398
399/* flag bits for xl_heap_lock / xl_heap_lock_updated's flag field */
400#define XLH_LOCK_ALL_FROZEN_CLEARED 0x01
401
402/* This is what we need to know about lock */
403typedef struct xl_heap_lock
404{
405 TransactionId xmax; /* might be a MultiXactId */
406 OffsetNumber offnum; /* locked tuple's offset on page */
407 uint8 infobits_set; /* infomask and infomask2 bits to set */
408 uint8 flags; /* XLH_LOCK_* flag bits */
410
411#define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(uint8))
412
413/* This is what we need to know about locking an updated version of a row */
414typedef struct xl_heap_lock_updated
415{
419 uint8 flags;
421
422#define SizeOfHeapLockUpdated (offsetof(xl_heap_lock_updated, flags) + sizeof(uint8))
423
424/* This is what we need to know about confirmation of speculative insertion */
425typedef struct xl_heap_confirm
426{
427 OffsetNumber offnum; /* confirmed tuple's offset on page */
429
430#define SizeOfHeapConfirm (offsetof(xl_heap_confirm, offnum) + sizeof(OffsetNumber))
431
432/* This is what we need to know about in-place update */
433typedef struct xl_heap_inplace
434{
435 OffsetNumber offnum; /* updated tuple's offset on page */
436 Oid dbId; /* MyDatabaseId */
437 Oid tsId; /* MyDatabaseTableSpace */
438 bool relcacheInitFileInval; /* invalidate relcache init files */
439 int nmsgs; /* number of shared inval msgs */
442
443#define MinSizeOfHeapInplace (offsetof(xl_heap_inplace, nmsgs) + sizeof(int))
444
445/*
446 * This is what we need to know about setting a visibility map bit
447 *
448 * Backup blk 0: visibility map buffer
449 * Backup blk 1: heap buffer
450 */
451typedef struct xl_heap_visible
452{
454 uint8 flags;
456
457#define SizeOfHeapVisible (offsetof(xl_heap_visible, flags) + sizeof(uint8))
458
459typedef struct xl_heap_new_cid
460{
461 /*
462 * store toplevel xid so we don't have to merge cids from different
463 * transactions
464 */
468 CommandId combocid; /* just for debugging */
469
470 /*
471 * Store the relfilelocator/ctid pair to facilitate lookups.
472 */
476
477#define SizeOfHeapNewCid (offsetof(xl_heap_new_cid, target_tid) + sizeof(ItemPointerData))
478
479/* logical rewrite xlog record header */
480typedef struct xl_heap_rewrite_mapping
481{
482 TransactionId mapped_xid; /* xid that might need to see the row */
483 Oid mapped_db; /* DbOid or InvalidOid for shared rels */
484 Oid mapped_rel; /* Oid of the mapped relation */
485 off_t offset; /* How far have we written so far */
486 uint32 num_mappings; /* Number of in-memory mappings */
487 XLogRecPtr start_lsn; /* Insert LSN at begin of rewrite */
489
491 TransactionId *snapshotConflictHorizon);
492
493extern void heap_redo(XLogReaderState *record);
494extern void heap_desc(StringInfo buf, XLogReaderState *record);
495extern const char *heap_identify(uint8 info);
496extern void heap_mask(char *pagedata, BlockNumber blkno);
497extern void heap2_redo(XLogReaderState *record);
498extern void heap2_desc(StringInfo buf, XLogReaderState *record);
499extern const char *heap2_identify(uint8 info);
501
504 TransactionId snapshotConflictHorizon,
505 uint8 vmflags);
506
507/* in heapdesc.c, so it can be shared between frontend/backend code */
509 int *nplans, xlhp_freeze_plan **plans,
511 int *nredirected, OffsetNumber **redirected,
512 int *ndead, OffsetNumber **nowdead,
513 int *nunused, OffsetNumber **nowunused);
514
515#endif /* HEAPAM_XLOG_H */
uint32 BlockNumber
Definition block.h:31
int Buffer
Definition buf.h:23
uint8_t uint8
Definition c.h:544
#define FLEXIBLE_ARRAY_MEMBER
Definition c.h:480
uint16_t uint16
Definition c.h:545
uint32_t uint32
Definition c.h:546
uint32 CommandId
Definition c.h:680
uint32 TransactionId
Definition c.h:666
XLogRecPtr log_heap_visible(Relation rel, Buffer heap_buffer, Buffer vm_buffer, TransactionId snapshotConflictHorizon, uint8 vmflags)
Definition heapam.c:8893
void heap_desc(StringInfo buf, XLogReaderState *record)
Definition heapdesc.c:185
void heap_redo(XLogReaderState *record)
void heap2_desc(StringInfo buf, XLogReaderState *record)
Definition heapdesc.c:265
void heap_xlog_deserialize_prune_and_freeze(char *cursor, uint16 flags, int *nplans, xlhp_freeze_plan **plans, OffsetNumber **frz_offsets, int *nredirected, OffsetNumber **redirected, int *ndead, OffsetNumber **nowdead, int *nunused, OffsetNumber **nowunused)
Definition heapdesc.c:106
void heap_mask(char *pagedata, BlockNumber blkno)
void HeapTupleHeaderAdvanceConflictHorizon(HeapTupleHeader tuple, TransactionId *snapshotConflictHorizon)
Definition heapam.c:8062
void heap_xlog_logical_rewrite(XLogReaderState *r)
const char * heap2_identify(uint8 info)
Definition heapdesc.c:449
const char * heap_identify(uint8 info)
Definition heapdesc.c:404
void heap2_redo(XLogReaderState *record)
uint16 OffsetNumber
Definition off.h:24
static char buf[DEFAULT_XLOG_SEG_SIZE]
unsigned int Oid
static int fb(int x)
Definition type.h:138
OffsetNumber offnum
OffsetNumber offnum
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
bool relcacheInitFileInval
OffsetNumber offnum
TransactionId xmax
OffsetNumber offnum
uint8 infobits_set
OffsetNumber offnum
TransactionId xmax
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]
CommandId combocid
ItemPointerData target_tid
TransactionId top_xid
RelFileLocator target_locator
TransactionId mapped_xid
Oid relids[FLEXIBLE_ARRAY_MEMBER]
TransactionId new_xmax
uint8 old_infobits_set
TransactionId old_xmax
OffsetNumber old_offnum
OffsetNumber new_offnum
TransactionId snapshotConflictHorizon
TransactionId xmax
xlhp_freeze_plan plans[FLEXIBLE_ARRAY_MEMBER]
OffsetNumber data[FLEXIBLE_ARRAY_MEMBER]
uint64 XLogRecPtr
Definition xlogdefs.h:21

◆ XLH_DELETE_CONTAINS_OLD_KEY

#define XLH_DELETE_CONTAINS_OLD_KEY   (1<<2)

Definition at line 104 of file heapam_xlog.h.

◆ XLH_DELETE_CONTAINS_OLD_TUPLE

#define XLH_DELETE_CONTAINS_OLD_TUPLE   (1<<1)

Definition at line 103 of file heapam_xlog.h.

◆ XLH_DELETE_IS_PARTITION_MOVE

#define XLH_DELETE_IS_PARTITION_MOVE   (1<<4)

Definition at line 106 of file heapam_xlog.h.

◆ XLH_DELETE_IS_SUPER

#define XLH_DELETE_IS_SUPER   (1<<3)

Definition at line 105 of file heapam_xlog.h.

◆ XLH_FREEZE_XVAC

#define XLH_FREEZE_XVAC   0x02

Definition at line 347 of file heapam_xlog.h.

◆ XLH_INSERT_ALL_FROZEN_SET

#define XLH_INSERT_ALL_FROZEN_SET   (1<<5)

Definition at line 79 of file heapam_xlog.h.

◆ XLH_INSERT_ALL_VISIBLE_CLEARED

#define XLH_INSERT_ALL_VISIBLE_CLEARED   (1<<0)

Definition at line 72 of file heapam_xlog.h.

◆ XLH_INSERT_CONTAINS_NEW_TUPLE

#define XLH_INSERT_CONTAINS_NEW_TUPLE   (1<<3)

Definition at line 75 of file heapam_xlog.h.

◆ XLH_INSERT_IS_SPECULATIVE

#define XLH_INSERT_IS_SPECULATIVE   (1<<2)

Definition at line 74 of file heapam_xlog.h.

◆ XLH_INSERT_LAST_IN_MULTI

#define XLH_INSERT_LAST_IN_MULTI   (1<<1)

Definition at line 73 of file heapam_xlog.h.

◆ XLH_INSERT_ON_TOAST_RELATION

#define XLH_INSERT_ON_TOAST_RELATION   (1<<4)

Definition at line 76 of file heapam_xlog.h.

◆ XLH_INVALID_XVAC

#define XLH_INVALID_XVAC   0x04

Definition at line 348 of file heapam_xlog.h.

◆ XLH_LOCK_ALL_FROZEN_CLEARED

#define XLH_LOCK_ALL_FROZEN_CLEARED   0x01

Definition at line 401 of file heapam_xlog.h.

◆ XLH_TRUNCATE_CASCADE

#define XLH_TRUNCATE_CASCADE   (1<<0)

Definition at line 126 of file heapam_xlog.h.

◆ XLH_TRUNCATE_RESTART_SEQS

#define XLH_TRUNCATE_RESTART_SEQS   (1<<1)

Definition at line 127 of file heapam_xlog.h.

◆ XLH_UPDATE_CONTAINS_NEW_TUPLE

#define XLH_UPDATE_CONTAINS_NEW_TUPLE   (1<<4)

Definition at line 90 of file heapam_xlog.h.

◆ XLH_UPDATE_CONTAINS_OLD

Definition at line 95 of file heapam_xlog.h.

◆ XLH_UPDATE_CONTAINS_OLD_KEY

#define XLH_UPDATE_CONTAINS_OLD_KEY   (1<<3)

Definition at line 89 of file heapam_xlog.h.

◆ XLH_UPDATE_CONTAINS_OLD_TUPLE

#define XLH_UPDATE_CONTAINS_OLD_TUPLE   (1<<2)

Definition at line 88 of file heapam_xlog.h.

◆ XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED

#define XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED   (1<<1)

Definition at line 87 of file heapam_xlog.h.

◆ XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED

#define XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED   (1<<0)

Definition at line 85 of file heapam_xlog.h.

◆ XLH_UPDATE_PREFIX_FROM_OLD

#define XLH_UPDATE_PREFIX_FROM_OLD   (1<<5)

Definition at line 91 of file heapam_xlog.h.

◆ XLH_UPDATE_SUFFIX_FROM_OLD

#define XLH_UPDATE_SUFFIX_FROM_OLD   (1<<6)

Definition at line 92 of file heapam_xlog.h.

◆ XLHL_KEYS_UPDATED

#define XLHL_KEYS_UPDATED   0x10

Definition at line 398 of file heapam_xlog.h.

◆ XLHL_XMAX_EXCL_LOCK

#define XLHL_XMAX_EXCL_LOCK   0x04

Definition at line 396 of file heapam_xlog.h.

◆ XLHL_XMAX_IS_MULTI

#define XLHL_XMAX_IS_MULTI   0x01

Definition at line 394 of file heapam_xlog.h.

◆ XLHL_XMAX_KEYSHR_LOCK

#define XLHL_XMAX_KEYSHR_LOCK   0x08

Definition at line 397 of file heapam_xlog.h.

◆ XLHL_XMAX_LOCK_ONLY

#define XLHL_XMAX_LOCK_ONLY   0x02

Definition at line 395 of file heapam_xlog.h.

◆ XLHP_CLEANUP_LOCK

#define XLHP_CLEANUP_LOCK   (1 << 2)

Definition at line 308 of file heapam_xlog.h.

◆ XLHP_HAS_CONFLICT_HORIZON

#define XLHP_HAS_CONFLICT_HORIZON   (1 << 3)

Definition at line 316 of file heapam_xlog.h.

◆ XLHP_HAS_DEAD_ITEMS

#define XLHP_HAS_DEAD_ITEMS   (1 << 6)

Definition at line 330 of file heapam_xlog.h.

◆ XLHP_HAS_FREEZE_PLANS

#define XLHP_HAS_FREEZE_PLANS   (1 << 4)

Definition at line 322 of file heapam_xlog.h.

◆ XLHP_HAS_NOW_UNUSED_ITEMS

#define XLHP_HAS_NOW_UNUSED_ITEMS   (1 << 7)

Definition at line 331 of file heapam_xlog.h.

◆ XLHP_HAS_REDIRECTIONS

#define XLHP_HAS_REDIRECTIONS   (1 << 5)

Definition at line 329 of file heapam_xlog.h.

◆ XLHP_IS_CATALOG_REL

#define XLHP_IS_CATALOG_REL   (1 << 1)

Definition at line 298 of file heapam_xlog.h.

◆ XLHP_VM_ALL_FROZEN

#define XLHP_VM_ALL_FROZEN   (1 << 9)

Definition at line 340 of file heapam_xlog.h.

◆ XLHP_VM_ALL_VISIBLE

#define XLHP_VM_ALL_VISIBLE   (1 << 8)

Definition at line 339 of file heapam_xlog.h.

◆ XLOG_HEAP2_LOCK_UPDATED

#define XLOG_HEAP2_LOCK_UPDATED   0x60

Definition at line 65 of file heapam_xlog.h.

◆ XLOG_HEAP2_MULTI_INSERT

#define XLOG_HEAP2_MULTI_INSERT   0x50

Definition at line 64 of file heapam_xlog.h.

◆ XLOG_HEAP2_NEW_CID

#define XLOG_HEAP2_NEW_CID   0x70

Definition at line 66 of file heapam_xlog.h.

◆ XLOG_HEAP2_PRUNE_ON_ACCESS

#define XLOG_HEAP2_PRUNE_ON_ACCESS   0x10

Definition at line 60 of file heapam_xlog.h.

◆ XLOG_HEAP2_PRUNE_VACUUM_CLEANUP

#define XLOG_HEAP2_PRUNE_VACUUM_CLEANUP   0x30

Definition at line 62 of file heapam_xlog.h.

◆ XLOG_HEAP2_PRUNE_VACUUM_SCAN

#define XLOG_HEAP2_PRUNE_VACUUM_SCAN   0x20

Definition at line 61 of file heapam_xlog.h.

◆ XLOG_HEAP2_REWRITE

#define XLOG_HEAP2_REWRITE   0x00

Definition at line 59 of file heapam_xlog.h.

◆ XLOG_HEAP2_VISIBLE

#define XLOG_HEAP2_VISIBLE   0x40

Definition at line 63 of file heapam_xlog.h.

◆ XLOG_HEAP_CONFIRM

#define XLOG_HEAP_CONFIRM   0x50

Definition at line 38 of file heapam_xlog.h.

◆ XLOG_HEAP_DELETE

#define XLOG_HEAP_DELETE   0x10

Definition at line 34 of file heapam_xlog.h.

◆ XLOG_HEAP_HOT_UPDATE

#define XLOG_HEAP_HOT_UPDATE   0x40

Definition at line 37 of file heapam_xlog.h.

◆ XLOG_HEAP_INIT_PAGE

#define XLOG_HEAP_INIT_PAGE   0x80

Definition at line 47 of file heapam_xlog.h.

◆ XLOG_HEAP_INPLACE

#define XLOG_HEAP_INPLACE   0x70

Definition at line 40 of file heapam_xlog.h.

◆ XLOG_HEAP_INSERT

#define XLOG_HEAP_INSERT   0x00

Definition at line 33 of file heapam_xlog.h.

◆ XLOG_HEAP_LOCK

#define XLOG_HEAP_LOCK   0x60

Definition at line 39 of file heapam_xlog.h.

◆ XLOG_HEAP_OPMASK

#define XLOG_HEAP_OPMASK   0x70

Definition at line 42 of file heapam_xlog.h.

◆ XLOG_HEAP_TRUNCATE

#define XLOG_HEAP_TRUNCATE   0x30

Definition at line 36 of file heapam_xlog.h.

◆ XLOG_HEAP_UPDATE

#define XLOG_HEAP_UPDATE   0x20

Definition at line 35 of file heapam_xlog.h.

Typedef Documentation

◆ xl_heap_confirm

◆ xl_heap_delete

◆ xl_heap_header

◆ xl_heap_inplace

◆ xl_heap_insert

◆ xl_heap_lock

◆ xl_heap_lock_updated

◆ xl_heap_multi_insert

◆ xl_heap_new_cid

◆ xl_heap_prune

◆ xl_heap_rewrite_mapping

◆ xl_heap_truncate

◆ xl_heap_update

◆ xl_heap_visible

◆ xl_multi_insert_tuple

◆ xlhp_freeze_plan

◆ xlhp_freeze_plans

◆ xlhp_prune_items

Function Documentation

◆ heap2_desc()

void heap2_desc ( StringInfo  buf,
XLogReaderState record 
)
extern

Definition at line 265 of file heapdesc.c.

266{
267 char *rec = XLogRecGetData(record);
268 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
269
270 info &= XLOG_HEAP_OPMASK;
271 if (info == XLOG_HEAP2_PRUNE_ON_ACCESS ||
274 {
276
277 if (xlrec->flags & XLHP_HAS_CONFLICT_HORIZON)
278 {
280
282
283 appendStringInfo(buf, "snapshotConflictHorizon: %u",
285 }
286
287 appendStringInfo(buf, ", isCatalogRel: %c",
288 xlrec->flags & XLHP_IS_CATALOG_REL ? 'T' : 'F');
289
290 if (xlrec->flags & XLHP_VM_ALL_VISIBLE)
291 {
293
294 if (xlrec->flags & XLHP_VM_ALL_FROZEN)
296 appendStringInfo(buf, ", vm_flags: 0x%02X", vmflags);
297 }
298
299 if (XLogRecHasBlockData(record, 0))
300 {
301 Size datalen;
302 OffsetNumber *redirected;
303 OffsetNumber *nowdead;
304 OffsetNumber *nowunused;
305 int nredirected;
306 int nunused;
307 int ndead;
308 int nplans;
309 xlhp_freeze_plan *plans;
311
312 char *cursor = XLogRecGetBlockData(record, 0, &datalen);
313
315 &nplans, &plans, &frz_offsets,
316 &nredirected, &redirected,
317 &ndead, &nowdead,
318 &nunused, &nowunused);
319
320 appendStringInfo(buf, ", nplans: %u, nredirected: %u, ndead: %u, nunused: %u",
321 nplans, nredirected, ndead, nunused);
322
323 if (nplans > 0)
324 {
325 appendStringInfoString(buf, ", plans:");
326 array_desc(buf, plans, sizeof(xlhp_freeze_plan), nplans,
328 }
329
330 if (nredirected > 0)
331 {
332 appendStringInfoString(buf, ", redirected:");
333 array_desc(buf, redirected, sizeof(OffsetNumber) * 2,
334 nredirected, &redirect_elem_desc, NULL);
335 }
336
337 if (ndead > 0)
338 {
339 appendStringInfoString(buf, ", dead:");
340 array_desc(buf, nowdead, sizeof(OffsetNumber), ndead,
342 }
343
344 if (nunused > 0)
345 {
346 appendStringInfoString(buf, ", unused:");
347 array_desc(buf, nowunused, sizeof(OffsetNumber), nunused,
349 }
350 }
351 }
352 else if (info == XLOG_HEAP2_VISIBLE)
353 {
355
356 appendStringInfo(buf, "snapshotConflictHorizon: %u, flags: 0x%02X",
357 xlrec->snapshotConflictHorizon, xlrec->flags);
358 }
359 else if (info == XLOG_HEAP2_MULTI_INSERT)
360 {
362 bool isinit = (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) != 0;
363
364 appendStringInfo(buf, "ntuples: %d, flags: 0x%02X", xlrec->ntuples,
365 xlrec->flags);
366
367 if (xlrec->flags & XLH_INSERT_ALL_FROZEN_SET)
368 appendStringInfo(buf, ", vm_flags: 0x%02X",
371
372 if (XLogRecHasBlockData(record, 0) && !isinit)
373 {
374 appendStringInfoString(buf, ", offsets:");
375 array_desc(buf, xlrec->offsets, sizeof(OffsetNumber),
376 xlrec->ntuples, &offset_elem_desc, NULL);
377 }
378 }
379 else if (info == XLOG_HEAP2_LOCK_UPDATED)
380 {
382
383 appendStringInfo(buf, "xmax: %u, off: %u, ",
384 xlrec->xmax, xlrec->offnum);
385 infobits_desc(buf, xlrec->infobits_set, "infobits");
386 appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
387 }
388 else if (info == XLOG_HEAP2_NEW_CID)
389 {
391
392 appendStringInfo(buf, "rel: %u/%u/%u, tid: %u/%u",
393 xlrec->target_locator.spcOid,
394 xlrec->target_locator.dbOid,
395 xlrec->target_locator.relNumber,
396 ItemPointerGetBlockNumber(&(xlrec->target_tid)),
397 ItemPointerGetOffsetNumber(&(xlrec->target_tid)));
398 appendStringInfo(buf, ", cmin: %u, cmax: %u, combo: %u",
399 xlrec->cmin, xlrec->cmax, xlrec->combocid);
400 }
401}
size_t Size
Definition c.h:619
#define XLOG_HEAP2_MULTI_INSERT
Definition heapam_xlog.h:64
#define XLHP_HAS_CONFLICT_HORIZON
#define XLHP_VM_ALL_VISIBLE
#define XLH_INSERT_ALL_FROZEN_SET
Definition heapam_xlog.h:79
#define XLOG_HEAP_OPMASK
Definition heapam_xlog.h:42
#define SizeOfHeapPrune
#define XLHP_VM_ALL_FROZEN
#define XLOG_HEAP2_PRUNE_VACUUM_SCAN
Definition heapam_xlog.h:61
#define XLOG_HEAP2_LOCK_UPDATED
Definition heapam_xlog.h:65
#define XLOG_HEAP2_PRUNE_ON_ACCESS
Definition heapam_xlog.h:60
#define XLOG_HEAP2_NEW_CID
Definition heapam_xlog.h:66
#define XLOG_HEAP2_PRUNE_VACUUM_CLEANUP
Definition heapam_xlog.h:62
#define XLOG_HEAP2_VISIBLE
Definition heapam_xlog.h:63
#define XLHP_IS_CATALOG_REL
#define XLOG_HEAP_INIT_PAGE
Definition heapam_xlog.h:47
void heap_xlog_deserialize_prune_and_freeze(char *cursor, uint16 flags, int *nplans, xlhp_freeze_plan **plans, OffsetNumber **frz_offsets, int *nredirected, OffsetNumber **redirected, int *ndead, OffsetNumber **nowdead, int *nunused, OffsetNumber **nowunused)
Definition heapdesc.c:106
static void plan_elem_desc(StringInfo buf, void *plan, void *data)
Definition heapdesc.c:77
static void infobits_desc(StringInfo buf, uint8 infobits, const char *keyname)
Definition heapdesc.c:27
static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
Definition itemptr.h:124
static BlockNumber ItemPointerGetBlockNumber(const ItemPointerData *pointer)
Definition itemptr.h:103
void redirect_elem_desc(StringInfo buf, void *offset, void *data)
void array_desc(StringInfo buf, void *array, size_t elem_size, int count, void(*elem_desc)(StringInfo buf, void *elem, void *data), void *data)
void offset_elem_desc(StringInfo buf, void *offset, void *data)
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
void appendStringInfoString(StringInfo str, const char *s)
Definition stringinfo.c:230
#define VISIBILITYMAP_ALL_FROZEN
#define VISIBILITYMAP_ALL_VISIBLE
char * XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len)
#define XLogRecHasBlockData(decoder, block_id)
Definition xlogreader.h:426
#define XLogRecGetInfo(decoder)
Definition xlogreader.h:409
#define XLogRecGetData(decoder)
Definition xlogreader.h:414

References appendStringInfo(), appendStringInfoString(), array_desc(), buf, fb(), heap_xlog_deserialize_prune_and_freeze(), infobits_desc(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), offset_elem_desc(), plan_elem_desc(), redirect_elem_desc(), SizeOfHeapPrune, VISIBILITYMAP_ALL_FROZEN, VISIBILITYMAP_ALL_VISIBLE, XLH_INSERT_ALL_FROZEN_SET, XLHP_HAS_CONFLICT_HORIZON, XLHP_IS_CATALOG_REL, XLHP_VM_ALL_FROZEN, XLHP_VM_ALL_VISIBLE, XLOG_HEAP2_LOCK_UPDATED, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP2_NEW_CID, XLOG_HEAP2_PRUNE_ON_ACCESS, XLOG_HEAP2_PRUNE_VACUUM_CLEANUP, XLOG_HEAP2_PRUNE_VACUUM_SCAN, XLOG_HEAP2_VISIBLE, XLOG_HEAP_INIT_PAGE, XLOG_HEAP_OPMASK, XLogRecGetBlockData(), XLogRecGetData, XLogRecGetInfo, and XLogRecHasBlockData.

◆ heap2_identify()

const char * heap2_identify ( uint8  info)
extern

Definition at line 449 of file heapdesc.c.

450{
451 const char *id = NULL;
452
453 switch (info & ~XLR_INFO_MASK)
454 {
456 id = "PRUNE_ON_ACCESS";
457 break;
459 id = "PRUNE_VACUUM_SCAN";
460 break;
462 id = "PRUNE_VACUUM_CLEANUP";
463 break;
465 id = "VISIBLE";
466 break;
468 id = "MULTI_INSERT";
469 break;
471 id = "MULTI_INSERT+INIT";
472 break;
474 id = "LOCK_UPDATED";
475 break;
477 id = "NEW_CID";
478 break;
480 id = "REWRITE";
481 break;
482 }
483
484 return id;
485}
#define XLOG_HEAP2_REWRITE
Definition heapam_xlog.h:59
#define XLR_INFO_MASK
Definition xlogrecord.h:62

References fb(), XLOG_HEAP2_LOCK_UPDATED, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP2_NEW_CID, XLOG_HEAP2_PRUNE_ON_ACCESS, XLOG_HEAP2_PRUNE_VACUUM_CLEANUP, XLOG_HEAP2_PRUNE_VACUUM_SCAN, XLOG_HEAP2_REWRITE, XLOG_HEAP2_VISIBLE, XLOG_HEAP_INIT_PAGE, and XLR_INFO_MASK.

◆ heap2_redo()

void heap2_redo ( XLogReaderState record)
extern

Definition at line 1352 of file heapam_xlog.c.

1353{
1354 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
1355
1356 switch (info & XLOG_HEAP_OPMASK)
1357 {
1361 heap_xlog_prune_freeze(record);
1362 break;
1363 case XLOG_HEAP2_VISIBLE:
1364 heap_xlog_visible(record);
1365 break;
1367 heap_xlog_multi_insert(record);
1368 break;
1370 heap_xlog_lock_updated(record);
1371 break;
1372 case XLOG_HEAP2_NEW_CID:
1373
1374 /*
1375 * Nothing to do on a real replay, only used during logical
1376 * decoding.
1377 */
1378 break;
1379 case XLOG_HEAP2_REWRITE:
1381 break;
1382 default:
1383 elog(PANIC, "heap2_redo: unknown op code %u", info);
1384 }
1385}
#define PANIC
Definition elog.h:42
#define elog(elevel,...)
Definition elog.h:226
static void heap_xlog_prune_freeze(XLogReaderState *record)
Definition heapam_xlog.c:30
static void heap_xlog_lock_updated(XLogReaderState *record)
static void heap_xlog_multi_insert(XLogReaderState *record)
static void heap_xlog_visible(XLogReaderState *record)
void heap_xlog_logical_rewrite(XLogReaderState *r)

References elog, fb(), heap_xlog_lock_updated(), heap_xlog_logical_rewrite(), heap_xlog_multi_insert(), heap_xlog_prune_freeze(), heap_xlog_visible(), PANIC, XLOG_HEAP2_LOCK_UPDATED, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP2_NEW_CID, XLOG_HEAP2_PRUNE_ON_ACCESS, XLOG_HEAP2_PRUNE_VACUUM_CLEANUP, XLOG_HEAP2_PRUNE_VACUUM_SCAN, XLOG_HEAP2_REWRITE, XLOG_HEAP2_VISIBLE, XLOG_HEAP_OPMASK, and XLogRecGetInfo.

◆ heap_desc()

void heap_desc ( StringInfo  buf,
XLogReaderState record 
)
extern

Definition at line 185 of file heapdesc.c.

186{
187 char *rec = XLogRecGetData(record);
188 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
189
190 info &= XLOG_HEAP_OPMASK;
191 if (info == XLOG_HEAP_INSERT)
192 {
194
195 appendStringInfo(buf, "off: %u, flags: 0x%02X",
196 xlrec->offnum,
197 xlrec->flags);
198 }
199 else if (info == XLOG_HEAP_DELETE)
200 {
202
203 appendStringInfo(buf, "xmax: %u, off: %u, ",
204 xlrec->xmax, xlrec->offnum);
205 infobits_desc(buf, xlrec->infobits_set, "infobits");
206 appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
207 }
208 else if (info == XLOG_HEAP_UPDATE)
209 {
211
212 appendStringInfo(buf, "old_xmax: %u, old_off: %u, ",
213 xlrec->old_xmax, xlrec->old_offnum);
214 infobits_desc(buf, xlrec->old_infobits_set, "old_infobits");
215 appendStringInfo(buf, ", flags: 0x%02X, new_xmax: %u, new_off: %u",
216 xlrec->flags, xlrec->new_xmax, xlrec->new_offnum);
217 }
218 else if (info == XLOG_HEAP_HOT_UPDATE)
219 {
221
222 appendStringInfo(buf, "old_xmax: %u, old_off: %u, ",
223 xlrec->old_xmax, xlrec->old_offnum);
224 infobits_desc(buf, xlrec->old_infobits_set, "old_infobits");
225 appendStringInfo(buf, ", flags: 0x%02X, new_xmax: %u, new_off: %u",
226 xlrec->flags, xlrec->new_xmax, xlrec->new_offnum);
227 }
228 else if (info == XLOG_HEAP_TRUNCATE)
229 {
231
233 appendStringInfo(buf, ", nrelids: %u", xlrec->nrelids);
234 appendStringInfoString(buf, ", relids:");
235 array_desc(buf, xlrec->relids, sizeof(Oid), xlrec->nrelids,
237 }
238 else if (info == XLOG_HEAP_CONFIRM)
239 {
241
242 appendStringInfo(buf, "off: %u", xlrec->offnum);
243 }
244 else if (info == XLOG_HEAP_LOCK)
245 {
247
248 appendStringInfo(buf, "xmax: %u, off: %u, ",
249 xlrec->xmax, xlrec->offnum);
250 infobits_desc(buf, xlrec->infobits_set, "infobits");
251 appendStringInfo(buf, ", flags: 0x%02X", xlrec->flags);
252 }
253 else if (info == XLOG_HEAP_INPLACE)
254 {
256
257 appendStringInfo(buf, "off: %u", xlrec->offnum);
259 xlrec->dbId, xlrec->tsId,
260 xlrec->relcacheInitFileInval);
261 }
262}
#define XLOG_HEAP_HOT_UPDATE
Definition heapam_xlog.h:37
#define XLOG_HEAP_DELETE
Definition heapam_xlog.h:34
#define XLOG_HEAP_TRUNCATE
Definition heapam_xlog.h:36
#define XLOG_HEAP_UPDATE
Definition heapam_xlog.h:35
#define XLOG_HEAP_INPLACE
Definition heapam_xlog.h:40
#define XLOG_HEAP_LOCK
Definition heapam_xlog.h:39
#define XLOG_HEAP_INSERT
Definition heapam_xlog.h:33
#define XLOG_HEAP_CONFIRM
Definition heapam_xlog.h:38
static void truncate_flags_desc(StringInfo buf, uint8 flags)
Definition heapdesc.c:56
void oid_elem_desc(StringInfo buf, void *relid, void *data)
void standby_desc_invalidations(StringInfo buf, int nmsgs, SharedInvalidationMessage *msgs, Oid dbId, Oid tsId, bool relcacheInitFileInval)

References appendStringInfo(), appendStringInfoString(), array_desc(), buf, fb(), infobits_desc(), oid_elem_desc(), standby_desc_invalidations(), truncate_flags_desc(), XLOG_HEAP_CONFIRM, XLOG_HEAP_DELETE, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INPLACE, XLOG_HEAP_INSERT, XLOG_HEAP_LOCK, XLOG_HEAP_OPMASK, XLOG_HEAP_TRUNCATE, XLOG_HEAP_UPDATE, XLogRecGetData, and XLogRecGetInfo.

◆ heap_identify()

const char * heap_identify ( uint8  info)
extern

Definition at line 404 of file heapdesc.c.

405{
406 const char *id = NULL;
407
408 switch (info & ~XLR_INFO_MASK)
409 {
410 case XLOG_HEAP_INSERT:
411 id = "INSERT";
412 break;
414 id = "INSERT+INIT";
415 break;
416 case XLOG_HEAP_DELETE:
417 id = "DELETE";
418 break;
419 case XLOG_HEAP_UPDATE:
420 id = "UPDATE";
421 break;
423 id = "UPDATE+INIT";
424 break;
426 id = "HOT_UPDATE";
427 break;
429 id = "HOT_UPDATE+INIT";
430 break;
432 id = "TRUNCATE";
433 break;
435 id = "HEAP_CONFIRM";
436 break;
437 case XLOG_HEAP_LOCK:
438 id = "LOCK";
439 break;
441 id = "INPLACE";
442 break;
443 }
444
445 return id;
446}

References fb(), XLOG_HEAP_CONFIRM, XLOG_HEAP_DELETE, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INIT_PAGE, XLOG_HEAP_INPLACE, XLOG_HEAP_INSERT, XLOG_HEAP_LOCK, XLOG_HEAP_TRUNCATE, XLOG_HEAP_UPDATE, and XLR_INFO_MASK.

◆ heap_mask()

void heap_mask ( char pagedata,
BlockNumber  blkno 
)
extern

Definition at line 1391 of file heapam_xlog.c.

1392{
1393 Page page = (Page) pagedata;
1394 OffsetNumber off;
1395
1397
1398 mask_page_hint_bits(page);
1399 mask_unused_space(page);
1400
1401 for (off = 1; off <= PageGetMaxOffsetNumber(page); off++)
1402 {
1403 ItemId iid = PageGetItemId(page, off);
1404 char *page_item;
1405
1406 page_item = (char *) (page + ItemIdGetOffset(iid));
1407
1408 if (ItemIdIsNormal(iid))
1409 {
1411
1412 /*
1413 * If xmin of a tuple is not yet frozen, we should ignore
1414 * differences in hint bits, since they can be set without
1415 * emitting WAL.
1416 */
1419 else
1420 {
1421 /* Still we need to mask xmax hint bits. */
1422 page_htup->t_infomask &= ~HEAP_XMAX_INVALID;
1423 page_htup->t_infomask &= ~HEAP_XMAX_COMMITTED;
1424 }
1425
1426 /*
1427 * During replay, we set Command Id to FirstCommandId. Hence, mask
1428 * it. See heap_xlog_insert() for details.
1429 */
1430 page_htup->t_choice.t_heap.t_field3.t_cid = MASK_MARKER;
1431
1432 /*
1433 * For a speculative tuple, heap_insert() does not set ctid in the
1434 * caller-passed heap tuple itself, leaving the ctid field to
1435 * contain a speculative token value - a per-backend monotonically
1436 * increasing identifier. Besides, it does not WAL-log ctid under
1437 * any circumstances.
1438 *
1439 * During redo, heap_xlog_insert() sets t_ctid to current block
1440 * number and self offset number. It doesn't care about any
1441 * speculative insertions on the primary. Hence, we set t_ctid to
1442 * current block number and self offset number to ignore any
1443 * inconsistency.
1444 */
1446 ItemPointerSet(&page_htup->t_ctid, blkno, off);
1447
1448 /*
1449 * NB: Not ignoring ctid changes due to the tuple having moved
1450 * (i.e. HeapTupleHeaderIndicatesMovedPartitions), because that's
1451 * important information that needs to be in-sync between primary
1452 * and standby, and thus is WAL logged.
1453 */
1454 }
1455
1456 /*
1457 * Ignore any padding bytes after the tuple, when the length of the
1458 * item is not MAXALIGNed.
1459 */
1460 if (ItemIdHasStorage(iid))
1461 {
1462 int len = ItemIdGetLength(iid);
1463 int padlen = MAXALIGN(len) - len;
1464
1465 if (padlen > 0)
1467 }
1468 }
1469}
void mask_page_lsn_and_checksum(Page page)
Definition bufmask.c:31
void mask_unused_space(Page page)
Definition bufmask.c:71
void mask_page_hint_bits(Page page)
Definition bufmask.c:46
#define MASK_MARKER
Definition bufmask.h:24
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
Definition bufpage.h:243
PageData * Page
Definition bufpage.h:81
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
Definition bufpage.h:371
#define MAXALIGN(LEN)
Definition c.h:826
HeapTupleHeaderData * HeapTupleHeader
Definition htup.h:23
static bool HeapTupleHeaderXminFrozen(const HeapTupleHeaderData *tup)
#define HEAP_XACT_MASK
static bool HeapTupleHeaderIsSpeculative(const HeapTupleHeaderData *tup)
#define ItemIdGetLength(itemId)
Definition itemid.h:59
#define ItemIdIsNormal(itemId)
Definition itemid.h:99
#define ItemIdGetOffset(itemId)
Definition itemid.h:65
#define ItemIdHasStorage(itemId)
Definition itemid.h:120
static void ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber offNum)
Definition itemptr.h:135
const void size_t len

References fb(), HEAP_XACT_MASK, HeapTupleHeaderIsSpeculative(), HeapTupleHeaderXminFrozen(), ItemIdGetLength, ItemIdGetOffset, ItemIdHasStorage, ItemIdIsNormal, ItemPointerSet(), len, MASK_MARKER, mask_page_hint_bits(), mask_page_lsn_and_checksum(), mask_unused_space(), MAXALIGN, PageGetItemId(), PageGetMaxOffsetNumber(), and HeapTupleHeaderData::t_infomask.

◆ heap_redo()

void heap_redo ( XLogReaderState record)
extern

Definition at line 1306 of file heapam_xlog.c.

1307{
1308 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
1309
1310 /*
1311 * These operations don't overwrite MVCC data so no conflict processing is
1312 * required. The ones in heap2 rmgr do.
1313 */
1314
1315 switch (info & XLOG_HEAP_OPMASK)
1316 {
1317 case XLOG_HEAP_INSERT:
1318 heap_xlog_insert(record);
1319 break;
1320 case XLOG_HEAP_DELETE:
1321 heap_xlog_delete(record);
1322 break;
1323 case XLOG_HEAP_UPDATE:
1324 heap_xlog_update(record, false);
1325 break;
1326 case XLOG_HEAP_TRUNCATE:
1327
1328 /*
1329 * TRUNCATE is a no-op because the actions are already logged as
1330 * SMGR WAL records. TRUNCATE WAL record only exists for logical
1331 * decoding.
1332 */
1333 break;
1335 heap_xlog_update(record, true);
1336 break;
1337 case XLOG_HEAP_CONFIRM:
1338 heap_xlog_confirm(record);
1339 break;
1340 case XLOG_HEAP_LOCK:
1341 heap_xlog_lock(record);
1342 break;
1343 case XLOG_HEAP_INPLACE:
1344 heap_xlog_inplace(record);
1345 break;
1346 default:
1347 elog(PANIC, "heap_redo: unknown op code %u", info);
1348 }
1349}
static void heap_xlog_insert(XLogReaderState *record)
static void heap_xlog_update(XLogReaderState *record, bool hot_update)
static void heap_xlog_delete(XLogReaderState *record)
static void heap_xlog_lock(XLogReaderState *record)
static void heap_xlog_inplace(XLogReaderState *record)
static void heap_xlog_confirm(XLogReaderState *record)

References elog, fb(), heap_xlog_confirm(), heap_xlog_delete(), heap_xlog_inplace(), heap_xlog_insert(), heap_xlog_lock(), heap_xlog_update(), PANIC, XLOG_HEAP_CONFIRM, XLOG_HEAP_DELETE, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INPLACE, XLOG_HEAP_INSERT, XLOG_HEAP_LOCK, XLOG_HEAP_OPMASK, XLOG_HEAP_TRUNCATE, XLOG_HEAP_UPDATE, and XLogRecGetInfo.

◆ heap_xlog_deserialize_prune_and_freeze()

void heap_xlog_deserialize_prune_and_freeze ( char cursor,
uint16  flags,
int nplans,
xlhp_freeze_plan **  plans,
OffsetNumber **  frz_offsets,
int nredirected,
OffsetNumber **  redirected,
int ndead,
OffsetNumber **  nowdead,
int nunused,
OffsetNumber **  nowunused 
)
extern

Definition at line 106 of file heapdesc.c.

112{
113 if (flags & XLHP_HAS_FREEZE_PLANS)
114 {
116
117 *nplans = freeze_plans->nplans;
118 Assert(*nplans > 0);
119 *plans = freeze_plans->plans;
120
122 cursor += sizeof(xlhp_freeze_plan) * *nplans;
123 }
124 else
125 {
126 *nplans = 0;
127 *plans = NULL;
128 }
129
130 if (flags & XLHP_HAS_REDIRECTIONS)
131 {
133
134 *nredirected = subrecord->ntargets;
135 Assert(*nredirected > 0);
136 *redirected = &subrecord->data[0];
137
139 cursor += sizeof(OffsetNumber[2]) * *nredirected;
140 }
141 else
142 {
143 *nredirected = 0;
144 *redirected = NULL;
145 }
146
147 if (flags & XLHP_HAS_DEAD_ITEMS)
148 {
150
151 *ndead = subrecord->ntargets;
152 Assert(*ndead > 0);
153 *nowdead = subrecord->data;
154
156 cursor += sizeof(OffsetNumber) * *ndead;
157 }
158 else
159 {
160 *ndead = 0;
161 *nowdead = NULL;
162 }
163
164 if (flags & XLHP_HAS_NOW_UNUSED_ITEMS)
165 {
167
168 *nunused = subrecord->ntargets;
169 Assert(*nunused > 0);
170 *nowunused = subrecord->data;
171
173 cursor += sizeof(OffsetNumber) * *nunused;
174 }
175 else
176 {
177 *nunused = 0;
178 *nowunused = NULL;
179 }
180
182}
#define Assert(condition)
Definition c.h:873
#define XLHP_HAS_FREEZE_PLANS
#define XLHP_HAS_NOW_UNUSED_ITEMS
#define XLHP_HAS_REDIRECTIONS
#define XLHP_HAS_DEAD_ITEMS
const void * data

References Assert, data, fb(), XLHP_HAS_DEAD_ITEMS, XLHP_HAS_FREEZE_PLANS, XLHP_HAS_NOW_UNUSED_ITEMS, and XLHP_HAS_REDIRECTIONS.

Referenced by heap2_desc(), and heap_xlog_prune_freeze().

◆ heap_xlog_logical_rewrite()

void heap_xlog_logical_rewrite ( XLogReaderState r)
extern

Definition at line 1075 of file rewriteheap.c.

1076{
1077 char path[MAXPGPATH];
1078 int fd;
1080 uint32 len;
1081 char *data;
1082
1084
1085 snprintf(path, MAXPGPATH,
1087 PG_LOGICAL_MAPPINGS_DIR, xlrec->mapped_db, xlrec->mapped_rel,
1088 LSN_FORMAT_ARGS(xlrec->start_lsn),
1089 xlrec->mapped_xid, XLogRecGetXid(r));
1090
1091 fd = OpenTransientFile(path,
1093 if (fd < 0)
1094 ereport(ERROR,
1096 errmsg("could not create file \"%s\": %m", path)));
1097
1098 /*
1099 * Truncate all data that's not guaranteed to have been safely fsynced (by
1100 * previous record or by the last checkpoint).
1101 */
1103 if (ftruncate(fd, xlrec->offset) != 0)
1104 ereport(ERROR,
1106 errmsg("could not truncate file \"%s\" to %u: %m",
1107 path, (uint32) xlrec->offset)));
1109
1110 data = XLogRecGetData(r) + sizeof(*xlrec);
1111
1112 len = xlrec->num_mappings * sizeof(LogicalRewriteMappingData);
1113
1114 /* write out tail end of mapping file (again) */
1115 errno = 0;
1117 if (pg_pwrite(fd, data, len, xlrec->offset) != len)
1118 {
1119 /* if write didn't set errno, assume problem is no disk space */
1120 if (errno == 0)
1121 errno = ENOSPC;
1122 ereport(ERROR,
1124 errmsg("could not write to file \"%s\": %m", path)));
1125 }
1127
1128 /*
1129 * Now fsync all previously written data. We could improve things and only
1130 * do this for the last write to a file, but the required bookkeeping
1131 * doesn't seem worth the trouble.
1132 */
1134 if (pg_fsync(fd) != 0)
1137 errmsg("could not fsync file \"%s\": %m", path)));
1139
1140 if (CloseTransientFile(fd) != 0)
1141 ereport(ERROR,
1143 errmsg("could not close file \"%s\": %m", path)));
1144}
#define PG_BINARY
Definition c.h:1281
int errcode_for_file_access(void)
Definition elog.c:886
int errmsg(const char *fmt,...)
Definition elog.c:1080
#define ERROR
Definition elog.h:39
#define ereport(elevel,...)
Definition elog.h:150
int CloseTransientFile(int fd)
Definition fd.c:2851
int data_sync_elevel(int elevel)
Definition fd.c:3982
int pg_fsync(int fd)
Definition fd.c:386
int OpenTransientFile(const char *fileName, int fileFlags)
Definition fd.c:2674
#define MAXPGPATH
#define pg_pwrite
Definition port.h:248
#define snprintf
Definition port.h:260
static int fd(const char *x, int i)
#define PG_LOGICAL_MAPPINGS_DIR
#define LOGICAL_REWRITE_FORMAT
Definition rewriteheap.h:54
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition wait_event.h:69
static void pgstat_report_wait_end(void)
Definition wait_event.h:85
#define LSN_FORMAT_ARGS(lsn)
Definition xlogdefs.h:47
#define XLogRecGetXid(decoder)
Definition xlogreader.h:411

References CloseTransientFile(), data, data_sync_elevel(), ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), fd(), len, LOGICAL_REWRITE_FORMAT, LSN_FORMAT_ARGS, MAXPGPATH, OpenTransientFile(), PG_BINARY, pg_fsync(), PG_LOGICAL_MAPPINGS_DIR, pg_pwrite, pgstat_report_wait_end(), pgstat_report_wait_start(), snprintf, XLogRecGetData, and XLogRecGetXid.

Referenced by heap2_redo().

◆ HeapTupleHeaderAdvanceConflictHorizon()

void HeapTupleHeaderAdvanceConflictHorizon ( HeapTupleHeader  tuple,
TransactionId snapshotConflictHorizon 
)
extern

Definition at line 8062 of file heapam.c.

8064{
8068
8069 if (tuple->t_infomask & HEAP_MOVED)
8070 {
8071 if (TransactionIdPrecedes(*snapshotConflictHorizon, xvac))
8072 *snapshotConflictHorizon = xvac;
8073 }
8074
8075 /*
8076 * Ignore tuples inserted by an aborted transaction or if the tuple was
8077 * updated/deleted by the inserting transaction.
8078 *
8079 * Look for a committed hint bit, or if no xmin bit is set, check clog.
8080 */
8081 if (HeapTupleHeaderXminCommitted(tuple) ||
8083 {
8084 if (xmax != xmin &&
8085 TransactionIdFollows(xmax, *snapshotConflictHorizon))
8086 *snapshotConflictHorizon = xmax;
8087 }
8088}
static bool HeapTupleHeaderXminInvalid(const HeapTupleHeaderData *tup)
static TransactionId HeapTupleHeaderGetXvac(const HeapTupleHeaderData *tup)
#define HEAP_MOVED
static TransactionId HeapTupleHeaderGetXmin(const HeapTupleHeaderData *tup)
static TransactionId HeapTupleHeaderGetUpdateXid(const HeapTupleHeaderData *tup)
static bool HeapTupleHeaderXminCommitted(const HeapTupleHeaderData *tup)
bool TransactionIdDidCommit(TransactionId transactionId)
Definition transam.c:126
static bool TransactionIdFollows(TransactionId id1, TransactionId id2)
Definition transam.h:297
static bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
Definition transam.h:263

References fb(), HEAP_MOVED, HeapTupleHeaderGetUpdateXid(), HeapTupleHeaderGetXmin(), HeapTupleHeaderGetXvac(), HeapTupleHeaderXminCommitted(), HeapTupleHeaderXminInvalid(), HeapTupleHeaderData::t_infomask, TransactionIdDidCommit(), TransactionIdFollows(), and TransactionIdPrecedes().

Referenced by heap_index_delete_tuples(), heap_prune_chain(), and prune_freeze_plan().

◆ log_heap_visible()

XLogRecPtr log_heap_visible ( Relation  rel,
Buffer  heap_buffer,
Buffer  vm_buffer,
TransactionId  snapshotConflictHorizon,
uint8  vmflags 
)
extern

Definition at line 8893 of file heapam.c.

8895{
8898 uint8 flags;
8899
8902
8903 xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
8904 xlrec.flags = vmflags;
8909
8911
8912 flags = REGBUF_STANDARD;
8913 if (!XLogHintBitIsNeeded())
8914 flags |= REGBUF_NO_IMAGE;
8916
8918
8919 return recptr;
8920}
static bool BufferIsValid(Buffer bufnum)
Definition bufmgr.h:417
#define SizeOfHeapVisible
#define RelationIsAccessibleInLogicalDecoding(relation)
Definition rel.h:693
#define VISIBILITYMAP_XLOG_CATALOG_REL
#define XLogHintBitIsNeeded()
Definition xlog.h:122
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
Definition xloginsert.c:478
void XLogRegisterData(const void *data, uint32 len)
Definition xloginsert.c:368
void XLogRegisterBuffer(uint8 block_id, Buffer buffer, uint8 flags)
Definition xloginsert.c:245
void XLogBeginInsert(void)
Definition xloginsert.c:152
#define REGBUF_STANDARD
Definition xloginsert.h:35
#define REGBUF_NO_IMAGE
Definition xloginsert.h:33

References Assert, BufferIsValid(), fb(), REGBUF_NO_IMAGE, REGBUF_STANDARD, RelationIsAccessibleInLogicalDecoding, SizeOfHeapVisible, VISIBILITYMAP_XLOG_CATALOG_REL, XLOG_HEAP2_VISIBLE, XLogBeginInsert(), XLogHintBitIsNeeded, XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().

Referenced by visibilitymap_set().