Re: Count and log pages set all-frozen by vacuum

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Count and log pages set all-frozen by vacuum
Date: 2024-10-31 22:30:02
Message-ID: CAAKRu_aw-fYc0QGUCZDvO8wbYXr43kcRBQC0vo_3949YAmnaKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for the review!

On Thu, Oct 31, 2024 at 2:13 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
>
> Some small suggestions:
>
> + vmbits = visibilitymap_set(vacrel->rel, blkno, buf,
> + InvalidXLogRecPtr,
> + vmbuffer, InvalidTransactionId,
> + VISIBILITYMAP_ALL_VISIBLE |
> + VISIBILITYMAP_ALL_FROZEN);
>
> How about using "old_vmbits" or something along the same lines to make
> it clear that this value has the bits before visibilitymap_set()?

I've changed it like this.

> ---
> + /* If it wasn't all-frozen before, count it */
> + if (!(vmbits & VISIBILITYMAP_ALL_FROZEN))
>
> To keep consistent with surrounding codes in lazyvacuum.c, I think we
> can write "if ((vmbits & VISIBILITYMAP_ALL_FROZEN) == 0)" instead.

Ah, yes. I considered this. I find the == 0 way more confusing, but I
didn't want to change the other occurrences because maybe other people
like them. But, you're quite right, I should be consistent. I've
changed them to match the current style.

The attached patch set also counts pages set all-visible. I've given
the LVRelState member for it the unfortunate name "vm_page_visibles."
It matches the part of speech of vm_page_freezes. I like that it
conveys that it is the number of pages set all-visible not the number
of pages that are all-visible. Also I didn't want to include the word
"all" since vm_page_freezes doesn't have the word "all". However, it
sounds rather awkward. Suggestions welcome.

- Melanie

Attachment Content-Type Size
v2-0002-Make-visibilitymap_set-return-previous-state-of-v.patch application/octet-stream 3.2 KB
v2-0001-Rename-LVRelState-frozen_pages.patch application/octet-stream 3.3 KB
v2-0003-Count-pages-set-all-visible-and-all-frozen-in-VM-.patch application/octet-stream 6.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-10-31 22:58:42 Re: Test to dump and restore objects left behind by regression
Previous Message Heikki Linnakangas 2024-10-31 22:18:00 Re: IPC::Run::time[r|out] vs our TAP tests