Skip to content

Commit 8e4dc94

Browse files
Hamid Akhtarcodeforall
Hamid Akhtar
authored andcommitted
PG-501: Missing Buckets and incorrect calls count.
Ensuring the outer bound for the bucket is an exclusive boundary and it as it belongs to the next bucket. To explain the point further, a set of five second bucket would be: Bucket 1: 00:00:00.00 -> 00:00:04.99... Bucket 2: 00:00:00.05 -> 00:00:09.99... Bucket 3: 00:00:00.10 -> 00:00:14.99... ...
1 parent bb5e6a4 commit 8e4dc94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pg_stat_monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ get_next_wbucket(pgssSharedState *pgss)
21702170
* definitely make the while condition to fail, we can stop the loop as
21712171
* another thread has already updated prev_bucket_sec.
21722172
*/
2173-
while ((tv.tv_sec - (uint)current_bucket_sec) > ((uint)PGSM_BUCKET_TIME))
2173+
while ((tv.tv_sec - (uint)current_bucket_sec) >= ((uint)PGSM_BUCKET_TIME))
21742174
{
21752175
if (pg_atomic_compare_exchange_u64(&pgss->prev_bucket_sec, &current_bucket_sec, (uint64)tv.tv_sec))
21762176
{

0 commit comments

Comments
 (0)