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-14T18:16:15Z
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 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?

-- 
Best regards,
Maksim Milyutin