Srinath Reddy Sadipiralla <srinath.re...@zohocorp.com> writes: >> ---- On Thu, 05 Dec 2024 21:11:42 +0530 Andres Freund >> <mailto:and...@anarazel.de> wrote --- >> The gain by not dealing with local buffers in these functions is fairly >> small >> too, so there's not really any reason for a change like yours. > hmm got it,if thats the case, for local buffers lockbuffer will skip > acquiring content lock, so assert will fail in BufferIsDirty.
I think you are right about that, but (1) it seems to be general style to check BufferIsPinned before checking the content lock, and you've made that out-of-order. This is easily fixed by moving the Assert(BufferIsPinned(buffer)) to earlier in the function. (2) I don't think we should touch this but not worry about BufferIsExclusiveLocked: it's unlikely to behave well on local buffers either, since we don't initialize content locks for them. We could either Assert that that's not applied to local buffers, or act as though their lock is always held. Given Andres' argument probably the latter is better. regards, tom lane