Re: More problems with VacuumPageHit style global variables - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: More problems with VacuumPageHit style global variables
Date
Msg-id CAH2-WzkrCeBwKV-sA1Q8VW7Uf8ghuFyynWqF1gfNphZvkAMBBQ@mail.gmail.com
Whole thread Raw
In response to Re: More problems with VacuumPageHit style global variables  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On Thu, Apr 21, 2022 at 4:28 PM Peter Geoghegan <pg@bowt.ie> wrote:
> I don't think that there is any risk of one user of either variable
> "clobbering" some other user -- the current values of the variables
> are not actually meaningful at all. They're only useful as a way that
> an arbitrary piece of code instruments an arbitrary operation, by
> making their own copies, running whatever the operation is, and then
> reporting on the deltas. Which makes it even more surprising that this
> was overlooked until now.

I suppose code like pgstat_update_dbstats() would need to copy
pgBufferUsage somewhere if we were to get rid of pgStatBlockReadTime
and pgStatBlockWriteTime. That might not have been acceptable back
when we had the old stats collector; frequent copying of pgBufferUsage
might have non-trivial overhead. The relevant struct (BufferUsage) has
over 10 64-bit integers, versus only 2 for pgStatBlockReadTime and
pgStatBlockWriteTime.

But does that matter anymore now that we have the cumulative stats
system? Doesn't the redundancy seem like a problem?
-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: More problems with VacuumPageHit style global variables
Next
From: Japin Li
Date:
Subject: Re: Replace open mode with PG_BINARY_R/W/A macros