File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
src/backend/access/transam Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1025,6 +1025,10 @@ EndPrepare(GlobalTransaction gxact)
1025
1025
xl_xact_origin xl_origin ;
1026
1026
xl_xact_xinfo xl_xinfo ;
1027
1027
uint8 info = XLOG_XACT_PREPARE ;
1028
+ bool replorigin ;
1029
+
1030
+ replorigin = (replorigin_session_origin != InvalidRepOriginId &&
1031
+ replorigin_session_origin != DoNotReplicateId );
1028
1032
1029
1033
/* Add the end sentinel to the list of 2PC records */
1030
1034
RegisterTwoPhaseRecord (TWOPHASE_RM_END_ID , 0 ,
@@ -1089,6 +1093,12 @@ EndPrepare(GlobalTransaction gxact)
1089
1093
XLogIncludeOrigin ();
1090
1094
1091
1095
gxact -> prepare_end_lsn = XLogInsert (RM_XACT_ID , info );
1096
+
1097
+ if (replorigin )
1098
+ /* Move LSNs forward for this replication origin */
1099
+ replorigin_session_advance (replorigin_session_origin_lsn ,
1100
+ XactLastRecEnd );
1101
+
1092
1102
XLogFlush (gxact -> prepare_end_lsn );
1093
1103
1094
1104
/* If we crash now, we have prepared: WAL replay will fix things */
Original file line number Diff line number Diff line change @@ -5657,9 +5657,20 @@ xact_redo(XLogReaderState *record)
5657
5657
}
5658
5658
else if (info == XLOG_XACT_PREPARE )
5659
5659
{
5660
+ xl_xact_parsed_prepare parsed ;
5661
+
5662
+ ParsePrepareRecord (XLogRecGetXid (record ), XLogRecGetData (record ), & parsed );
5663
+
5660
5664
/* the record contents are exactly the 2PC file */
5661
5665
RecreateTwoPhaseFile (XLogRecGetXid (record ),
5662
5666
XLogRecGetData (record ), XLogRecGetDataLen (record ));
5667
+
5668
+ if (parsed .xinfo & XACT_XINFO_HAS_ORIGIN )
5669
+ {
5670
+ /* recover apply progress */
5671
+ replorigin_advance (XLogRecGetOrigin (record ), parsed .origin_lsn ,
5672
+ record -> EndRecPtr , false /* backward */ , false /* WAL */ );
5673
+ }
5663
5674
}
5664
5675
else if (info == XLOG_XACT_ASSIGNMENT )
5665
5676
{
You can’t perform that action at this time.
0 commit comments