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

Function XLogRecordPageWithFreeSpace

src/backend/storage/freespace/freespace.c:199–225  ·  view source on GitHub ↗

* XLogRecordPageWithFreeSpace - like RecordPageWithFreeSpace, for use in * WAL replay */

Source from the content-addressed store, hash-verified

197 * WAL replay
198 */
199void
200XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
201 Size spaceAvail)
202{
203 int new_cat = fsm_space_avail_to_cat(spaceAvail);
204 FSMAddress addr;
205 uint16 slot;
206 BlockNumber blkno;
207 Buffer buf;
208 Page page;
209
210 /* Get the location of the FSM byte representing the heap block */
211 addr = fsm_get_location(heapBlk, &slot);
212 blkno = fsm_logical_to_physical(addr);
213
214 /* If the page doesn't exist already, extend */
215 buf = XLogReadBufferExtended(rnode, FSM_FORKNUM, blkno, RBM_ZERO_ON_ERROR);
216 LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
217
218 page = BufferGetPage(buf);
219 if (PageIsNew(page))
220 PageInit(page, BLCKSZ, 0);
221
222 if (fsm_set_avail(page, slot, new_cat))
223 MarkBufferDirtyHint(buf, false);
224 UnlockReleaseBuffer(buf);
225}
226
227/*
228 * GetRecordedFreeSpace - return the amount of free space on a particular page,

Callers 6

heap_xlog_pruneFunction · 0.85
heap_xlog_vacuumFunction · 0.85
heap_xlog_visibleFunction · 0.85
heap_xlog_insertFunction · 0.85
heap_xlog_multi_insertFunction · 0.85
heap_xlog_updateFunction · 0.85

Calls 9

fsm_space_avail_to_catFunction · 0.85
fsm_get_locationFunction · 0.85
fsm_logical_to_physicalFunction · 0.85
XLogReadBufferExtendedFunction · 0.85
LockBufferFunction · 0.85
PageInitFunction · 0.85
fsm_set_availFunction · 0.85
MarkBufferDirtyHintFunction · 0.85
UnlockReleaseBufferFunction · 0.85

Tested by

no test coverage detected