MCPcopy Create free account
hub / github.com/apache/cloudberry / _bitmap_getbuf

Function _bitmap_getbuf

src/backend/access/bitmap/bitmappages.c:60–105  ·  view source on GitHub ↗

* _bitmap_getbuf() -- return the buffer for the given block number and * the access method. */

Source from the content-addressed store, hash-verified

58 * the access method.
59 */
60Buffer
61_bitmap_getbuf(Relation rel, BlockNumber blkno, int access)
62{
63 Buffer buf;
64
65 if (blkno != P_NEW)
66 {
67 buf = ReadBuffer(rel, blkno);
68 if (access != BM_NOLOCK)
69 LockBuffer(buf, access);
70 }
71
72 else
73 {
74 bool needLock;
75
76 Assert(access == BM_WRITE);
77
78 /*
79 * Extend the relation by one page.
80 *
81 * We have to use a lock to ensure no one else is extending the rel at
82 * the same time, else we will both try to initialize the same new
83 * page. We can skip locking for new or temp relations, however,
84 * since no one else could be accessing them.
85 */
86 needLock = !RELATION_IS_LOCAL(rel);
87
88 if (needLock)
89 LockRelationForExtension(rel, ExclusiveLock);
90
91 buf = ReadBuffer(rel, P_NEW);
92
93 /* Acquire buffer lock on new page */
94 LockBuffer(buf, BM_WRITE);
95
96 /*
97 * Release the file-extension lock; it's now OK for someone else to
98 * extend the relation some more.
99 */
100 if (needLock)
101 UnlockRelationForExtension(rel, ExclusiveLock);
102 }
103
104 return buf;
105}
106
107/*
108 * _bitmap_wrtbuf() -- write a buffer page to disk.

Callers 15

updatesetbit_inpageFunction · 0.85
findbitmappageFunction · 0.85
verify_bitmappagesFunction · 0.85
create_lovitemFunction · 0.85
buf_add_tidFunction · 0.85
buf_free_memFunction · 0.85
insertsetbitFunction · 0.85
build_inserttupleFunction · 0.85
_bitmap_doinsertFunction · 0.85
_bitmap_init_buildstateFunction · 0.85
GetBitmapIndexAuxOidsFunction · 0.85

Calls 4

ReadBufferFunction · 0.85
LockBufferFunction · 0.85
LockRelationForExtensionFunction · 0.85

Tested by

no test coverage detected