Re: In-placre persistance change of a relation

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: Jakub.Wartak@tomtom.com
Cc: tsunakawa.takay@fujitsu.com, osumi.takamichi@fujitsu.com, sfrost@snowman.net, masao.fujii@oss.nttdata.com, ashutosh.bapat.oss@gmail.com, pgsql-hackers@lists.postgresql.org
Date: 2021-12-21T11:04:55Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pg_dump: Refactor getIndexes()

  2. Optimize DropRelFileNodesAllBuffers() for recovery.

Attachments

At Tue, 21 Dec 2021 17:13:21 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in 
> Ugh! I completely forgot about TAP tests.. Thanks for the testing and
> sorry for the bugs.
> 
> This is a bit big change so I need a bit of time before posting the
> next version.

I took a bit too long detour but the patch gets to pass make-world for
me.

In this version:

- When relation persistence is changed from logged to unlogged, buffer
 persistence is flipped then an init-fork is created along with a mark
 file for the fork (RelationCreateInitFork). The mark file is removed
 at commit but left alone after a crash before commit. At the next
 startup, ResetUnloggedRelationsInDbspaceDir() removes the init fork
 file if it finds the mark file corresponding to the file.

- When relation persistence is changed from unlogged to logged, buffer
  persistence is flipped then the exisging init-fork is marked to be
  dropped at commit (RelationDropInitFork). Finally the whole content
  is WAL-logged in the page-wise manner (RelationChangePersistence),

- The two operations above are repeatable within a transaction and
 commit makes the last operation persist and rollback make the all
 operations abandoned.

- Storage files are created along with a "mark" file for the
 relfilenode. It behaves the same way to the above except the mark
 files corresponds to the whole relfilenode.

- The at-commit operations this patch adds require to be WAL-logged so
 they don't fit pendingDeletes list, which is executed after commit. I
 added a new pending-work list pendingCleanups that is executed just
 after pendingSyncs.  (new in this version)

 
regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center