visibilitymap.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*-------------------------------------------------------------------------
  2. *
  3. * visibilitymap.h
  4. * visibility map interface
  5. *
  6. *
  7. * Portions Copyright (c) 2007-2016, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/access/visibilitymap.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef VISIBILITYMAP_H
  15. #define VISIBILITYMAP_H
  16. #include "access/xlogdefs.h"
  17. #include "storage/block.h"
  18. #include "storage/buf.h"
  19. #include "utils/relcache.h"
  20. /* Number of bits for one heap page */
  21. #define BITS_PER_HEAPBLOCK 2
  22. /* Flags for bit map */
  23. #define VISIBILITYMAP_ALL_VISIBLE 0x01
  24. #define VISIBILITYMAP_ALL_FROZEN 0x02
  25. #define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid
  26. * visibilitymap flags bits */
  27. /* Macros for visibilitymap test */
  28. #define VM_ALL_VISIBLE(r, b, v) \
  29. ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_VISIBLE) != 0)
  30. #define VM_ALL_FROZEN(r, b, v) \
  31. ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_FROZEN) != 0)
  32. extern bool visibilitymap_clear(Relation rel, BlockNumber heapBlk,
  33. Buffer vmbuf, uint8 flags);
  34. extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk,
  35. Buffer *vmbuf);
  36. extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf);
  37. extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
  38. XLogRecPtr recptr, Buffer vmBuf, TransactionId cutoff_xid,
  39. uint8 flags);
  40. extern uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf);
  41. extern void visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_frozen);
  42. extern void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks);
  43. #endif /* VISIBILITYMAP_H */