| 198 | } |
| 199 | |
| 200 | void SyncCtrl::ClearSyncCtrl() { |
| 201 | if (!impl_->buf) { |
| 202 | QLErr("impl_->buf null"); |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | const int topic_id{impl_->store->GetTopicID()}; |
| 207 | |
| 208 | comm::RetCode ret; |
| 209 | shared_ptr<const config::TopicConfig> topic_config; |
| 210 | if (comm::RetCode::RET_OK != |
| 211 | (ret = config::GlobalConfig::GetThreadInstance()-> |
| 212 | GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 213 | QLErr("GetTopicConfigByTopicID ret %d", as_integer(ret)); |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | thread_local uint64_t topic_config_last_mod_time{0}; |
| 218 | auto tmp_last_mod_time = topic_config->GetLastModTime(); |
| 219 | if (topic_config_last_mod_time == tmp_last_mod_time) return; |
| 220 | topic_config_last_mod_time = tmp_last_mod_time; |
| 221 | |
| 222 | auto opt(impl_->store->GetStoreOption()); |
| 223 | comm::proto::Addr addr; |
| 224 | addr.set_ip(opt->ip); |
| 225 | addr.set_port(opt->port); |
| 226 | addr.set_paxos_port(opt->paxos_port); |
| 227 | |
| 228 | shared_ptr<const config::StoreConfig> store_config; |
| 229 | if (comm::RetCode::RET_OK != |
| 230 | (ret = config::GlobalConfig::GetThreadInstance()-> |
| 231 | GetStoreConfig(topic_id, store_config))) { |
| 232 | QLErr("GetStoreConfig ret %d topic_id %d", as_integer(ret), topic_id); |
| 233 | return; |
| 234 | } |
| 235 | |
| 236 | int store_id; |
| 237 | if (comm::RetCode::RET_OK != (ret = store_config->GetStoreIDByAddr(addr, store_id))) { |
| 238 | QLErr("GetStoreIDByAddr ret %d", as_integer(ret)); |
| 239 | return; |
| 240 | } |
| 241 | |
| 242 | set<int> pub_ids; |
| 243 | if (comm::RetCode::RET_OK != |
| 244 | (ret = config::utils::GetPubIDsByStoreID(topic_id, store_id, pub_ids))) { |
| 245 | QLErr("GetPubIDsByStoreID ret %d topic_id %d store_id %d", |
| 246 | as_integer(ret), topic_id, store_id); |
| 247 | return; |
| 248 | } |
| 249 | |
| 250 | uint64_t cursor_id; |
| 251 | for (int queue_id{0}; queue_id < opt->nqueue; ++queue_id) { |
| 252 | for (int sub_id{1}; sub_id <= opt->nsub; ++sub_id) { |
| 253 | bool valid = false; |
| 254 | for (auto &&pub_id : pub_ids) { |
| 255 | if (topic_config->IsValidQueue(queue_id, pub_id, sub_id)) { |
| 256 | valid = true; |
| 257 | break; |
nothing calls this directly
no test coverage detected