bool stopsHere;
uint8 record_info;
TimestampTz recordXtime;
+ TransactionId recordXid;
/* We only consider stopping at COMMIT or ABORT records */
if (record->xl_rmid != RM_XACT_ID)
recordXactCommitData = (xl_xact_commit *) XLogRecGetData(record);
recordXtime = recordXactCommitData->xact_time;
+ recordXid = record->xl_xid;
+ }
+ else if (record->xl_rmid == RM_XACT_ID && record_info == XLOG_XACT_COMMIT_PREPARED)
+ {
+ xl_xact_commit_prepared *recordXactCommitData;
+
+ recordXactCommitData = (xl_xact_commit_prepared *) XLogRecGetData(record);
+ recordXtime = recordXactCommitData->crec.xact_time;
+ recordXid = recordXactCommitData->xid;
}
else if (record_info == XLOG_XACT_ABORT)
{
recordXactAbortData = (xl_xact_abort *) XLogRecGetData(record);
recordXtime = recordXactAbortData->xact_time;
+ recordXid = record->xl_xid;
+ }
+ else if (record->xl_rmid == RM_XACT_ID && record_info == XLOG_XACT_ABORT_PREPARED)
+ {
+ xl_xact_abort_prepared *recordXactAbortData;
+
+ recordXactAbortData = (xl_xact_abort_prepared *) XLogRecGetData(record);
+ recordXtime = recordXactAbortData->arec.xact_time;
+ recordXid = recordXactAbortData->xid;
}
else
return false;
* they complete. A higher numbered xid will complete before you about
* 50% of the time...
*/
- stopsHere = (record->xl_xid == recoveryTargetXid);
+ stopsHere = (recordXid == recoveryTargetXid);
if (stopsHere)
*includeThis = recoveryTargetInclusive;
}
if (stopsHere)
{
- recoveryStopXid = record->xl_xid;
+ recoveryStopXid = recordXid;
recoveryStopTime = recordXtime;
recoveryStopAfter = *includeThis;
- if (record_info == XLOG_XACT_COMMIT)
+ if (record_info == XLOG_XACT_COMMIT ||
+ record_info == XLOG_XACT_COMMIT_PREPARED)
{
if (recoveryStopAfter)
ereport(LOG,
/*
* COMMIT_PREPARED and ABORT_PREPARED are identical to COMMIT/ABORT records
* except that we have to store the XID of the prepared transaction explicitly
- * --- the XID in the record header will be for the transaction doing the
- * COMMIT PREPARED or ABORT PREPARED command.
+ * --- the XID in the record header will be invalid.
*/
typedef struct xl_xact_commit_prepared