From: | Robert Haas <rhaas(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Rearrange lazy_scan_heap to avoid visibility map race conditions |
Date: | 2012-04-24 02:19:16 |
Message-ID: | E1SMVLY-0001gm-KK@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Rearrange lazy_scan_heap to avoid visibility map race conditions.
We must set the visibility map bit before releasing our exclusive lock
on the heap page; otherwise, someone might clear the heap page bit
before we set the visibility map bit, leading to a situation where the
visibility map thinks the page is all-visible but it's really not.
This problem has existed since 8.4, but it wasn't critical before we
had index-only scans, since the worst case scenario was that the page
wouldn't get vacuumed until the next scan_all vacuum.
Along the way, a couple of minor, related improvements: (1) if we
pause the heap scan to do an index vac cycle, release any visibility
map page we're holding, since really long-running pins are not good
for a variety of reasons; and (2) warn if we see a page that's marked
all-visible in the visibility map but not on the page level, since
that should never happen any more (it was allowed in previous
releases, but not in 9.2).
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/7ab9b2f3b79177e501a1ef90ed004cc68788abaf
Modified Files
--------------
src/backend/commands/vacuumlazy.c | 85 ++++++++++++++++++++-----------------
1 files changed, 46 insertions(+), 39 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2012-04-24 02:45:57 | pgsql: Lots of doc corrections. |
Previous Message | Robert Haas | 2012-04-24 02:07:03 | pgsql: Reduce hash size for compute_array_stats, compute_tsvector_stats |