Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane wrote:
>> Unfortunately, it doesn't. See hint bits.
> Hmm, so it seems we need to keep held of the bufferhead's spinlock while
> calculating the checksum, just after resetting BM_JUST_DIRTIED. Yuck.
No, holding a spinlock that long is entirely unacceptable, and it's the
wrong thing anyway, because we don't hold the header lock while
manipulating hint bits.
What this would *actually* mean is that we'd need to hold exclusive not
shared buffer lock on a buffer we are about to write, and that would
have to be maintained while computing the checksum and until the write
is completed. The JUST_DIRTIED business could go away, in fact.
(Thinks for a bit...) I wonder if that could induce any deadlock
problems? The concurrency hit might be the least of our worries.
regards, tom lane