private void Handle(ElectionMessage.ElectionsDone message) { if (_master != null && _master.InstanceId == message.Master.InstanceId) { if (_master.InstanceId == _nodeInfo.InstanceId) { _fsm.Handle(new SystemMessage.WriteEpoch()); } return; } _master = VNodeInfoHelper.FromMemberInfo(message.Master); _lastEpochId = message.Master.EpochId; _subscriptionId = Guid.NewGuid(); _stateCorrelationId = Guid.NewGuid(); _outputBus.Publish(message); if (_master.InstanceId == _nodeInfo.InstanceId) { _fsm.Handle(new SystemMessage.BecomePreMaster(_stateCorrelationId)); } else { _fsm.Handle(new SystemMessage.BecomePreReplica(_stateCorrelationId, _master)); } }
private void Handle(ElectionMessage.ElectionsDone message) { if (_master != null && _master.InstanceId == message.Master.InstanceId) { //if the master hasn't changed, we skip state changes through PreMaster or PreReplica if (_master.InstanceId == _nodeInfo.InstanceId && _state == VNodeState.Master) { //transitioning from master to master, we just write a new epoch _fsm.Handle(new SystemMessage.WriteEpoch()); } return; } _master = VNodeInfoHelper.FromMemberInfo(message.Master); _subscriptionId = Guid.NewGuid(); _stateCorrelationId = Guid.NewGuid(); _outputBus.Publish(message); if (_master.InstanceId == _nodeInfo.InstanceId) { _fsm.Handle(new SystemMessage.BecomePreMaster(_stateCorrelationId)); } else { _fsm.Handle(new SystemMessage.BecomePreReplica(_stateCorrelationId, _master)); } }