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

Method GetGlobalMySQLMaxGTIDList

phxbinlogsvr/core/monitor/base/master_monitor.cpp:67–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67int MasterMonitor::GetGlobalMySQLMaxGTIDList(const Option *option, const vector<string> &iplist,
68 vector<string> *gtid_list) {
69 map<string, vector<size_t> > gtid_res;
70
71 for (auto ip : iplist) {
72 vector < string > tmp_gtid_list;
73 int ret = MonitorComm::GetMySQLMaxGTIDList(option, "gtid_executed", &tmp_gtid_list, ip);
74 if (ret) {
75 ColorLogError("%s get from ip %s fail", __func__, ip.c_str());
76 if (ret == GTID_FAIL && ip == option->GetBinLogSvrConfig()->GetEngineIP()) {
77 STATISTICS(MySqlGTIDBroken());
78 assert(ret == OK);
79 }
80 return ret;
81 }
82 for (auto gtid : tmp_gtid_list) {
83 pair < string, size_t > parse_list = GtidHandler::ParseGTID(gtid);
84 gtid_res[parse_list.first].push_back(parse_list.second);
85 LogVerbose("%s get gtid %s-%u from ip %s", __func__, parse_list.first.c_str(), parse_list.second,
86 ip.c_str());
87 }
88 }
89
90 for (auto &gtid_check : gtid_res) {
91 const vector<size_t> &list = gtid_check.second;
92 if (list.size() != iplist.size()) {
93 continue;
94 }
95
96 size_t max_gtid = (size_t) - 1;
97 for (auto gtid : list) {
98 max_gtid = std::min(max_gtid, gtid);
99 }
100 gtid_list->push_back(GtidHandler::GenGTID(gtid_check.first, max_gtid));
101 }
102
103 return OK;
104}
105
106bool MasterMonitor::IsGTIDCompleted(const vector<string> &excute_gtid_list, const string &max_gtid) {
107 pair < string, size_t > max_gtid_pair = GtidHandler::ParseGTID(max_gtid);

Callers

nothing calls this directly

Calls 4

ColorLogErrorFunction · 0.85
LogVerboseFunction · 0.85
GetEngineIPMethod · 0.80
GetBinLogSvrConfigMethod · 0.80

Tested by

no test coverage detected