Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Joe Conway <mail(at)joeconway(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, "Guo, Adam" <adamguo(at)amazon(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Jim Mlodgenski <jimmy76(at)gmail(dot)com>
Subject: Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation
Date: 2024-09-10 06:25:35
Message-ID: 3364732.1725949535@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> writes:
> On Mon, Sep 9, 2024 at 4:42 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Do you have an idea for how we'd get
>> this to happen during pg_upgrade, exactly?

> What I was thinking is that we have "pg_dump --binary-upgrade" emit a
> function call, say "SELECT binary_upgrade_update_gin_meta_page()" for
> each GIN index, and the meta pages are updated when restoring the
> schemas.

Hmm, but ...

1. IIRC we don't move the relation files into the new cluster until
after we've run the schema dump/restore step. I think this'd have to
be driven in some other way than from the pg_dump output. I guess we
could have pg_upgrade start up the new postmaster and call a function
in each DB, which would have to scan for GIN indexes by itself.

2. How will this interact with --link mode? I don't see how it
doesn't involve scribbling on files that are shared with the old
cluster, leading to possible problems if the pg_upgrade fails later
and the user tries to go back to using the old cluster. It's not so
much the metapage update that is worrisome --- we're assuming that
that will modify storage that's unused in old versions. But the
change would be unrecorded in the old cluster's WAL, which sounds
risky.

Maybe we could get away with forcing --copy mode for affected
indexes, but that feels a bit messy. We'd not want to do it
for unaffected indexes, so the copying code would need to know
a great deal about this problem.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2024-09-10 06:28:42 Re: First draft of PG 17 release notes
Previous Message vignesh C 2024-09-10 06:06:02 Re: Invalid Assert while validating REPLICA IDENTITY?