| 366 | } |
| 367 | |
| 368 | bool KeepSyncThread::QueueNeedReplay(const consumer::Queue_t &queue, const set<int> &pub_ids, |
| 369 | const vector<unique_ptr<config::proto::ReplayInfo>> &replay_infos, int &replay_infos_idx) { |
| 370 | comm::RetCode ret; |
| 371 | |
| 372 | const int topic_id = impl_->store->GetTopicID(); |
| 373 | shared_ptr<const config::TopicConfig> topic_config; |
| 374 | if (comm::RetCode::RET_OK != |
| 375 | (ret = config::GlobalConfig::GetThreadInstance()-> |
| 376 | GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 377 | QLErr("GetTopicConfigByTopicID ret %d topic_id %d", ret, topic_id); |
| 378 | return false; |
| 379 | } |
| 380 | |
| 381 | replay_infos_idx = -1; |
| 382 | for (int idx{0}; idx < replay_infos.size(); ++idx) { |
| 383 | auto &&replay_info = replay_infos[idx]; |
| 384 | if (!replay_info) continue; |
| 385 | if (replay_info->sub_ids_size()) { |
| 386 | bool found = false; |
| 387 | for (int i{0}; i < replay_info->sub_ids_size(); ++i) { |
| 388 | auto sub_id = replay_info->sub_ids(i); |
| 389 | if (sub_id == queue.sub_id) { |
| 390 | found = true; |
| 391 | break; |
| 392 | } |
| 393 | } |
| 394 | if (!found) continue; |
| 395 | } |
| 396 | if (replay_info->pub_ids_size()) { |
| 397 | bool found = false; |
| 398 | for (int i{0}; i < replay_info->pub_ids_size(); ++i) { |
| 399 | auto pub_id = replay_info->pub_ids(i); |
| 400 | if (pub_ids.end() != pub_ids.find(pub_id) && topic_config->IsValidQueue(queue.queue_id, pub_id)) { |
| 401 | found = true; |
| 402 | break; |
| 403 | } |
| 404 | } |
| 405 | if (!found) continue; |
| 406 | } |
| 407 | replay_infos_idx = idx; |
| 408 | return true; |
| 409 | } |
| 410 | return false; |
| 411 | } |
| 412 | |
| 413 | void KeepSyncThread::Replay() { |
| 414 | comm::RetCode ret; |
nothing calls this directly
no test coverage detected