storage_xlog.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*-------------------------------------------------------------------------
  2. *
  3. * storage_xlog.h
  4. * prototypes for XLog support for backend/catalog/storage.c
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, 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. #include "access/xlogreader.h"
  17. #include "lib/stringinfo.h"
  18. #include "storage/block.h"
  19. #include "storage/relfilenode.h"
  20. /*
  21. * Declarations for smgr-related XLOG records
  22. *
  23. * Note: we log file creation and truncation here, but logging of deletion
  24. * actions is handled by xact.c, because it is part of transaction commit.
  25. */
  26. /* XLOG gives us high 4 bits */
  27. #define XLOG_SMGR_CREATE 0x10
  28. #define XLOG_SMGR_TRUNCATE 0x20
  29. typedef struct xl_smgr_create
  30. {
  31. RelFileNode rnode;
  32. ForkNumber forkNum;
  33. } xl_smgr_create;
  34. /* flags for xl_smgr_truncate */
  35. #define SMGR_TRUNCATE_HEAP 0x0001
  36. #define SMGR_TRUNCATE_VM 0x0002
  37. #define SMGR_TRUNCATE_FSM 0x0004
  38. #define SMGR_TRUNCATE_ALL \
  39. (SMGR_TRUNCATE_HEAP|SMGR_TRUNCATE_VM|SMGR_TRUNCATE_FSM)
  40. typedef struct xl_smgr_truncate
  41. {
  42. BlockNumber blkno;
  43. RelFileNode rnode;
  44. int flags;
  45. } xl_smgr_truncate;
  46. extern void log_smgrcreate(const RelFileNode *rnode, ForkNumber forkNum);
  47. extern void smgr_redo(XLogReaderState *record);
  48. extern void smgr_desc(StringInfo buf, XLogReaderState *record);
  49. extern const char *smgr_identify(uint8 info);
  50. #endif /* STORAGE_XLOG_H */