pg_upgrade dead code for pre-8.4 versions

Started by Magnus Haganderalmost 6 years ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

never appliedCI history
Jump to latest
#1Magnus Hagander
magnus@hagander.net

pg_upgrade documentation says it supports upgrades from 8.4 and newer.

But there is code in there that makes a check and differs pre-8.4 from
8.4-or-newer.

ISTM that code could be cleaned out, because it should be dead based on the
initial check that we are upgrading from 8.4 or later?

This appears to be:
* The code in the analyze script (see a follow-up email on this), which
actually tries to generate a vacuum script if it's a pre-8.4 without
visibility map
* The file copy code in relfilenode.c that copies vm and fsm files only
from 8.4 and up (which should now be always)

Or am I misreading something?

//Magnus

#2Daniel Gustafsson
daniel@yesql.se
In reply to: Magnus Hagander (#1)
Re: pg_upgrade dead code for pre-8.4 versions

On 6 Oct 2020, at 11:27, Magnus Hagander <magnus@hagander.net> wrote:

ISTM that code could be cleaned out, because it should be dead based on the initial check that we are upgrading from 8.4 or later?

+1. Commit 2209b3923a7afe0b removed support for 8.3 so anything left checking
for pre-8.4 should be removed as a pre-8.4 source cluster couldn't be upgraded
with pg_upgrade today.

cheers ./daniel

#3Bruce Momjian
bruce@momjian.us
In reply to: Daniel Gustafsson (#2)
Re: pg_upgrade dead code for pre-8.4 versions

On Tue, Oct 6, 2020 at 11:40:57AM +0200, Daniel Gustafsson wrote:

On 6 Oct 2020, at 11:27, Magnus Hagander <magnus@hagander.net> wrote:

ISTM that code could be cleaned out, because it should be dead based on the initial check that we are upgrading from 8.4 or later?

+1. Commit 2209b3923a7afe0b removed support for 8.3 so anything left checking
for pre-8.4 should be removed as a pre-8.4 source cluster couldn't be upgraded
with pg_upgrade today.

OK, fixed with the attached patch, applied to all branches. There was
code that tested for >= 8.4 (useless test) or < 8.4 (dead code). I
also adjusted the version tests to be consistent.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

Attachments:

pg_upgrade.difftext/x-diff; charset=us-asciiDownload+39-43
#4Magnus Hagander
magnus@hagander.net
In reply to: Bruce Momjian (#3)
Re: pg_upgrade dead code for pre-8.4 versions

On Tue, Oct 6, 2020 at 8:45 PM Bruce Momjian <bruce@momjian.us> wrote:

On Tue, Oct 6, 2020 at 11:40:57AM +0200, Daniel Gustafsson wrote:

On 6 Oct 2020, at 11:27, Magnus Hagander <magnus@hagander.net> wrote:

ISTM that code could be cleaned out, because it should be dead based

on the initial check that we are upgrading from 8.4 or later?

+1. Commit 2209b3923a7afe0b removed support for 8.3 so anything left

checking

for pre-8.4 should be removed as a pre-8.4 source cluster couldn't be

upgraded

with pg_upgrade today.

OK, fixed with the attached patch, applied to all branches. There was
code that tested for >= 8.4 (useless test) or < 8.4 (dead code). I
also adjusted the version tests to be consistent.

Thanks!

And yeah, I noticed the inconsistency in the checking as well. Getting that
cleaned up was good.

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;