Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

Maksim Milyutin <milyutinma@gmail.com>

From: Maksim Milyutin <milyutinma@gmail.com>
To: Thomas Munro <thomas.munro@gmail.com>, Maxim Orlov <orlovmg@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, Palak Chaturvedi <chaturvedipalak1911@gmail.com>, Jim Nasby <jim.nasby@gmail.com>, pgsql-hackers@postgresql.org, Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Date: 2024-04-29T18:47:41Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add pg_buffercache_evict() function for testing.

On 14.04.2024 21:16, Maksim Milyutin wrote:

> On 07.04.2024 02:07, Thomas Munro wrote:
>
>> So this is the version I plan to commit.
>>
>> +bool
>> +EvictUnpinnedBuffer(Buffer buf)
>> +{
>> ...
>> +    /* This will return false if it becomes dirty or someone else pins it. */
>> +    result = InvalidateVictimBuffer(desc);
>> +
>> +    UnpinBuffer(desc);
>> +
>> +    return result;
>> +}
>
>
> Hi, Thomas!
>
> Should not we call at the end the StrategyFreeBuffer() function to add 
> target buffer to freelist and not miss it after invalidation?
>

Hello everyone!

Please take a look at this issue, current implementation of 
EvictUnpinnedBuffer() IMO is erroneous - evicted buffers are lost 
permanently and will not be reused again

-- 
Best regards,
Maksim Milyutin