| 57 | } |
| 58 | |
| 59 | int MasterManager::SetMasterInfo(const MasterInfo &master_info) { |
| 60 | bool old_master = false; |
| 61 | if (storage_->CheckMasterBySvrID(master_info.svr_id())) { |
| 62 | old_master = true; |
| 63 | } |
| 64 | int ret = storage_->SetMaster(master_info); |
| 65 | if (ret == OK) { |
| 66 | if (old_master) { |
| 67 | LogVerbose("%s master heart beat", __func__); |
| 68 | //from master to make heartbeat |
| 69 | STATISTICS(MasterHeartBeat()); |
| 70 | } else { |
| 71 | LogVerbose("%s master upate", __func__); |
| 72 | //notify monitor to check agent status |
| 73 | agent_monitor_comm_->ResetMaster(); |
| 74 | STATISTICS(MasterChange()); |
| 75 | } |
| 76 | } |
| 77 | return ret; |
| 78 | } |
| 79 | |
| 80 | int MasterManager::GenMasterInfoByLocal(const string &master_ip, MasterInfo *info) { |
| 81 | int ret = GetMasterInfo(info); |
no test coverage detected