Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3ccc66d

Browse files
committed
Fix bug in LWLock statistics mechanism.
Previously PostgreSQL built with -DLWLOCK_STATS could reportmore than one LWLock statistics entries for the same backendprocess and the same LWLock. This is strange and only onestatistics should be output in that case, instead.The cause of this issue is that the key variable used forLWLock stats hash table was not fully initialized. The keyconsists of two fields and they were initialized. Butthe following 4 bytes allocated in the key variable forthe alignment was not initialized. So even if the same keywas specified, hash_search(HASH_ENTER) could not findthe existing entry for that key and created new one.This commit fixes this issue by initializing the keyvariable with zero. As the side effect of this commit,the volume of LWLock statistics output would be reducedvery much.Back-patch to v10, where commit3761fe3 introduced the issue.Author: Fujii MasaoReviewed-by: Julien Rouhaud, Kyotaro HoriguchiDiscussion:https://postgr.es/m/26359edb-798a-568f-d93a-6aafac49752d@oss.nttdata.com
1 parentb025f32 commit3ccc66d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎src/backend/storage/lmgr/lwlock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ get_lwlock_stats_entry(LWLock *lock)
310310
return&lwlock_stats_dummy;
311311

312312
/* Fetch or create the entry. */
313+
MemSet(&key,0,sizeof(key));
313314
key.tranche=lock->tranche;
314315
key.instance=lock;
315316
lwstats=hash_search(lwlock_stats_htab,&key,HASH_ENTER,&found);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp