[PATCH] xlogreader: do not read a file block twice
Artur Zakirov <a.zakirov@postgrespro.ru>
From: Arthur Zakirov <a.zakirov@postgrespro.ru>
To: pgsql-hackers@lists.postgresql.org
Cc: Grigory Smolkin <g.smolkin@postgrespro.ru>
Date: 2019-02-11T16:25:39Z
Lists: pgsql-hackers
Attachments
- xlogreader-reqlen.patch (text/x-patch) patch
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
Commits
-
Avoid some unnecessary block reads in WAL reader
- 0dd6ff0ac848 12.0 landed
-
Split out XLog reading as an independent facility
- 7fcbf6a405ff 9.3.0 cited
-
Make standby server continuously retry restoring the next WAL segment with
- 1bb2558046cc 9.0.0 cited