|
74 | 74 |
|
75 | 75 |
|
76 | 76 | #include "multimaster.h"
|
| 77 | +#include "state.h" |
77 | 78 |
|
78 | 79 | #define MAX_ROUTES 16
|
79 | 80 | #define INIT_BUFFER_SIZE 1024
|
@@ -314,25 +315,22 @@ static void MtmCheckResponse(MtmArbiterMessage* resp)
|
314 | 315 | } else {
|
315 | 316 | BIT_CLEAR(Mtm->currentLockNodeMask, resp->node-1);
|
316 | 317 | }
|
317 |
| - if ( |
318 |
| - ( BIT_CHECK(resp->disabledNodeMask, MtmNodeId-1) || Mtm->status == MTM_IN_MINORITY ) |
319 |
| - && !BIT_CHECK(Mtm->disabledNodeMask, resp->node-1) |
320 |
| - && Mtm->status != MTM_RECOVERY |
321 |
| - && Mtm->status != MTM_RECOVERED |
322 |
| - && Mtm->nodes[MtmNodeId-1].lastStatusChangeTime + MSEC_TO_USEC(MtmNodeDisableDelay) < MtmGetSystemTime()) |
323 |
| - { |
324 |
| - MTM_ELOG(WARNING, "Node %d thinks that I'm dead, while I'm %s (message %s)", resp->node, MtmNodeStatusMnem[Mtm->status], MtmMessageKindMnem[resp->code]); |
325 |
| - BIT_SET(Mtm->disabledNodeMask, MtmNodeId-1); |
326 |
| - Mtm->nConfigChanges += 1; |
327 |
| - MtmSwitchClusterMode(MTM_RECOVERY); |
328 |
| - } else if (BIT_CHECK(Mtm->disabledNodeMask, resp->node-1) && sockets[resp->node-1] < 0) { |
329 |
| - /* We receive heartbeat from disabled node. |
| 318 | + |
| 319 | + if (BIT_CHECK(resp->disabledNodeMask, MtmNodeId-1)) |
| 320 | + { |
| 321 | + MtmStateProcessEvent(MTM_REMOTE_DISABLE); |
| 322 | + } |
| 323 | + |
| 324 | + if (BIT_CHECK(Mtm->disabledNodeMask, resp->node-1) && |
| 325 | + sockets[resp->node-1] < 0) |
| 326 | + { |
| 327 | + /* We've received heartbeat from disabled node. |
330 | 328 | * Looks like it is restarted.
|
331 | 329 | * Try to reconnect to it.
|
332 | 330 | */
|
333 | 331 | MTM_ELOG(WARNING, "Receive heartbeat from disabled node %d", resp->node);
|
334 | 332 | BIT_SET(Mtm->reconnectMask, resp->node-1);
|
335 |
| - } |
| 333 | + } |
336 | 334 | }
|
337 | 335 |
|
338 | 336 | static void MtmScheduleHeartbeat()
|
@@ -546,12 +544,7 @@ static void MtmOpenConnections()
|
546 | 544 | }
|
547 | 545 | }
|
548 | 546 | }
|
549 |
| - if (Mtm->nLiveNodes < Mtm->nAllNodes/2+1) { /* no quorum */ |
550 |
| - MTM_ELOG(WARNING, "Node is out of quorum: only %d nodes of %d are accessible", Mtm->nLiveNodes, Mtm->nAllNodes); |
551 |
| - MtmSwitchClusterMode(MTM_IN_MINORITY); |
552 |
| - } else if (Mtm->status == MTM_INITIALIZATION) { |
553 |
| - MtmSwitchClusterMode(MTM_CONNECTED); |
554 |
| - } |
| 547 | + MtmStateProcessEvent(MTM_ARBITER_RECEIVER_START); |
555 | 548 | }
|
556 | 549 |
|
557 | 550 |
|
|
0 commit comments