From 35bba97d3cb19445c08f10d7a7d541f0b29322c1 Mon Sep 17 00:00:00 2001 From: Maksim Melnikov Date: Thu, 29 Jan 2026 16:10:08 +0300 Subject: [PATCH] pg_wait_sampling code should be stable to the struct LOCKTAG extension. LOCKTAG is used in hash calculations, so if new field is added to LOCKTAG and this field is not initialized in pg_wait_sampling internals, as the result, the hashcode of LOCKTAG will have different values for two independent calculations. --- pg_wait_sampling.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pg_wait_sampling.c b/pg_wait_sampling.c index 7e8abb9..e955731 100644 --- a/pg_wait_sampling.c +++ b/pg_wait_sampling.c @@ -622,6 +622,7 @@ typedef struct void pgws_init_lock_tag(LOCKTAG *tag, uint32 lock) { + memset(tag, 0, sizeof(LOCKTAG)); tag->locktag_field1 = PG_WAIT_SAMPLING_MAGIC; tag->locktag_field2 = lock; tag->locktag_field3 = 0;