Re: Do away with zero-padding assumption before WALRead()

Поиск
Список
Период
Сортировка
От Nazir Bilal Yavuz
Тема Re: Do away with zero-padding assumption before WALRead()
Дата
Msg-id CAN55FZ3xJtvk-PMxJLrX2LC+-1jkMoXK44ceGtS5JmLsCQV1Fg@mail.gmail.com
обсуждение исходный текст
Ответ на Do away with zero-padding assumption before WALRead()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Ответы Re: Do away with zero-padding assumption before WALRead()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
Hi,

On Tue, 13 Feb 2024 at 09:17, Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> Hi,
>
> I noticed an assumption [1] at WALRead() call sites expecting the
> flushed WAL page to be zero-padded after the flush LSN. I think this
> can't always be true as the WAL can get flushed after determining the
> flush LSN before reading it from the WAL file using WALRead(). I've
> hacked the code up a bit to check if that's true -
> https://github.com/BRupireddy2/postgres/tree/ensure_extra_read_WAL_page_is_zero_padded_at_the_end_WIP,
> the tests hit the Assert(false); added. Which means, the zero-padding
> comment around WALRead() call sites isn't quite right.
>
> I'm wondering why the WALRead() callers are always reading XLOG_BLCKSZ
> despite knowing exactly how much to read. Is it to tell the OS to
> explicitly fetch the whole page from the disk? If yes, the OS will do
> that anyway because the page transfers from disk to OS page cache are
> always in terms of disk block sizes, no?

I am curious about the same. The page size and disk block size could
be different, so the reason could be explicitly fetching the whole
page from the disk as you said. Is this the reason or are there any
other benefits of always reading XLOG_BLCKSZ instead of reading the
sufficient part? I tried to search in older threads and code comments
but I could not find an explanation.

-- 
Regards,
Nazir Bilal Yavuz
Microsoft



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Oleg Tselebrovskiy
Дата:
Сообщение: Re: Returning non-terminated string in ECPG Informix-compatible function
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Allow passing extra options to initdb for tests