Re: performance issue in remove_from_unowned_list()
| От | Tomas Vondra |
|---|---|
| Тема | Re: performance issue in remove_from_unowned_list() |
| Дата | |
| Msg-id | cdc51a4d-a47c-a514-0db8-a758d3190b4d@2ndquadrant.com обсуждение исходный текст |
| Ответ на | Re: performance issue in remove_from_unowned_list() (Tomas Vondra <tomas.vondra@2ndquadrant.com>) |
| Список | pgsql-hackers |
On 3/12/19 11:54 PM, Tomas Vondra wrote: > > > On 3/10/19 9:09 PM, Alvaro Herrera wrote: >> On 2019-Feb-07, Tomas Vondra wrote: >> >>> Attached is a WIP patch removing the optimization from DropRelationFiles >>> and adding it to smgrDoPendingDeletes. This resolves the issue, at least >>> in the cases I've been able to reproduce. But maybe we should deal with >>> this issue earlier by ensuring the two lists are ordered the same way >>> from the very beginning, somehow. >> >> I noticed that this patch isn't in the commitfest. Are you planning to >> push it soon? >> > > I wasn't planning to push anything particularly soon, for two reasons: > Firstly, the issue is not particularly pressing except with non-trivial > number of relations (and I only noticed that during benchmarking). > Secondly, I still have a feeling I'm missing something about b4166911 > because for me that commit does not actually fix the issue - i.e. I can > create a lot of relations in a transaction, abort it, and observe that > the replica actually accesses the relations in exactly the wrong order. > So that commit does not seem to actually fix anything. > > Attached is a patch adopting the dlist approach - it seems to be working > quite fine, and is a bit cleaner than just slapping another pointer into > the SMgrRelationData struct. So I'd say this is the way to go. > > I see b4166911 was actually backpatched to all supported versions, on > the basis that it fixes oversight in 279628a0a7. So I suppose this fix > should also be backpatched. > OK, so here is a bit more polished version of the dlist-based patch. It's almost identical to what I posted before, except that it: 1) undoes the non-working optimization in DropRelationFiles() 2) removes add_to_unowned_list/remove_from_unowned_list entirely and just replaces that with dlist_push_tail/dlist_delete I've originally planned to keep those functions, mostly because the remove_from_unowned_list comment says this: - * If the reln is not present in the list, nothing happens. - * Typically this would be caller error, but there seems no - * reason to throw an error. I don't think dlist_delete allows that. But after further inspection of all places calling those functions, don't think that can happen. I plan to commit this soon-ish and backpatch it as mentioned before, because I consider it pretty much a fix for b4166911. I'm however still mildly puzzled that b4166911 apparently improved the behavior in some cases, at least judging by [1]. OTOH there's not much detail about how it was tested, so I can't quite run it again. [1] https://www.postgresql.org/message-id/flat/CAHGQGwHVQkdfDqtvGVkty%2B19cQakAydXn1etGND3X0PHbZ3%2B6w%40mail.gmail.com regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: