Re: shadow variables - pg15 edition

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: shadow variables - pg15 edition
Дата
Msg-id CAApHDvpGZX-X=Bn4moyXgfFa0CdSUwoa04d3isit3=1qo8F8Bw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: shadow variables - pg15 edition  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: shadow variables - pg15 edition  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers
On Wed, 24 Aug 2022 at 22:47, David Rowley <dgrowleyml@gmail.com> wrote:
> 5. "Refactor" (fix the code to make it better)

> I have some ideas on how to fix the two #5s, so I'm going to go and do that now.

I've attached a patch which I think improves the code in
gistRelocateBuildBuffersOnSplit() so that there's no longer a shadowed
variable. I also benchmarked this method in a tight loop and can
measure no performance change from getting the loop index this way vs
the old way.

This only fixes one of the #5s I mentioned. I ended up scraping my
idea to fix the shadowed 'i' in get_qual_for_range() as it became too
complex.  The idea was to use list_cell_number() to find out how far
we looped in the forboth() loop.  It turned out that 'i' was used in
the subsequent loop in "j = i;". The fix just became too complex and I
didn't think it was worth the risk of breaking something just to get
rid of the showed 'i'.

David

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Tracking last scan time
Следующее
От: Justin Pryzby
Дата:
Сообщение: Re: shadow variables - pg15 edition