Re: Use read streams in CREATE DATABASE command when the strategy is wal_log - Mailing list pgsql-hackers

From Nazir Bilal Yavuz
Subject Re: Use read streams in CREATE DATABASE command when the strategy is wal_log
Date
Msg-id CAN55FZ2+AnVKBimqwLSf2hvmUuU5a=WpfgQO=oGXUBrd9jkEKw@mail.gmail.com
Whole thread Raw
In response to Re: Use read streams in CREATE DATABASE command when the strategy is wal_log  (Noah Misch <noah@leadboat.com>)
Responses Re: Use read streams in CREATE DATABASE command when the strategy is wal_log
List pgsql-hackers
Hi,

On Sat, 20 Jul 2024 at 21:14, Noah Misch <noah@leadboat.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

pgsql-hackers by date:

Previous
From: "Andrey M. Borodin"
Date:
Subject: Re: WIP: parallel GiST index builds
Next
From: shveta malik
Date:
Subject: Re: Conflict detection and logging in logical replication