pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix bug in LWLock statistics mechanism.
Date: Thu, 06 Feb 2020 05:46:51 +0000
Message-ID: <E1iza03-0006OD-1H@gemulon.postgresql.org> (raw)

Fix bug in LWLock statistics mechanism.

Previously PostgreSQL built with -DLWLOCK_STATS could report
more than one LWLock statistics entries for the same backend
process and the same LWLock. This is strange and only one
statistics should be output in that case, instead.

The cause of this issue is that the key variable used for
LWLock stats hash table was not fully initialized. The key
consists of two fields and they were initialized. But
the following 4 bytes allocated in the key variable for
the alignment was not initialized. So even if the same key
was specified, hash_search(HASH_ENTER) could not find
the existing entry for that key and created new one.

This commit fixes this issue by initializing the key
variable with zero. As the side effect of this commit,
the volume of LWLock statistics output would be reduced
very much.

Back-patch to v10, where commit 3761fe3c20 introduced the issue.

Author: Fujii Masao
Reviewed-by: Julien Rouhaud, Kyotaro Horiguchi
Discussion: https://postgr.es/m/26359edb-798a-568f-d93a-6aafac49752d@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3ccc66dac65e12b8f19d0766b00feabd55433854

Modified Files
--------------
src/backend/storage/lmgr/lwlock.c | 1 +
1 file changed, 1 insertion(+)



view thread (4+ messages)

Message-ID: <E1iza03-0006OD-1H@gemulon.postgresql.org>
Permalink:  ../E1iza03-0006OD-1H@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iza03-0006OD-1H@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org
  Subject: Re: pgsql: Fix bug in LWLock statistics mechanism.
  In-Reply-To: <E1iza03-0006OD-1H@gemulon.postgresql.org>
  References: <E1iza03-0006OD-1H@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox