Skip to content

Commit 89753d8

Browse files
akorotkovAlexander Korotkov
authored andcommitted
Fix broken loop in pg_stat_wait_reset_profile.
1 parent a45f2a6 commit 89753d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

contrib/pg_stat_wait/pg_stat_wait.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,23 +511,23 @@ PG_FUNCTION_INFO_V1(pg_stat_wait_reset_profile);
511511
Datum
512512
pg_stat_wait_reset_profile(PG_FUNCTION_ARGS)
513513
{
514-
int i;
514+
int i, j;
515515
BackendWaitCells *cells = (BackendWaitCells *)((char *)WaitShmem
516516
+ sizeof(int) + /* counter */
517517
+ MAXALIGN(sizeof(slock_t))); /* lock */
518518

519-
for(i=0; i < MaxBackends; i++)
519+
for(i = 0; i < MaxBackends; i++)
520520
{
521521
BackendWaitCells *item = cells + i;
522522
do
523523
{
524524
/* wait until backend is updating this block */
525525
} while (!pg_atomic_test_set_flag(&item->isBusy));
526526

527-
for (i=0; i < WAIT_EVENTS_COUNT; i++)
527+
for (j = 0; j < WAIT_EVENTS_COUNT; j++)
528528
{
529-
item->cells[i].interval = 0;
530-
item->cells[i].count = 0;
529+
item->cells[j].interval = 0;
530+
item->cells[j].count = 0;
531531
}
532532
pg_atomic_clear_flag(&item->isBusy);
533533
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy