Skip to content

Commit 2a21215

Browse files
committed
Handle critical errors (not completed)
1 parent b15877e commit 2a21215

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

contrib/mmts/multimaster.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,23 @@ void MtmAbortTransaction(MtmTransState* ts)
10151015
* -------------------------------------------
10161016
*/
10171017

1018+
void MtmHandleApplyError(void)
1019+
{
1020+
ErrorData *edata = CopyErrorData();
1021+
switch (edata->sqlerrcode) {
1022+
case ERRCODE_DISK_FULL:
1023+
case ERRCODE_INSUFFICIENT_RESOURCES:
1024+
case ERRCODE_IO_ERROR:
1025+
case ERRCODE_DATA_CORRUPTED:
1026+
case ERRCODE_INDEX_CORRUPTED:
1027+
case ERRCODE_SYSTEM_ERROR:
1028+
case ERRCODE_INTERNAL_ERROR:
1029+
case ERRCODE_OUT_OF_MEMORY:
1030+
break;
1031+
}
1032+
}
1033+
1034+
10181035
void MtmRecoveryCompleted(void)
10191036
{
10201037
MTM_LOG1("Recovery of node %d is completed", MtmNodeId);

contrib/mmts/multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,6 @@ extern void MtmCheckQuorum(void);
238238
extern bool MtmRecoveryCaughtUp(int nodeId, XLogRecPtr slotLSN);
239239
extern void MtmRecoveryCompleted(void);
240240
extern void MtmMakeTableLocal(char* schema, char* name);
241+
extern void MtmHandleApplyError(void);
241242

242243
#endif

contrib/mmts/pglogical_apply.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ void MtmExecutor(int id, void* work, size_t size)
951951
}
952952
PG_CATCH();
953953
{
954+
MtmHandleApplyError();
954955
EmitErrorReport();
955956
FlushErrorState();
956957
MTM_LOG2("%d: REMOTE begin abort transaction %d", MyProcPid, MtmGetCurrentTransactionId());

0 commit comments

Comments
 (0)