Re: [HACKERS] Rethinking autovacuum.c memory handling
От
Bossart, Nathan
Тема
Re: [HACKERS] Rethinking autovacuum.c memory handling
Дата
Msg-id
9E08B120-31DE-4B47-9C44-305619F3195C@amazon.com
Ответ на
Re: [HACKERS] Rethinking autovacuum.c memory handling (Michael Paquier)
Список
Дерево обсуждения
[HACKERS] Rethinking autovacuum.c memory handling Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Rethinking autovacuum.c memory handling Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: [HACKERS] Rethinking autovacuum.c memory handling Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: [HACKERS] Rethinking autovacuum.c memory handling Michael Paquier <michael.paquier@gmail.com>
Re: [HACKERS] Rethinking autovacuum.c memory handling Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Rethinking autovacuum.c memory handling Michael Paquier <michael.paquier@gmail.com>
Re: [HACKERS] Rethinking autovacuum.c memory handling "Bossart, Nathan" <bossartn@amazon.com>
Re: [HACKERS] Rethinking autovacuum.c memory handling Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Rethinking autovacuum.c memory handling "Bossart, Nathan" <bossartn@amazon.com>
On 9/23/17, 5:27 AM, "Michael Paquier" wrote: >On Sat, Sep 23, 2017 at 6:09 AM, Tom Lane wrote: >> I notice that autovacuum.c calls autovacuum_do_vac_analyze, and >> thereby vacuum(), in TopTransactionContext. This doesn't seem >> like a terribly great idea, because it doesn't correspond to what >> happens during a manually-invoked vacuum. > > Indeed, the inconsistency is not good here. > >> What I think we should do instead is invoke autovacuum_do_vac_analyze >> in the PortalContext that do_autovacuum has created, which we already >> have a mechanism to reset once per table processed in do_autovacuum. >> >> The attached patch does that, and also modifies perform_work_item() >> to use the same approach. Right now perform_work_item() has a >> copied-and-pasted MemoryContextResetAndDeleteChildren(PortalContext) >> call in its error recovery path, but that seems a bit out of place >> given that perform_work_item() isn't using PortalContext otherwise. > > I have spent some time looking at your patch and testing it. This > looks sane. A small comment that I have would be to add an assertion > at the top of perform_work_item to be sure that it is called in the > memory context of AutovacMemCxt. This looks reasonable to me as well. I haven't noticed any issues after a couple hours of pgbench with aggressive autovacuum settings, either. Nathan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления