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