* Helper function for apply_handle_commit and apply_handle_stream_commit. */
| 1147 | * Helper function for apply_handle_commit and apply_handle_stream_commit. |
| 1148 | */ |
| 1149 | static void |
| 1150 | apply_handle_commit_internal(LogicalRepCommitData *commit_data) |
| 1151 | { |
| 1152 | if (IsTransactionState()) |
| 1153 | { |
| 1154 | /* |
| 1155 | * Update origin state so we can restart streaming from correct |
| 1156 | * position in case of crash. |
| 1157 | */ |
| 1158 | replorigin_session_origin_lsn = commit_data->end_lsn; |
| 1159 | replorigin_session_origin_timestamp = commit_data->committime; |
| 1160 | |
| 1161 | CommitTransactionCommand(); |
| 1162 | pgstat_report_stat(false); |
| 1163 | |
| 1164 | store_flush_position(commit_data->end_lsn); |
| 1165 | } |
| 1166 | else |
| 1167 | { |
| 1168 | /* Process any invalidation messages that might have accumulated. */ |
| 1169 | AcceptInvalidationMessages(); |
| 1170 | maybe_reread_subscription(); |
| 1171 | } |
| 1172 | |
| 1173 | in_remote_transaction = false; |
| 1174 | } |
| 1175 | |
| 1176 | /* |
| 1177 | * Handle RELATION message. |
no test coverage detected