Re: Reducing connection overhead in pg_upgrade compat check phase - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Reducing connection overhead in pg_upgrade compat check phase
Date
Msg-id 9C9D8A09-9794-46DD-8074-8961924B99F1@yesql.se
Whole thread Raw
In response to Re: Reducing connection overhead in pg_upgrade compat check phase  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: Reducing connection overhead in pg_upgrade compat check phase
List pgsql-hackers
> On 4 Jul 2023, at 21:08, Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> I put together a rebased version of the patch for cfbot.

Thanks for doing that, much appreciated!  I was busy looking at other peoples
patches and hadn't gotten to my own yet =)

> On 13 Mar 2023, at 19:21, Nathan Bossart <nathandbossart@gmail.com> wrote:

> I noticed that git-am complained when I applied the patch:
>
>    Applying: pg_upgrade: run all data type checks per connection
>    .git/rebase-apply/patch:1023: new blank line at EOF.
>    +
>    warning: 1 line adds whitespace errors.

Fixed.

> +                for (int rowno = 0; rowno < ntups; rowno++)
> +                {
> +                    found = true;
>
> It looks like "found" is set unconditionally a few lines above, so I think
> this is redundant.

Correct, this must've been a leftover from a previous coding that changed.
Removed.

> Also, I think it would be worth breaking check_for_data_types_usage() into
> a few separate functions (or doing some other similar refactoring) to
> improve readability.  At this point, the function is quite lengthy, and I
> count 6 levels of indentation at some lines.


It it is pretty big for sure, but it's also IMHO not terribly complicated as
it's not really performing any hard to follow logic.

I have no issues refactoring it, but trying my hand at I was only making (what
I consider) less readable code by having to jump around so I consider it a
failure.  If you have any suggestions, I would be more than happy to review and
incorporate those though.

Attached is a v5 with the above fixes and a pgindenting to fix up a few runaway
comments and indentations.

--
Daniel Gustafsson




Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pgindent vs. pgperltidy command-line arguments
Next
From: Daniel Gustafsson
Date:
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands