MCPcopy Create free account
hub / github.com/Tencent/phxsql / SetMasterInfo

Method SetMasterInfo

phxbinlogsvr/core/handler/master_manager.cpp:59–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59int 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
80int MasterManager::GenMasterInfoByLocal(const string &master_ip, MasterInfo *info) {
81 int ret = GetMasterInfo(info);

Callers 1

SMExecuteMethod · 0.80

Calls 4

LogVerboseFunction · 0.85
ResetMasterMethod · 0.80
CheckMasterBySvrIDMethod · 0.45
SetMasterMethod · 0.45

Tested by

no test coverage detected