rewriteheap.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*-------------------------------------------------------------------------
  2. *
  3. * rewriteheap.h
  4. * Declarations for heap rewrite support functions
  5. *
  6. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994-5, Regents of the University of California
  8. *
  9. * src/include/access/rewriteheap.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef REWRITE_HEAP_H
  14. #define REWRITE_HEAP_H
  15. #include "access/htup.h"
  16. #include "storage/itemptr.h"
  17. #include "storage/relfilenode.h"
  18. #include "utils/relcache.h"
  19. /* struct definition is private to rewriteheap.c */
  20. typedef struct RewriteStateData *RewriteState;
  21. extern RewriteState begin_heap_rewrite(Relation OldHeap, Relation NewHeap,
  22. TransactionId OldestXmin, TransactionId FreezeXid,
  23. MultiXactId MultiXactCutoff);
  24. extern void end_heap_rewrite(RewriteState state);
  25. extern void rewrite_heap_tuple(RewriteState state, HeapTuple oldTuple,
  26. HeapTuple newTuple);
  27. extern bool rewrite_heap_dead_tuple(RewriteState state, HeapTuple oldTuple);
  28. /*
  29. * On-Disk data format for an individual logical rewrite mapping.
  30. */
  31. typedef struct LogicalRewriteMappingData
  32. {
  33. RelFileNode old_node;
  34. RelFileNode new_node;
  35. ItemPointerData old_tid;
  36. ItemPointerData new_tid;
  37. } LogicalRewriteMappingData;
  38. /* ---
  39. * The filename consists of the following, dash separated,
  40. * components:
  41. * 1) database oid or InvalidOid for shared relations
  42. * 2) the oid of the relation
  43. * 3) upper 32bit of the LSN at which a rewrite started
  44. * 4) lower 32bit of the LSN at which a rewrite started
  45. * 5) xid we are mapping for
  46. * 6) xid of the xact performing the mapping
  47. * ---
  48. */
  49. #define LOGICAL_REWRITE_FORMAT "map-%x-%x-%X_%X-%x-%x"
  50. extern void CheckPointLogicalRewriteHeap(void);
  51. #endif /* REWRITE_HEAP_H */