| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
| Cc: | Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Rui Zhao <zhaorui126(at)gmail(dot)com>, Konstantin Knizhnik <konstantin(dot)knizhnik(at)databricks(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com> |
| Subject: | Re: BUG #19519: REPACK can fail due to missing chunk for toast value |
| Date: | 2026-12-04 23:08:31 |
| Message-ID: | CA+TgmoZkMEE35A0zpLLHzrd4xNUq7zy7c65qvKr7OemXzGro-g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Fri, Dec 4, 2026 at 5:20 PM Matthias van de Meent
<boekewurm+postgres(at)gmail(dot)com> wrote:
> Is there really no better approach available than this? I strongly
> dislike hidden magic global variables. Furthermore, blocking pruning
> on a toast table that was already targeted by REPACK (either directly
> or indirectly) does sound like it would not benefit the user.
I'm also wondering that, but the alternatives we've considered so far
all seem bad. If we pretend the tuples are valid, then we have the
current behavior, where we try to follow invalid TOAST pointers. So
that means we have to validate them. If we do that before letting them
escape into the rest of the backend, that's more reliable, but it's
expensive, because it means we have to iterate through the tuple and
materialize all the TOAST pointers, or at a minimum check that they're
valid and ensure that they can't go away. CPU cost is a concern, but
so is storage: the inlined tuples flow into things like tuplesorts,
where they can make things fail that would have worked. Running out of
disk space when trying to REPACK doesn't benefit the user, either. If
we let the possibly-not-accessible tuples escape the narrow sections
of code that we control, then it's just hard to be sure whether
they're going to end up in some part of the code that can't deal with
them, and we probably have to pass around some kind of recheck flag to
indicate which ones are suspect. If there's another option, I haven't
figured it out, yet.
Disabling pruning doesn't actually sound that bad. Aren't we going to
rewrite the toast table and drop all the dead tuples anyway? If so,
pruning the dead toast tuples in the old copy of the table sounds like
wasted effort.
That's not to say that I disagree with you in principal. I sort of
feel like the problem here is that the VACUUM FULL / CLUSTER / REPACK
is doing something ridiculous and we're trying to patch it up after
the fact. Trying to process tuples after any random subset of their
TOAST pointers may have been garbage collected seems like a grave
violation of how the system is supposed to work. But I don't have an
idea what could be done differently on that side of things, either.
> Aside: We should probably start working on making the horizons' lack
> of monotonicity actually guaranteed monotonicity, because this is not
> the first time we're getting bitten by the horizons receding. Bug
> #17257 comes to mind, but I seem to recall we've seen more than just
> that bug.
To my knowledge, every previous attempt to solve this problem has
involved someone (1) being certain that they can come up with
something, (2) proposing a design, (3) being shown an unfixable
weakness of that design, and (4) giving up. All steps are repeatable
but we always seem to converge to (4).
--
Robert Haas
Databricks
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-12-04 23:19:35 | Re: Large regex fails with XX000 instead of a regex error |
| Previous Message | Matthias van de Meent | 2026-12-04 22:20:18 | Re: BUG #19519: REPACK can fail due to missing chunk for toast value |