Re: [PATCH] xlogreader: do not read a file block twice

From: Grigory Smolkin <g(dot)smolkin(at)postgrespro(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] xlogreader: do not read a file block twice
Date: 2019-02-11 16:32:59
Message-ID: 87e30af6-f85a-dc95-4574-95cded028786@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hm, looks like it could speed up PostgreSQL recovery, but is it safe?

On 02/11/2019 07:25 PM, Arthur Zakirov wrote:
> Hello hackers,
>
> Grigory noticed that one of our utilities has very slow performance
> when xlogreader reads zlib archives. We found out that xlogreader
> sometimes reads a WAL file block twice.
>
> zlib has slow performance when you read an archive not in sequential
> order. I think reading a block twice in same position isn't
> sequential, because gzread() moves current position forward and next
> call gzseek() to the same position moves it back.
>
> It seems that the attached patch solves the issue. I think when reqLen
> == state->readLen the requested block already is in the xlogreader's
> buffer.
>
> What do you think?
>

--
Grigory Smolkin
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2019-02-11 17:18:28 Re: WIP: Avoid creation of the free space map for small tables
Previous Message Peter Eisentraut 2019-02-11 16:28:40 Re: libpq compression