From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: statistics for shared catalogs not updated when autovacuum is off |
Date: | 2016-05-25 18:56:26 |
Message-ID: | 4625.1464202586@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> In short, I think the attached is enough to fix it. There's some cosmetic
> cleanup that could be done here: a lot of these functions could use better
> comments, and I'm not happy about the autovac launcher depending on
> MyDatabaseId being zero. But those are not functional problems.
While re-reading this, I realized that there's a second serious bug in the
same area: commit 187492b6c basically broke the mechanism that prevents
duplicated writes when two backends send inquiries for the same DB at
about the same time. The intention is that if an inquiry arrives with a
cutoff_time older than when we last wrote the DB's stats, we don't have to
do anything. But as the code stands we will make a DBWriteRequest
unconditionally, because the previous request has been removed from the
list. It would only succeed in merging requests if the second one arrives
before we have executed a write in response to the first one, which looks
to me to be impossible given the coding of the message-processing loop in
PgstatCollectorMain.
In the attached expanded patch, I fixed pgstat_recv_inquiry() to not make
a write request unless the cutoff-time restriction is met. I also removed
DBWriteRequest.request_time, which was not being consulted at all. At
this point the DBWriteRequest data structure is just overkill and could be
replaced by an OID list at very substantial notational savings, but I've
not done that yet.
Comments/objections?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
pgstat-fixes.patch | text/x-diff | 7.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2016-05-25 18:57:12 | Re: Changed SRF in targetlist handling |
Previous Message | Andres Freund | 2016-05-25 18:15:37 | Re: Is the unfair lwlock behavior intended? |