Bug in VACUUM reporting of "removed %d row versions" in 9.2+

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in VACUUM reporting of "removed %d row versions" in 9.2+
Date: 2013-05-10 15:37:58
Message-ID: CA+U5nMJ+kRY+WAFRqN9m=wRn0-FfNuF+XJV=QqUtiEi1y29K5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Commit d0dcb315db0043f10073a9a244cea138e9e60edd and previous
introduced a bug into the reporting of removed row versions. ('Twas
myself et al, before you ask).

In those commits, lazy_vacuum_heap() skipped pinned blocks, but then
failed to report that accurately, claiming that the tuples were
actually removed when they were not. That bug has masked the effect of
the page skipping behaviour.

Bug is in 9.2 and HEAD.

Attached patch corrects that, with logic to move to the next block
rather than re-try the lock in a tight loop once per tuple, which was
mostly ineffective.

Attached patch also changes the algorithm slightly to retry a skipped
block by sleeping and then retrying the block, following observation
of the effects of the current skipping algorithm once skipped rows are
correctly reported.

It also adds a comment which explains the skipping behaviour.

Viewpoints?

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
vacuum_skipped_tuple_reporting.v1.patch application/octet-stream 2.2 KB
unknown_filename text/plain 158 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-05-10 15:41:59 Re: Concurrent HOT Update interference
Previous Message Christopher Browne 2013-05-10 14:50:49 Re: [PATCH] Make "psql -1 < file.sql" work as with "-f"