mirror of
https://github.com/postgres/postgres.git
synced 2026-04-03 00:05:41 -04:00
This feature was using a process local map to track the first few blocks in the relation. The map was reset each time we get the block with enough freespace. It was discussed that it would be better to track this map on a per-relation basis in relcache and then invalidate the same whenever vacuum frees up some space in the page or when FSM is created. The new design would be better both in terms of API design and performance. List of commits reverted, in reverse chronological order:06c8a5090eImprove code comments inb0eaa4c51b.13e8643bfcDuring pg_upgrade, conditionally skip transfer of FSMs.6f918159a9Add more tests for FSM.9c32e4c350Clear the local map when not used.29d108cdecUpdate the documentation for FSM behavior..08ecdfe7e5Make FSM test portable.b0eaa4c51bAvoid creation of the free space map for small heap relations. Discussion: https://postgr.es/m/20190416180452.3pm6uegx54iitbt5@alap3.anarazel.de
38 lines
1.3 KiB
C
38 lines
1.3 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* freespace.h
|
|
* POSTGRES free space map for quickly finding free space in relations
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/storage/freespace.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef FREESPACE_H_
|
|
#define FREESPACE_H_
|
|
|
|
#include "storage/block.h"
|
|
#include "storage/relfilenode.h"
|
|
#include "utils/relcache.h"
|
|
|
|
/* prototypes for public functions in freespace.c */
|
|
extern Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk);
|
|
extern BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded);
|
|
extern BlockNumber RecordAndGetPageWithFreeSpace(Relation rel,
|
|
BlockNumber oldPage,
|
|
Size oldSpaceAvail,
|
|
Size spaceNeeded);
|
|
extern void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk,
|
|
Size spaceAvail);
|
|
extern void XLogRecordPageWithFreeSpace(RelFileNode rnode, BlockNumber heapBlk,
|
|
Size spaceAvail);
|
|
|
|
extern void FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks);
|
|
extern void FreeSpaceMapVacuum(Relation rel);
|
|
extern void FreeSpaceMapVacuumRange(Relation rel, BlockNumber start,
|
|
BlockNumber end);
|
|
|
|
#endif /* FREESPACE_H_ */
|