Re: In-placre persistance change of a relation

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: rjuju123(at)gmail(dot)com, jakub(dot)wartak(at)tomtom(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: In-placre persistance change of a relation
Date: 2022-03-01 05:14:13
Message-ID: 20220301.141413.1764860719587286375.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rebased on a recent xlog refactoring.

No functional changes have been made.

- Removed the default case in smgr_desc since it seems to me we don't
assume out-of-definition values in xlog records elsewhere.

- Simplified some added to storage.c.

- Fix copy-pasto'ed comments in extractPageInfo().

- The previous version smgrDoPendingCleanups() assumes that init-fork
are not loaded onto shared buffer but it is wrong
(SetRelationBuffersPersistence assumes the opposite.). Thus we need
to drop buffers before unlink an init fork. But it is already
guaranteed by logic so I rewrote the comment for for PCOP_UNLINK_FORK.

> * Unlink the fork file. Currently we use this only for
> * init forks and we're sure that the init fork is not
> * loaded on shared buffers. For RelationDropInitFork
> * case, the function dropped that buffers. For
> * RelationCreateInitFork case, PCOP_SET_PERSISTENCE(true)
> * is set and the buffers have been dropped just before.

This logic has the same critical window as
DropRelFilenodeBuffers. That is, if file deletion fails after
successful buffer dropping, theoretically the file content of the
init fork may be stale. However, AFAICS init-fork is write-once fork
so I don't think that actually matters.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
v18-0001-In-place-table-persistence-change.patch text/x-patch 75.4 KB
v18-0002-New-command-ALTER-TABLE-ALL-IN-TABLESPACE-SET-LO.patch text/x-patch 20.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-03-01 05:40:09 Re: Allow async standbys wait for sync replication (was: Disallow quorum uncommitted (with synchronous standbys) txns in logical replication subscribers)
Previous Message Ajin Cherian 2022-03-01 05:02:17 Re: logical replication empty transactions