Re: Use read streams in CREATE DATABASE command when the strategy is wal_log

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use read streams in CREATE DATABASE command when the strategy is wal_log
Date: 2024-07-22 09:00:45
Message-ID: CAN55FZ2+AnVKBimqwLSf2hvmUuU5a=WpfgQO=oGXUBrd9jkEKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sat, 20 Jul 2024 at 21:14, Noah Misch <noah(at)leadboat(dot)com> wrote:
>
> On Sat, Jul 20, 2024 at 03:01:31PM +0300, Nazir Bilal Yavuz wrote:
> >
> > With the separate commit (e00c45f685), does it make sense to rename
> > the smgr_persistence parameter of the ReadBuffer_common() to
> > persistence? Because, ExtendBufferedRelTo() calls ReadBuffer_common()
> > with rel's persistence now, not with smgr's persistence.
>
> BMR_REL() doesn't set relpersistence, so bmr.relpersistence is associated with
> bmr.smgr and is unset if bmr.rel is set. That is to say, bmr.relpersistence
> is an smgr_persistence. It could make sense to change ReadBuffer_common() to
> take a BufferManagerRelation instead of the three distinct arguments.

Got it.

>
> On a different naming topic, my review missed that field name
> copy_storage_using_buffer_read_stream_private.last_block doesn't fit how the
> field is used. Code uses it like an nblocks. So let's either rename the
> field or change the code to use it as a last_block (e.g. initialize it to
> nblocks-1, not nblocks).

I prefered renaming it as nblocks, since that is how it was used in
RelationCopyStorageUsingBuffer() before. Also, I realized that instead
of setting p.blocknum = 0; initializing blkno as 0 and using
p.blocknum = blkno makes sense. Because, p.blocknum and blkno should
always start with the same block number. The relevant patch is
attached.

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachment Content-Type Size
v5-0001-Minimal-refactorings-on-RelationCopyStorageUsingB.patch text/x-patch 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2024-07-22 09:03:07 Re: Conflict detection and logging in logical replication
Previous Message Andrey M. Borodin 2024-07-22 09:00:32 Re: WIP: parallel GiST index builds