mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Add many new Asserts in code and fix simple bug that slipped through
without them, related to previous commit. Report by Bruce Momjian.
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.69 2010/05/13 11:15:38 sriggs Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.70 2010/05/14 07:11:49 sriggs Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -470,11 +470,13 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
|
||||
int i;
|
||||
|
||||
Assert(standbyState >= STANDBY_INITIALIZED);
|
||||
Assert(TransactionIdIsValid(running->nextXid));
|
||||
Assert(TransactionIdIsValid(running->oldestRunningXid));
|
||||
Assert(TransactionIdIsNormal(running->latestCompletedXid));
|
||||
|
||||
/*
|
||||
* Remove stale transactions, if any.
|
||||
*/
|
||||
Assert(TransactionIdIsValid(running->oldestRunningXid));
|
||||
ExpireOldKnownAssignedTransactionIds(running->oldestRunningXid);
|
||||
StandbyReleaseOldLocks(running->oldestRunningXid);
|
||||
|
||||
@@ -679,6 +681,9 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
|
||||
if (TransactionIdFollows(nextXid, ShmemVariableCache->nextXid))
|
||||
ShmemVariableCache->nextXid = nextXid;
|
||||
|
||||
Assert(TransactionIdIsNormal(ShmemVariableCache->latestCompletedXid));
|
||||
Assert(TransactionIdIsValid(ShmemVariableCache->nextXid));
|
||||
|
||||
LWLockRelease(ProcArrayLock);
|
||||
|
||||
elog(trace_recovery(DEBUG2), "running transaction data initialized");
|
||||
@@ -1502,6 +1507,10 @@ GetRunningTransactionData(void)
|
||||
LWLockRelease(XidGenLock);
|
||||
LWLockRelease(ProcArrayLock);
|
||||
|
||||
Assert(TransactionIdIsValid(CurrentRunningXacts->nextXid));
|
||||
Assert(TransactionIdIsValid(CurrentRunningXacts->oldestRunningXid));
|
||||
Assert(TransactionIdIsNormal(CurrentRunningXacts->latestCompletedXid));
|
||||
|
||||
return CurrentRunningXacts;
|
||||
}
|
||||
|
||||
@@ -2317,6 +2326,8 @@ void
|
||||
RecordKnownAssignedTransactionIds(TransactionId xid)
|
||||
{
|
||||
Assert(standbyState >= STANDBY_INITIALIZED);
|
||||
Assert(TransactionIdIsValid(latestObservedXid));
|
||||
Assert(TransactionIdIsValid(xid));
|
||||
|
||||
elog(trace_recovery(DEBUG4), "record known xact %u latestObservedXid %u",
|
||||
xid, latestObservedXid);
|
||||
|
Reference in New Issue
Block a user