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

Method CheckMasterTimeOut

phxbinlogsvr/core/monitor/agent_monitor.cpp:325–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325int AgentMonitor::CheckMasterTimeOut() {
326 bool is_master = master_manager_->CheckMasterBySvrID(option_->GetBinLogSvrConfig()->GetEngineSvrID());
327 int ret = OK;
328 if(!is_master) {
329 ret=IsGTIDCompleted(option_, event_manager_);
330 if (ret < 0) {
331 return ret;
332 }
333 }
334
335 if (!AgentExternalMonitor::IsHealthy()) {
336 ColorLogWarning("%s external monitor not healthy", __func__);
337 return SVR_FAIL;
338 }
339
340 if (ret == OK) {
341 int ret = master_agent_->SetMaster(option_->GetBinLogSvrConfig()->GetEngineIP());
342 if (ret == MASTER_CONFLICT) {
343 LogVerbose("%s master info does not timeout, skip", __func__);
344 } else {
345 LogVerbose("%s set new master info, ret %d", __func__, ret);
346 }
347 return OK;
348 } else {
349 ColorLogInfo("%s master info not complated, skip, just check slave status", __func__);
350 return CheckSlaveRunningStatus();
351 }
352 return ret;
353}
354
355int AgentMonitor::CheckSlaveRunningStatus() {
356 if (IsSlaveReady()) {

Callers

nothing calls this directly

Calls 8

ColorLogWarningFunction · 0.85
LogVerboseFunction · 0.85
ColorLogInfoFunction · 0.85
GetEngineSvrIDMethod · 0.80
GetBinLogSvrConfigMethod · 0.80
GetEngineIPMethod · 0.80
CheckMasterBySvrIDMethod · 0.45
SetMasterMethod · 0.45

Tested by

no test coverage detected