| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef HEAPAM_XLOG_H |
| #define HEAPAM_XLOG_H |
|
|
| #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 "utils/relcache.h" |
|
|
|
|
| |
| |
| |
| |
| |
| |
| #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 0x10 |
| #define XLOG_HEAP2_VACUUM 0x20 |
| #define XLOG_HEAP2_FREEZE_PAGE 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) |
|
|
| |
| typedef struct xl_heap_delete |
| { |
| TransactionId xmax; |
| OffsetNumber offnum; |
| uint8 infobits_set; |
| uint8 flags; |
| } xl_heap_delete; |
|
|
| #define SizeOfHeapDelete (offsetof(xl_heap_delete, flags) + sizeof(uint8)) |
|
|
| |
| |
| |
| #define XLH_TRUNCATE_CASCADE (1<<0) |
| #define XLH_TRUNCATE_RESTART_SEQS (1<<1) |
|
|
| |
| |
| |
| |
| |
| typedef struct xl_heap_truncate |
| { |
| Oid dbId; |
| uint32 nrelids; |
| uint8 flags; |
| Oid relids[FLEXIBLE_ARRAY_MEMBER]; |
| } xl_heap_truncate; |
|
|
| #define SizeOfHeapTruncate (offsetof(xl_heap_truncate, relids)) |
|
|
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_header |
| { |
| uint16 t_infomask2; |
| uint16 t_infomask; |
| uint8 t_hoff; |
| } xl_heap_header; |
|
|
| #define SizeOfHeapHeader (offsetof(xl_heap_header, t_hoff) + sizeof(uint8)) |
|
|
| |
| typedef struct xl_heap_insert |
| { |
| OffsetNumber offnum; |
| uint8 flags; |
|
|
| |
| } xl_heap_insert; |
|
|
| #define SizeOfHeapInsert (offsetof(xl_heap_insert, flags) + sizeof(uint8)) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_multi_insert |
| { |
| uint8 flags; |
| uint16 ntuples; |
| OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER]; |
| } xl_heap_multi_insert; |
|
|
| #define SizeOfHeapMultiInsert offsetof(xl_heap_multi_insert, offsets) |
|
|
| typedef struct xl_multi_insert_tuple |
| { |
| uint16 datalen; |
| uint16 t_infomask2; |
| uint16 t_infomask; |
| uint8 t_hoff; |
| |
| } xl_multi_insert_tuple; |
|
|
| #define SizeOfMultiInsertTuple (offsetof(xl_multi_insert_tuple, t_hoff) + sizeof(uint8)) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_update |
| { |
| TransactionId old_xmax; |
| OffsetNumber old_offnum; |
| uint8 old_infobits_set; |
| uint8 flags; |
| TransactionId new_xmax; |
| OffsetNumber new_offnum; |
|
|
| |
| |
| |
| |
| } xl_heap_update; |
|
|
| #define SizeOfHeapUpdate (offsetof(xl_heap_update, new_offnum) + sizeof(OffsetNumber)) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_prune |
| { |
| TransactionId snapshotConflictHorizon; |
| uint16 nredirected; |
| uint16 ndead; |
| bool isCatalogRel; |
| |
| |
| } xl_heap_prune; |
|
|
| #define SizeOfHeapPrune (offsetof(xl_heap_prune, isCatalogRel) + sizeof(bool)) |
|
|
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_vacuum |
| { |
| uint16 nunused; |
| |
| } xl_heap_vacuum; |
|
|
| #define SizeOfHeapVacuum (offsetof(xl_heap_vacuum, nunused) + sizeof(uint16)) |
|
|
| |
| #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 |
|
|
| |
| typedef struct xl_heap_lock |
| { |
| TransactionId xmax; |
| OffsetNumber offnum; |
| uint8 infobits_set; |
| uint8 flags; |
| } xl_heap_lock; |
|
|
| #define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(uint8)) |
|
|
| |
| typedef struct xl_heap_lock_updated |
| { |
| TransactionId xmax; |
| OffsetNumber offnum; |
| uint8 infobits_set; |
| uint8 flags; |
| } xl_heap_lock_updated; |
|
|
| #define SizeOfHeapLockUpdated (offsetof(xl_heap_lock_updated, flags) + sizeof(uint8)) |
|
|
| |
| typedef struct xl_heap_confirm |
| { |
| OffsetNumber offnum; |
| } xl_heap_confirm; |
|
|
| #define SizeOfHeapConfirm (offsetof(xl_heap_confirm, offnum) + sizeof(OffsetNumber)) |
|
|
| |
| typedef struct xl_heap_inplace |
| { |
| OffsetNumber offnum; |
| |
| } xl_heap_inplace; |
|
|
| #define SizeOfHeapInplace (offsetof(xl_heap_inplace, offnum) + sizeof(OffsetNumber)) |
|
|
| |
| |
| |
| |
| |
| #define XLH_FREEZE_XVAC 0x02 |
| #define XLH_INVALID_XVAC 0x04 |
|
|
| typedef struct xl_heap_freeze_plan |
| { |
| TransactionId xmax; |
| uint16 t_infomask2; |
| uint16 t_infomask; |
| uint8 frzflags; |
|
|
| |
| uint16 ntuples; |
| } xl_heap_freeze_plan; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_freeze_page |
| { |
| TransactionId snapshotConflictHorizon; |
| uint16 nplans; |
| bool isCatalogRel; |
| |
|
|
| |
| |
| |
| } xl_heap_freeze_page; |
|
|
| #define SizeOfHeapFreezePage (offsetof(xl_heap_freeze_page, isCatalogRel) + sizeof(bool)) |
|
|
| |
| |
| |
| |
| |
| |
| typedef struct xl_heap_visible |
| { |
| TransactionId snapshotConflictHorizon; |
| uint8 flags; |
| } xl_heap_visible; |
|
|
| #define SizeOfHeapVisible (offsetof(xl_heap_visible, flags) + sizeof(uint8)) |
|
|
| typedef struct xl_heap_new_cid |
| { |
| |
| |
| |
| |
| TransactionId top_xid; |
| CommandId cmin; |
| CommandId cmax; |
| CommandId combocid; |
|
|
| |
| |
| |
| RelFileLocator target_locator; |
| ItemPointerData target_tid; |
| } xl_heap_new_cid; |
|
|
| #define SizeOfHeapNewCid (offsetof(xl_heap_new_cid, target_tid) + sizeof(ItemPointerData)) |
|
|
| |
| typedef struct xl_heap_rewrite_mapping |
| { |
| TransactionId mapped_xid; |
| Oid mapped_db; |
| Oid mapped_rel; |
| off_t offset; |
| uint32 num_mappings; |
| XLogRecPtr start_lsn; |
| } xl_heap_rewrite_mapping; |
|
|
| extern void HeapTupleHeaderAdvanceConflictHorizon(HeapTupleHeader tuple, |
| TransactionId *snapshotConflictHorizon); |
|
|
| extern void heap_redo(XLogReaderState *record); |
| extern void heap_desc(StringInfo buf, XLogReaderState *record); |
| extern const char *heap_identify(uint8 info); |
| extern void heap_mask(char *pagedata, BlockNumber blkno); |
| extern void heap2_redo(XLogReaderState *record); |
| extern void heap2_desc(StringInfo buf, XLogReaderState *record); |
| extern const char *heap2_identify(uint8 info); |
| extern void heap_xlog_logical_rewrite(XLogReaderState *r); |
|
|
| extern XLogRecPtr log_heap_visible(Relation rel, Buffer heap_buffer, |
| Buffer vm_buffer, |
| TransactionId snapshotConflictHorizon, |
| uint8 vmflags); |
|
|
| #endif |
|
|