* XLogRecordPageWithFreeSpace - like RecordPageWithFreeSpace, for use in * WAL replay */
| 197 | * WAL replay |
| 198 | */ |
| 199 | void |
| 200 | XLogRecordPageWithFreeSpace(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, |
no test coverage detected