PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
visibilitymap.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * visibilitymap.h
4  * visibility map interface
5  *
6  *
7  * Portions Copyright (c) 2007-2017, 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 
17 #include "access/xlogdefs.h"
18 #include "storage/block.h"
19 #include "storage/buf.h"
20 #include "utils/relcache.h"
21 
22 /* Number of bits for one heap page */
23 #define BITS_PER_HEAPBLOCK 2
24 
25 /* Flags for bit map */
26 #define VISIBILITYMAP_ALL_VISIBLE 0x01
27 #define VISIBILITYMAP_ALL_FROZEN 0x02
28 #define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid
29  * visibilitymap flags bits */
30 
31 /* Macros for visibilitymap test */
32 #define VM_ALL_VISIBLE(r, b, v) \
33  ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_VISIBLE) != 0)
34 #define VM_ALL_FROZEN(r, b, v) \
35  ((visibilitymap_get_status((r), (b), (v)) & VISIBILITYMAP_ALL_FROZEN) != 0)
36 
37 extern bool visibilitymap_clear(Relation rel, BlockNumber heapBlk,
38  Buffer vmbuf, uint8 flags);
39 extern void visibilitymap_pin(Relation rel, BlockNumber heapBlk,
40  Buffer *vmbuf);
41 extern bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf);
42 extern void visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
43  XLogRecPtr recptr, Buffer vmBuf, TransactionId cutoff_xid,
44  uint8 flags);
45 extern uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf);
46 extern void visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_frozen);
47 extern void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks);
48 
49 #endif /* VISIBILITYMAP_H */
bool visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf)
uint32 TransactionId
Definition: c.h:394
bool visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer vmbuf, uint8 flags)
void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
void visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, XLogRecPtr recptr, Buffer vmBuf, TransactionId cutoff_xid, uint8 flags)
unsigned char uint8
Definition: c.h:263
uint32 BlockNumber
Definition: block.h:31
void visibilitymap_pin(Relation rel, BlockNumber heapBlk, Buffer *vmbuf)
void visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_frozen)
uint64 XLogRecPtr
Definition: xlogdefs.h:21
uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf)
int Buffer
Definition: buf.h:23