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>
do
{
+ int j;
+
numWakeUpProcs = 0;
LWLockAcquire(WaitLSNLock, LW_EXCLUSIVE);
* 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);
}