mirror of
https://github.com/postgres/postgres.git
synced 2025-08-17 01:02:17 +03:00
Rearrange storage of data in xl_running_xacts.
Previously we stored all xids mixed together. Now we store top-level xids first, followed by all subxids. Also skip logging any subxids if the snapshot is suboverflowed, since there are potentially large numbers of them and they are not useful in that case anyway. Has value in the envisaged design for decoding of WAL. No planned effect on Hot Standby. Andres Freund, reviewed by me
This commit is contained in:
@@ -778,6 +778,7 @@ standby_redo(XLogRecPtr lsn, XLogRecord *record)
|
||||
RunningTransactionsData running;
|
||||
|
||||
running.xcnt = xlrec->xcnt;
|
||||
running.subxcnt = xlrec->subxcnt;
|
||||
running.subxid_overflow = xlrec->subxid_overflow;
|
||||
running.nextXid = xlrec->nextXid;
|
||||
running.latestCompletedXid = xlrec->latestCompletedXid;
|
||||
@@ -897,6 +898,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
|
||||
XLogRecPtr recptr;
|
||||
|
||||
xlrec.xcnt = CurrRunningXacts->xcnt;
|
||||
xlrec.subxcnt = CurrRunningXacts->subxcnt;
|
||||
xlrec.subxid_overflow = CurrRunningXacts->subxid_overflow;
|
||||
xlrec.nextXid = CurrRunningXacts->nextXid;
|
||||
xlrec.oldestRunningXid = CurrRunningXacts->oldestRunningXid;
|
||||
@@ -912,7 +914,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
|
||||
{
|
||||
rdata[0].next = &(rdata[1]);
|
||||
rdata[1].data = (char *) CurrRunningXacts->xids;
|
||||
rdata[1].len = xlrec.xcnt * sizeof(TransactionId);
|
||||
rdata[1].len = (xlrec.xcnt + xlrec.subxcnt) * sizeof(TransactionId);
|
||||
rdata[1].buffer = InvalidBuffer;
|
||||
lastrdata = 1;
|
||||
}
|
||||
@@ -931,8 +933,8 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
|
||||
CurrRunningXacts->nextXid);
|
||||
else
|
||||
elog(trace_recovery(DEBUG2),
|
||||
"snapshot of %u running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
|
||||
CurrRunningXacts->xcnt,
|
||||
"snapshot of %u+%u running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
|
||||
CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt,
|
||||
(uint32) (recptr >> 32), (uint32) recptr,
|
||||
CurrRunningXacts->oldestRunningXid,
|
||||
CurrRunningXacts->latestCompletedXid,
|
||||
|
Reference in New Issue
Block a user