Re: Checkpointer write combining

Поиск
Список
Период
Сортировка
От Melanie Plageman
Тема Re: Checkpointer write combining
Дата
Msg-id CAAKRu_b3k+KbeFhFgDZ26PvJbvL9W5HYwKrn8bBS4CTU13khpw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Checkpointer write combining  (Chao Li <li.evan.chao@gmail.com>)
Ответы Re: Checkpointer write combining
Список pgsql-hackers
On Thu, Sep 11, 2025 at 11:33 PM Chao Li <li.evan.chao@gmail.com> wrote:
>
> I don’t understand why the two versions are different:
>
> if (XLogNeedsFlush(lsn))
> {
> /*
> * Remove the dirty buffer from the ring; necessary to prevent an
> * infinite loop if all ring members are dirty.
> */
> strategy->buffers[strategy->current] = InvalidBuffer;
> return true;
> }
>
> return false;
>
> VS
>
> if (XLogNeedsFlush(lsn))
> return false;

I think you mean
if (!XLogNeedsFlush(lsn))
{
   return false;
}
// remove buffer
return true

is the same as

if (XLogNeedsFlush(lsn))
{
//remove dirty buffer
return true
}
return false;

Which is true. I've changed it to be like that.

Attached version 7 is rebased and has some bug fixes.

I also added a bonus batch on the end (0007) that refactors
SyncOneBuffer() to use the CAS loop pattern for pinning the buffer
that Andres introduced in 5e89985928795f243. bgwriter is now the only
user of SyncOneBuffer() and it rejects writing out buffers that are
used, so it seemed like a decent use case for this.

- Melanie

Вложения

В списке pgsql-hackers по дате отправления: