CommitTransactionCommand();
pgstat_report_stat(false);
- store_flush_position(prepare_data.end_lsn, XactLastCommitEnd);
+ /*
+ * It is okay not to set the local_end LSN for the prepare because we
+ * always flush the prepare record. So, we can send the acknowledgment of
+ * the remote_end LSN as soon as prepare is finished.
+ *
+ * XXX For the sake of consistency with commit, we could have set it with
+ * the LSN of prepare but as of now we don't track that value similar to
+ * XactLastCommitEnd, and adding it for this purpose doesn't seems worth
+ * it.
+ */
+ store_flush_position(prepare_data.end_lsn, InvalidXLogRecPtr);
in_remote_transaction = false;
pgstat_report_stat(false);
- store_flush_position(rollback_data.rollback_end_lsn, XactLastCommitEnd);
+ /*
+ * It is okay not to set the local_end LSN for the rollback of prepared
+ * transaction because we always flush the WAL record for it. See
+ * apply_handle_prepare.
+ */
+ store_flush_position(rollback_data.rollback_end_lsn, InvalidXLogRecPtr);
in_remote_transaction = false;
/* Process any tables that are being synchronized in parallel. */
CommitTransactionCommand();
- store_flush_position(prepare_data.end_lsn, XactLastCommitEnd);
+ /*
+ * It is okay not to set the local_end LSN for the prepare because
+ * we always flush the prepare record. See apply_handle_prepare.
+ */
+ store_flush_position(prepare_data.end_lsn, InvalidXLogRecPtr);
in_remote_transaction = false;
CommitTransactionCommand();
- MyParallelShared->last_commit_end = XactLastCommitEnd;
+ /*
+ * It is okay not to set the local_end LSN for the prepare because
+ * we always flush the prepare record. See apply_handle_prepare.
+ */
+ MyParallelShared->last_commit_end = InvalidXLogRecPtr;
pa_set_xact_state(MyParallelShared, PARALLEL_TRANS_FINISHED);
pa_unlock_transaction(MyParallelShared->xid, AccessExclusiveLock);