提交 d796f5cf 编写于 作者: J Jimmy Yih

Handle distributed commit WAL records for various recovery features

To allow experimentation of various Postgres recovery features, we
must handle distributed commit WAL records similarly to commit and
commit prepared WAL records. This will allow the standby master
segment to utilize the recovery features. The mirror segments already
get handled since they use the regular commit and commit prepared WAL
records.

With this change, the standby master segment will be able to properly
output a value for a pg_last_xact_replay_timestamp() call (while in
hot standby), have delayed WAL replay, and use PITR/archive recovery
settings such as recovery_target_time and recovery_target_xid.
上级 023c68a2
......@@ -5637,7 +5637,8 @@ getRecordTimestamp(XLogReaderState *record, TimestampTz *recordXtime)
return true;
}
if (rmid == RM_XACT_ID && (xact_info == XLOG_XACT_COMMIT ||
xact_info == XLOG_XACT_COMMIT_PREPARED))
xact_info == XLOG_XACT_COMMIT_PREPARED ||
xact_info == XLOG_XACT_DISTRIBUTED_COMMIT))
{
*recordXtime = ((xl_xact_commit *) XLogRecGetData(record))->xact_time;
return true;
......@@ -5705,7 +5706,8 @@ recoveryStopsBefore(XLogReaderState *record)
xact_info = XLogRecGetInfo(record) & XLOG_XACT_OPMASK;
if (xact_info == XLOG_XACT_COMMIT)
if (xact_info == XLOG_XACT_COMMIT ||
xact_info == XLOG_XACT_DISTRIBUTED_COMMIT)
{
isCommit = true;
recordXid = XLogRecGetXid(record);
......@@ -5864,7 +5866,8 @@ recoveryStopsAfter(XLogReaderState *record)
if (xact_info == XLOG_XACT_COMMIT ||
xact_info == XLOG_XACT_COMMIT_PREPARED ||
xact_info == XLOG_XACT_ABORT ||
xact_info == XLOG_XACT_ABORT_PREPARED)
xact_info == XLOG_XACT_ABORT_PREPARED ||
xact_info == XLOG_XACT_DISTRIBUTED_COMMIT)
{
TransactionId recordXid;
......@@ -5915,7 +5918,8 @@ recoveryStopsAfter(XLogReaderState *record)
recoveryStopName[0] = '\0';
if (xact_info == XLOG_XACT_COMMIT ||
xact_info == XLOG_XACT_COMMIT_PREPARED)
xact_info == XLOG_XACT_COMMIT_PREPARED ||
xact_info == XLOG_XACT_DISTRIBUTED_COMMIT)
{
ereport(LOG,
(errmsg("recovery stopping after commit of transaction %u, time %s",
......@@ -6039,7 +6043,8 @@ recoveryApplyDelay(XLogReaderState *record)
xact_info = XLogRecGetInfo(record) & XLOG_XACT_OPMASK;
if (xact_info != XLOG_XACT_COMMIT &&
xact_info != XLOG_XACT_COMMIT_PREPARED)
xact_info != XLOG_XACT_COMMIT_PREPARED &&
xact_info != XLOG_XACT_DISTRIBUTED_COMMIT)
return false;
if (!getRecordTimestamp(record, &xtime))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册