inj-stats-lock.patch

text/x-diff

Filename: inj-stats-lock.patch
Type: text/x-diff
Part: 0
Message: Fix locking issue with fixed-size stats template in injection_points

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/test/modules/injection_points/injection_stats_fixed.c 4 0
diff --git a/src/test/modules/injection_points/injection_stats_fixed.c b/src/test/modules/injection_points/injection_stats_fixed.c
index bc54c79d190b..74c35fcbfa71 100644
--- a/src/test/modules/injection_points/injection_stats_fixed.c
+++ b/src/test/modules/injection_points/injection_stats_fixed.c
@@ -152,6 +152,8 @@ pgstat_report_inj_fixed(uint32 numattach,
 
 	stats_shmem = pgstat_get_custom_shmem_data(PGSTAT_KIND_INJECTION_FIXED);
 
+	LWLockAcquire(&stats_shmem->lock, LW_EXCLUSIVE);
+
 	pgstat_begin_changecount_write(&stats_shmem->changecount);
 	stats_shmem->stats.numattach += numattach;
 	stats_shmem->stats.numdetach += numdetach;
@@ -159,6 +161,8 @@ pgstat_report_inj_fixed(uint32 numattach,
 	stats_shmem->stats.numcached += numcached;
 	stats_shmem->stats.numloaded += numloaded;
 	pgstat_end_changecount_write(&stats_shmem->changecount);
+
+	LWLockRelease(&stats_shmem->lock);
 }
 
 /*