diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c index 4c3e774..d076aab 100644 --- a/src/backend/access/heap/hio.c +++ b/src/backend/access/heap/hio.c @@ -481,11 +481,10 @@ loop: RelationSetTargetBlock(relation, targetBlock); /* - * In case we used an in-memory map of available blocks, reset it - * for next use. + * In case we used an in-memory map of available blocks, reset it for next + * use. */ - if (targetBlock < HEAP_FSM_CREATION_THRESHOLD) - FSMClearLocalMap(); + FSMClearLocalMap(); return buffer; } @@ -633,8 +632,7 @@ loop: /* * In case we used an in-memory map of available blocks, reset it for next - * use. We do this unconditionally since after relation extension we - * can't skip this based on the targetBlock. + * use. */ FSMClearLocalMap(); diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c index 5f46391..a595397 100644 --- a/src/backend/storage/freespace/freespace.c +++ b/src/backend/storage/freespace/freespace.c @@ -293,9 +293,12 @@ RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, void FSMClearLocalMap(void) { - fsm_local_map.nblocks = 0; - memset(&fsm_local_map.map, FSM_LOCAL_NOT_AVAIL, - sizeof(fsm_local_map.map)); + if (FSM_LOCAL_MAP_EXISTS) + { + fsm_local_map.nblocks = 0; + memset(&fsm_local_map.map, FSM_LOCAL_NOT_AVAIL, + sizeof(fsm_local_map.map)); + } } /*