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

Method CheckRunningStatus

phxbinlogsvr/core/handler/event_monitor.cpp:46–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46int EventMonitor::CheckRunningStatus() {
47 int ret = OK;
48 vector < string > gtid_list;
49 if (option_->GetBinLogSvrConfig()->IsForceMakingCheckPoint()) {
50 ret = MasterMonitor::GetMySQLMaxGTIDList(option_, &gtid_list,master_manager_->IsMaster());
51 } else {
52 vector < string > member_iplist;
53 master_manager_->GetMemberIPList(&member_iplist);
54
55 ret = MasterMonitor::GetGlobalMySQLMaxGTIDList(option_, member_iplist, &gtid_list);
56 }
57
58 LogVerbose("%s get gtid list ret %d", __func__, ret);
59 if (ret == OK) {
60 ret = storage_manager_->MakeCheckPoint(gtid_list);
61
62 uint64_t max_instanceid = 0;
63 EventStorage *event_storage = storage_manager_->GetEventStorage();
64 for (const auto &gtid : gtid_list) {
65 EventDataInfo data_info;
66 int ret = event_storage->GetGTIDInfo(gtid, &data_info, true);
67 if (ret) {
68 continue;
69 }
70 max_instanceid = std::max(max_instanceid, (uint64_t) data_info.instance_id());
71 }
72
73 uint64_t storage_instanceid = event_storage->GetLastInstanceID();
74 ColorLogInfo("%s current mysql instanceid %lu, binlog svr instanceid %lu", __func__, max_instanceid,
75 storage_instanceid);
76
77 if (max_instanceid && max_instanceid <= storage_instanceid) {
78 STATISTICS(MySqlGtidNumDiff(storage_instanceid - max_instanceid));
79 }
80 }
81
82 return ret;
83}
84
85int EventMonitor::Process() {
86 while (!stop_) {

Callers

nothing calls this directly

Calls 10

LogVerboseFunction · 0.85
ColorLogInfoFunction · 0.85
GetBinLogSvrConfigMethod · 0.80
IsMasterMethod · 0.80
GetEventStorageMethod · 0.80
GetMemberIPListMethod · 0.45
MakeCheckPointMethod · 0.45
GetGTIDInfoMethod · 0.45
GetLastInstanceIDMethod · 0.45

Tested by

no test coverage detected