Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-04-05 Thread Aidar Imamov
object or marks them as dirty... I can't really say for sure about that. And in that context, I'd suggest referring to that awesome statement in the documentation: "If in doubt, functions should be labeled as UNSAFE, which is the default." regards, Aidar Imamov

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-04-05 Thread Aidar Imamov
k. In addition, this would remove the "flushed" parameter from the EvictUnpinnedBuffer() function. Because if we explicitly call LockBufHdr() outside of EvictUnpinnedBuffer(), we can already know in advance whether the buffer is dirty or not. The same applies to the suggestion to retrieve "flushed" count from the pg_buffercache_evict() call. We cannot say this for certain, but we can determine whether the buffer was dirty. regards, Aidar Imamov

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-03-27 Thread Aidar Imamov
dit the elog text to: "bad shared buffer ID" - just to clarify the case when provided buffer number is negative (local buffer number). pg_buffercache_mark_dirty_all(): Maybe also edit the comment to: "Try to mark all the shared buffers as dirty."? bufmgr.h: I think it might be a good idea to follow the Postgres formatting style and move the function's arguments to the next line if they exceed 80 characters. regards, Aidar Imamov

Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

2025-03-18 Thread Aidar Imamov
r of the BufTagMatchesRelFileLocator() and LockBufHdr() calls for improved efficiency (as mentioned in the comment on the BufTagMatchesRelFileLocator() call in the DropRelationBuffers() function in bufmgr.c). And it maybe useful also to add BUT_STATE_GET_REFCOUNT == 0 precheck before calling EvictUnpinnedBuffer()? regards, Aidar Imamov