Re: Add TOAST support for more system tables

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sofia Kopikova <s(dot)kopikova(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add TOAST support for more system tables
Date: 2023-07-18 05:32:40
Message-ID: ZLYj+IwSyyYw8Cu4@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 17, 2023 at 06:31:04PM -0400, Tom Lane wrote:
> Sofia Kopikova <s(dot)kopikova(at)postgrespro(dot)ru> writes:
> > This patch adds TOAST support for system tables pg_class,
> > pg_attribute and pg_largeobject_metadata, as they include ACL columns,
> > which may be potentially large in size.
>
> We have been around on this topic before, cf discussion leading up to
> commit 96cdeae07. Allowing toasted data in pg_class or pg_attribute
> seems quite scary to me because of the potential for recursive access,
> particularly during cache-flush scenarios. (That is, you need to be
> able to read those catalogs on the way to fetching a toasted value,
> so how can you be sure that doesn't devolve into an infinite loop?)

Yep. I have something to add here. The last time I poked at that, I
was wondering about two code paths that have specific comments on this
matter. Based on my notes:
1) finish_heap_swap() in cluster.c:
* pg_class doesn't have a toast relation, so we don't need to update the
* corresponding toast relation. Not that there's little point moving all
* relfrozenxid updates here since swap_relation_files() needs to write to
* pg_class for non-mapped relations anyway.
2) extract_autovac_opts() in autovacuum.c:
* we acquired the pg_class row. If pg_class had a TOAST table, this would
* be a risk; fortunately, it doesn't.

What has been posted makes zero adjustments in these areas.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-07-18 05:37:04 Re: Support logical replication of DDLs
Previous Message Masahiko Sawada 2023-07-18 05:28:08 Re: Support logical replication of DDLs