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

Поиск
Список
Период
Сортировка
От Arthur Zakirov
Тема [PATCH] xlogreader: do not read a file block twice
Дата
Msg-id 2ddf4a32-517e-d6f4-d992-4a63b6035bfd@postgrespro.ru
обсуждение исходный текст
Ответы Re: [PATCH] xlogreader: do not read a file block twice  (Grigory Smolkin <g.smolkin@postgrespro.ru>)
Re: [PATCH] xlogreader: do not read a file block twice  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Список pgsql-hackers
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?

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: libpq compression
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: libpq compression