Commit 978b2f65 authored by Simon Riggs's avatar Simon Riggs

Speedup 2PC by skipping two phase state files in normal path

2PC state info is written only to WAL at PREPARE, then read back from WAL at
COMMIT PREPARED/ABORT PREPARED. Prepared transactions that live past one bufmgr
checkpoint cycle will be written to disk in the same form as previously. Crash
recovery path is not altered. Measured performance gains of 50-100% for short
2PC transactions by completely avoiding writing files and fsyncing. Other
optimizations still available, further patches in related areas expected.

Stas Kelvich and heavily edited by Simon Riggs

Based upon earlier ideas and patches by Michael Paquier and Heikki Linnakangas,
a concrete example of how Postgres-XC has fed back ideas into PostgreSQL.

Reviewed by Michael Paquier, Jeff Janes and Andres Freund
Performance testing by Jesper Pedersen
parent d0f2f53c
This diff is collapsed.
...@@ -321,8 +321,7 @@ static TimeLineID curFileTLI; ...@@ -321,8 +321,7 @@ static TimeLineID curFileTLI;
* stored here. The parallel leader advances its own copy, when necessary, * stored here. The parallel leader advances its own copy, when necessary,
* in WaitForParallelWorkersToFinish. * in WaitForParallelWorkersToFinish.
*/ */
static XLogRecPtr ProcLastRecPtr = InvalidXLogRecPtr; XLogRecPtr ProcLastRecPtr = InvalidXLogRecPtr;
XLogRecPtr XactLastRecEnd = InvalidXLogRecPtr; XLogRecPtr XactLastRecEnd = InvalidXLogRecPtr;
XLogRecPtr XactLastCommitEnd = InvalidXLogRecPtr; XLogRecPtr XactLastCommitEnd = InvalidXLogRecPtr;
......
...@@ -86,6 +86,7 @@ typedef enum ...@@ -86,6 +86,7 @@ typedef enum
RECOVERY_TARGET_IMMEDIATE RECOVERY_TARGET_IMMEDIATE
} RecoveryTargetType; } RecoveryTargetType;
extern XLogRecPtr ProcLastRecPtr;
extern XLogRecPtr XactLastRecEnd; extern XLogRecPtr XactLastRecEnd;
extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd; extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment