You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bufmgr: Add interface to acquire right to set hint bits
At the moment hint bits can be set with just a share lock on a page (and in
one place even without any lock). Because of this we need to copy pages while
writing them out, as otherwise the checksum could be corrupted.
The need to copy the page is problematic for the AIO patchset:
1) Instead of just needing a single buffer for a copied page we need one for
each page that's potentially undergoing IO
2) To be able to use the "worker" AIO implementation the copied page needs to
reside in shared memory.
Even without AIO copying the page isn't free...
This commit starts to address that by adding BufferPrepareToSetHintBits(),
which needs to be called before setting hint bits on a
buffer. BufferPrepareToSetHintBits() only allows hint bit writes if there's no
ongoing IO and while hint bits are being set no IO is allowed to be started.
To know that a buffer is undergoing IO a new BufferDesc state flag is used,
BM_SETTING_HINTS. Theoretically it'd be possible to reuse BM_IO_IN_PROGRESS,
but that'd make it harder to debug the system.
The new interface is not yet used, that will happen in subsequent commits, to
make review a bit easier. Therefore we cannot yet rely on not needing a copy
of the buffer during IO.
Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
0 commit comments