From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Sergey Burladyan <eshkinkot(at)gmail(dot)com> |
Cc: | Миша Тюрин <tmihail(at)bk(dot)ru>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: freeze cannot be finished |
Date: | 2013-11-14 00:26:08 |
Message-ID: | CAMkU=1zEwwvwQQ-o8gf=WDEZxtwu=7RKpwQ4+Mz31=M-3BTx2w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Nov 13, 2013 at 3:53 PM, Sergey Burladyan <eshkinkot(at)gmail(dot)com>wrote:
> Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
>
> If I not mistaken, looks like lazy_scan_heap() called from
> lazy_vacuum_rel()
> (see [1]) skip pages, even if it run with scan_all == true,
> lazy_scan_heap()
> does not increment scanned_pages if lazy_check_needs_freeze() return
> false, so
> if this occurred at wraparound vacuum it cannot update pg_class, because
> pg_class updated via this code:
>
> new_frozen_xid = FreezeLimit;
> if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
> new_frozen_xid = InvalidTransactionId;
>
> vac_update_relstats(onerel,
> new_rel_pages,
> new_rel_tuples,
> new_rel_allvisible,
> vacrelstats->hasindex,
> new_frozen_xid);
>
> so i think in our prevent wraparound vacuum vacrelstats->scanned_pages
> always
> less than vacrelstats->rel_pages and pg_class relfrozenxid never updated.
>
Yeah, I think that that is a bug. If the clean-up lock is unavailable but
the page is inspected without it and found not to need freezing, then the
page needs to be counted as scanned, but is not so counted.
commit bbb6e559c4ea0fb4c346beda76736451dc24eb4e
Date: Mon Nov 7 21:39:40 2011 -0500
But this was introduced in 9.2.0, so unless the OP didn't upgrade to 9.2
until recently, I don't know why it just started happening.
It looks like a simple fix (to HEAD attached), but I don't know how to test
it.
Also, it seem like it might be worth issuing a warning if scan_all is true
but all was not scanned.
Cheers,
Jeff
Attachment | Content-Type | Size |
---|---|---|
fix_freeze.patch | application/octet-stream | 478 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-11-14 00:36:29 | Re: expression index not used within function |
Previous Message | Sergey Burladyan | 2013-11-13 23:53:17 | Re: freeze cannot be finished |