Observe array length in HaveVirtualXIDsDelayingChkpt().
Since commit f21bb9cfb5646e1793dcc9c0ea697bab99afa523, this function ignores the caller-provided length and loops until it finds a terminator, which GetVirtualXIDsDelayingChkpt() never adds. Restore the previous loop control logic. In passing, revert the addition of an unused variable by the same commit, presumably a debugging relic.
This commit is contained in:
parent
ff53890f68
commit
fb435f40d5
@ -6984,12 +6984,9 @@ CreateCheckPoint(int flags)
|
|||||||
vxids = GetVirtualXIDsDelayingChkpt(&nvxids);
|
vxids = GetVirtualXIDsDelayingChkpt(&nvxids);
|
||||||
if (nvxids > 0)
|
if (nvxids > 0)
|
||||||
{
|
{
|
||||||
uint32 nwaits = 0;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
pg_usleep(10000L); /* wait for 10 msec */
|
pg_usleep(10000L); /* wait for 10 msec */
|
||||||
nwaits++;
|
|
||||||
} while (HaveVirtualXIDsDelayingChkpt(vxids, nvxids));
|
} while (HaveVirtualXIDsDelayingChkpt(vxids, nvxids));
|
||||||
}
|
}
|
||||||
pfree(vxids);
|
pfree(vxids);
|
||||||
|
@ -1849,32 +1849,30 @@ HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids)
|
|||||||
|
|
||||||
LWLockAcquire(ProcArrayLock, LW_SHARED);
|
LWLockAcquire(ProcArrayLock, LW_SHARED);
|
||||||
|
|
||||||
while (VirtualTransactionIdIsValid(*vxids))
|
for (index = 0; index < arrayP->numProcs; index++)
|
||||||
{
|
{
|
||||||
for (index = 0; index < arrayP->numProcs; index++)
|
int pgprocno = arrayP->pgprocnos[index];
|
||||||
{
|
volatile PGPROC *proc = &allProcs[pgprocno];
|
||||||
int pgprocno = arrayP->pgprocnos[index];
|
volatile PGXACT *pgxact = &allPgXact[pgprocno];
|
||||||
volatile PGPROC *proc = &allProcs[pgprocno];
|
VirtualTransactionId vxid;
|
||||||
volatile PGXACT *pgxact = &allPgXact[pgprocno];
|
|
||||||
VirtualTransactionId vxid;
|
|
||||||
|
|
||||||
GET_VXID_FROM_PGPROC(vxid, *proc);
|
GET_VXID_FROM_PGPROC(vxid, *proc);
|
||||||
if (VirtualTransactionIdIsValid(vxid))
|
|
||||||
|
if (pgxact->delayChkpt && VirtualTransactionIdIsValid(vxid))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < nvxids; i++)
|
||||||
{
|
{
|
||||||
if (VirtualTransactionIdEquals(vxid, *vxids) &&
|
if (VirtualTransactionIdEquals(vxid, vxids[i]))
|
||||||
pgxact->delayChkpt)
|
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* The virtual transaction is gone now, wait for the next one */
|
|
||||||
vxids++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LWLockRelease(ProcArrayLock);
|
LWLockRelease(ProcArrayLock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user