1 /*------------------------------------------------------------------------- 2 * 3 * storage_xlog.h 4 * prototypes for XLog support for backend/catalog/storage.c 5 * 6 * 7 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group 8 * Portions Copyright (c) 1994, Regents of the University of California 9 * 10 * src/include/catalog/storage_xlog.h 11 * 12 *------------------------------------------------------------------------- 13 */ 14 #ifndef STORAGE_XLOG_H 15 #define STORAGE_XLOG_H 16 17 #include "access/xlogreader.h" 18 #include "lib/stringinfo.h" 19 #include "storage/block.h" 20 #include "storage/relfilenode.h" 21 22 /* 23 * Declarations for smgr-related XLOG records 24 * 25 * Note: we log file creation and truncation here, but logging of deletion 26 * actions is handled by xact.c, because it is part of transaction commit. 27 */ 28 29 /* XLOG gives us high 4 bits */ 30 #define XLOG_SMGR_CREATE 0x10 31 #define XLOG_SMGR_TRUNCATE 0x20 32 33 typedef struct xl_smgr_create 34 { 35 RelFileNode rnode; 36 ForkNumber forkNum; 37 } xl_smgr_create; 38 39 /* flags for xl_smgr_truncate */ 40 #define SMGR_TRUNCATE_HEAP 0x0001 41 #define SMGR_TRUNCATE_VM 0x0002 42 #define SMGR_TRUNCATE_FSM 0x0004 43 #define SMGR_TRUNCATE_ALL \ 44 (SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM) 45 46 typedef struct xl_smgr_truncate 47 { 48 BlockNumber blkno; 49 RelFileNode rnode; 50 int flags; 51 } xl_smgr_truncate; 52 53 extern void log_smgrcreate(const RelFileNode *rnode, ForkNumber forkNum); 54 55 extern void smgr_redo(XLogReaderState *record); 56 extern void smgr_desc(StringInfo buf, XLogReaderState *record); 57 extern const char *smgr_identify(uint8 info); 58 59 #endif /* STORAGE_XLOG_H */ 60