1
0
mirror of https://github.com/postgres/postgres.git synced 2026-01-26 09:41:40 +03:00

Fix variable usage in wakeupWaiters()

Mistakenly, `i` was used both as an integer representation of lsnType and
an index in wakeUpProcs array.

Discussion: https://postgr.es/m/CA%2BhUKG%2BL0OQR8dQtsNBSaA3FNNyQeFabdeRVzurm0b7Xtp592g%40mail.gmail.com
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Ruikai Peng <ruikai@pwno.io>
This commit is contained in:
Alexander Korotkov
2026-01-06 10:03:26 +02:00
parent 8b9b93e39b
commit bf308639bf

View File

@@ -264,6 +264,8 @@ wakeupWaiters(WaitLSNType lsnType, XLogRecPtr currentLSN)
do
{
int j;
numWakeUpProcs = 0;
LWLockAcquire(WaitLSNLock, LW_EXCLUSIVE);
@@ -303,8 +305,8 @@ wakeupWaiters(WaitLSNType lsnType, XLogRecPtr currentLSN)
* at worst we may set a latch for the wrong process or for no process
* at all, which is harmless.
*/
for (i = 0; i < numWakeUpProcs; i++)
SetLatch(&GetPGProcByNumber(wakeUpProcs[i])->procLatch);
for (j = 0; j < numWakeUpProcs; j++)
SetLatch(&GetPGProcByNumber(wakeUpProcs[j])->procLatch);
} while (numWakeUpProcs == WAKEUP_PROC_STATIC_ARRAY_SIZE);
}