Re: [HACKERS] A weird bit in pg_upgrade/exec.c

From: a(dot)akenteva(at)postgrespro(dot)ru
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-owner(at)postgresql(dot)org
Subject: Re: [HACKERS] A weird bit in pg_upgrade/exec.c
Date: 2017-11-16 12:05:59
Message-ID: ba81b93e77c4bc1778ae6f0def7be883@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Yeah, the way it is now seems outright broken. It will try to do
> get_bin_version on the new cluster before having done validate_exec
> there, violating its own comment.
>
> I think we should change this as a bug fix, independently of whatever
> else you had in mind to do here.

I see this bug is now fixed in pg_upgrade/exec.c => check_bin_dir().

There's another bit exactly like that in check_data_dir() though.
We use global variables instead of using the argument passed to the
function,
which makes the function not reusable. Sorry if I mentioned it too
vaguely
in the previous letter.

I attached a patch with the change that would fix it.
In pg_upgrade/exec.c => check_data_dir() I substituted these two lines
old_cluster.major_version = get_major_server_version(&old_cluster);
new_cluster.major_version = get_major_server_version(&new_cluster);
with this line:
cluster->major_version = get_major_server_version(cluster);
and changed the comment accordingly.

Attachment Content-Type Size
Fixed-exec-c.patch text/x-diff 1.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-11-16 12:08:19 Re: [HACKERS] ginInsertCleanup called from vacuum could still miss tuples to be deleted
Previous Message Rafia Sabih 2017-11-16 12:05:22 Re: [HACKERS] [POC] Faster processing at Gather node