Skip to content

Commit a6417d0

Browse files
knizhnikkelvich
authored andcommitted
Exclude node from cluster on non-recoverable error
1 parent bfd72af commit a6417d0

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

multimaster.c

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

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

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy