OSDN Git Service

Repair subtle VACUUM bug that led to 'HEAP_MOVED_IN was not expected'
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 10 Jan 2000 04:09:50 +0000 (04:09 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 10 Jan 2000 04:09:50 +0000 (04:09 +0000)
commitfcb7c14d02cf69597c926bb09ab8c64e4a6443f6
treed38f4b03461585f4bc921a69fb194d72570dd716
parentb86ca72f397292b9d4d0df98ea6d8cac61037430
Repair subtle VACUUM bug that led to 'HEAP_MOVED_IN was not expected'
errors.  VACUUM normally compacts the table back-to-front, and stops
as soon as it gets to a page that it has moved some tuples onto.
(This logic doesn't make for a complete packing of the table, but it
should be pretty close.)  But the way it was checking whether it had
got to a page with some moved-in tuples was to look at whether the
current page was the same as the last page of the list of pages that
have enough free space to be move-in targets.  And there was other
code that would remove pages from that list once they got full.
There was a kluge that prevented the last list entry from being
removed, but it didn't get the job done.  Fixed by keeping a separate
variable that contains the largest block number into which a tuple
has been moved.  There's no longer any need to protect the last element
of the fraged_pages list.
Also, fix NOTICE messages to describe elapsed user/system CPU time
correctly.
src/backend/commands/vacuum.c