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

Method UpdateMembership

phxsqlproxy/group_status_cache.cpp:124–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124int GroupStatusCache::UpdateMembership() {
125 std::shared_ptr<PhxBinlogClient> client = PhxBinlogClientPlatformInfo::GetDefault()->GetClientFactory()
126 ->CreateClient();
127 std::vector<std::string> membership;
128 uint32_t port = 0;
129 int ret = client->GetMemberList(&membership, &port);
130
131 if (ret == 0 && membership.size() == 0) {
132 LogError("%s:%d ret 0 but no member inside", __func__, __LINE__);
133 ret = -__LINE__;
134 }
135
136 if (ret == 0) {
137 LogVerbose("%s:%d get membership ret size %zu", __func__, __LINE__, membership_.size());
138 if (membership != membership_) {
139 RWLockManager lock(&membership_mutex_, RWLockManager::WRITE);
140 membership_ = std::move(membership);
141 }
142 }
143
144 return ret;
145}
146
147bool GroupStatusCache::IsMasterValid(const std::string & master_ip, uint32_t expired_time) {
148 if (master_ip == "") {

Callers

nothing calls this directly

Calls 5

LogErrorFunction · 0.85
LogVerboseFunction · 0.85
CreateClientMethod · 0.80
GetClientFactoryMethod · 0.80
GetMemberListMethod · 0.45

Tested by

no test coverage detected