• Michael Paquier's avatar
    Avoid some unnecessary block reads in WAL reader · 0dd6ff0a
    Michael Paquier authored
    When reading a new page internally and depending on the way the WAL
    reader facility gets used by plugins, the current implementation of the
    WAL reader may finish by reading a block multiple times while it is not
    actually necessary as the requested data length may be equal to what has
    been already read.  This can happen for any size, but is more likely to
    happen at the end of a page.  This can cause performance penalties in
    plugins which rely on the block reads to be purely sequential, zlib not
    liking backward reads for example.  The new behavior also shaves some
    cycles when doing recovery.
    
    Author: Arthur Zakirov
    Reviewed-by: Andrey Lepikhov, Michael Paquier, Grigory Smolkin
    Discussion: https://postgr.es/m/2ddf4a32-517e-d6f4-d992-4a63b6035bfd@postgrespro.ru
    0dd6ff0a
xlogreader.c 39.7 KB