Skip to content

Commit 08994d4

Browse files
committed
Exclude node from cluster on non-recoverable error
1 parent 2a21215 commit 08994d4

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PostgreSQL Database Management System
1+
pPostgreSQL Database Management System
22
=====================================
33

44
This directory contains the source code distribution of the PostgreSQL

contrib/mmts/multimaster.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ char const* const MtmNodeStatusMnem[] =
167167
"Connected",
168168
"Online",
169169
"Recovery",
170-
"InMinor"
170+
"InMinor",
171+
"OutOfService"
171172
};
172173

173174
bool MtmDoReplication;
@@ -1026,8 +1027,11 @@ void MtmHandleApplyError(void)
10261027
case ERRCODE_INDEX_CORRUPTED:
10271028
case ERRCODE_SYSTEM_ERROR:
10281029
case ERRCODE_INTERNAL_ERROR:
1029-
case ERRCODE_OUT_OF_MEMORY:
1030-
break;
1030+
case ERRCODE_OUT_OF_MEMORY:
1031+
elog(WARNING, "Node is excluded from cluster because of non-recoverable error %d", edata->sqlerrcode);
1032+
MtmSwitchClusterMode(MTM_OUT_OF_SERVICE);
1033+
kill(PostmasterPid, SIGQUIT);
1034+
break;
10311035
}
10321036
}
10331037

contrib/mmts/multimaster.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ typedef enum
9797
typedef enum
9898
{
9999
MTM_INITIALIZATION, /* Initial status */
100-
MTM_OFFLINE, /* Node is out of quorum */
100+
MTM_OFFLINE, /* Node is excluded from cluster */
101101
MTM_CONNECTED, /* Arbiter is established connections with other nodes */
102102
MTM_ONLINE, /* Ready to receive client's queries */
103103
MTM_RECOVERY, /* Node is in recovery process */
104-
MTM_IN_MINORITY /* Node is out of quorum */
104+
MTM_IN_MINORITY, /* Node is out of quorum */
105+
MTM_OUT_OF_SERVICE /* Node is not avaiable to to critical, non-recoverable error */
105106
} MtmNodeStatus;
106107

107108
typedef enum

0 commit comments

Comments
 (0)