diff options
Diffstat (limited to 'src/backend/storage/freespace/freespace.c')
-rw-r--r-- | src/backend/storage/freespace/freespace.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c index 7eb4f3ee930..fd18c851140 100644 --- a/src/backend/storage/freespace/freespace.c +++ b/src/backend/storage/freespace/freespace.c @@ -111,8 +111,6 @@ static BlockNumber fsm_search(Relation rel, uint8 min_cat); static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, BlockNumber start, BlockNumber end, bool *eof); -static BlockNumber fsm_get_lastblckno(Relation rel, FSMAddress addr); -static void fsm_update_recursive(Relation rel, FSMAddress addr, uint8 new_cat); /******** Public API ********/ @@ -193,46 +191,6 @@ RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, Size spaceAvail) } /* - * Update the upper levels of the free space map all the way up to the root - * to make sure we don't lose track of new blocks we just inserted. This is - * intended to be used after adding many new blocks to the relation; we judge - * it not worth updating the upper levels of the tree every time data for - * a single page changes, but for a bulk-extend it's worth it. - */ -void -UpdateFreeSpaceMap(Relation rel, BlockNumber startBlkNum, - BlockNumber endBlkNum, Size freespace) -{ - int new_cat = fsm_space_avail_to_cat(freespace); - FSMAddress addr; - uint16 slot; - BlockNumber blockNum; - BlockNumber lastBlkOnPage; - - blockNum = startBlkNum; - - while (blockNum <= endBlkNum) - { - /* - * Find FSM address for this block; update tree all the way to the - * root. - */ - addr = fsm_get_location(blockNum, &slot); - fsm_update_recursive(rel, addr, new_cat); - - /* - * Get the last block number on this FSM page. If that's greater than - * or equal to our endBlkNum, we're done. Otherwise, advance to the - * first block on the next page. - */ - lastBlkOnPage = fsm_get_lastblckno(rel, addr); - if (lastBlkOnPage >= endBlkNum) - break; - blockNum = lastBlkOnPage + 1; - } -} - -/* * XLogRecordPageWithFreeSpace - like RecordPageWithFreeSpace, for use in * WAL replay */ @@ -929,42 +887,3 @@ fsm_vacuum_page(Relation rel, FSMAddress addr, return max_avail; } - -/* - * This function will return the last block number stored on given - * FSM page address. - */ -static BlockNumber -fsm_get_lastblckno(Relation rel, FSMAddress addr) -{ - int slot; - - /* - * Get the last slot number on the given address and convert that to block - * number - */ - slot = SlotsPerFSMPage - 1; - return fsm_get_heap_blk(addr, slot); -} - -/* - * Recursively update the FSM tree from given address to - * all the way up to root. - */ -static void -fsm_update_recursive(Relation rel, FSMAddress addr, uint8 new_cat) -{ - uint16 parentslot; - FSMAddress parent; - - if (addr.level == FSM_ROOT_LEVEL) - return; - - /* - * Get the parent page and our slot in the parent page, and update the - * information in that. - */ - parent = fsm_get_parent(addr, &parentslot); - fsm_set_and_search(rel, parent, parentslot, new_cat, 0); - fsm_update_recursive(rel, parent, new_cat); -} |