Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d0dcb31

Browse files
committed
Fix broken logic in lazy_vacuum_heap.
As noted by Tom Lane, the previous coding in this area, which I introduced in commit bbb6e55, was poorly tested and caused the vacuum's second heap to go into what would have been an infinite loop but for the fact that it eventually caused a memory allocation failure. This version seems to work better.
1 parent 4d0b11a commit d0dcb31

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/commands/vacuumlazy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,11 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
991991
buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
992992
vac_strategy);
993993
if (!ConditionalLockBufferForCleanup(buf))
994+
{
995+
ReleaseBuffer(buf);
996+
++tupindex;
994997
continue;
998+
}
995999
tupindex = lazy_vacuum_page(onerel, tblk, buf, tupindex, vacrelstats);
9961000

9971001
/* Now that we've compacted the page, record its available space */

0 commit comments

Comments
 (0)