MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Replay

Method Replay

phxqueue/store/keepsyncthread.cpp:413–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413void KeepSyncThread::Replay() {
414 comm::RetCode ret;
415 const int topic_id{impl_->store->GetTopicID()};
416 auto opt(impl_->store->GetStoreOption());
417
418 shared_ptr<const config::TopicConfig> topic_config;
419 if (comm::RetCode::RET_OK !=
420 (ret = config::GlobalConfig::GetThreadInstance()->
421 GetTopicConfigByTopicID(topic_id, topic_config))) {
422 QLErr("GetTopicConfigByTopicID ret %d topic_id %d", ret, topic_id);
423 return;
424 }
425
426 comm::proto::Addr addr;
427 addr.set_ip(opt->ip);
428 addr.set_port(opt->port);
429 addr.set_paxos_port(opt->paxos_port);
430
431 shared_ptr<const config::StoreConfig> store_config;
432 if (comm::RetCode::RET_OK !=
433 (ret = config::GlobalConfig::GetThreadInstance()->
434 GetStoreConfig(topic_id, store_config))) {
435 QLErr("GetStoreConfig ret %d topic_id %d", as_integer(ret), topic_id);
436 return;
437 }
438
439 int store_id;
440 if (comm::RetCode::RET_OK != (ret = store_config->GetStoreIDByAddr(addr, store_id))) {
441 QLErr("GetStoreIDByAddr ret %d", as_integer(ret));
442 return;
443 }
444
445 set<int> pub_ids;
446 if (comm::RetCode::RET_OK !=
447 (ret = config::utils::GetPubIDsByStoreID(topic_id, store_id, pub_ids))) {
448 QLErr("GetPubIDsByStoreID ret %d topic_id %d store_id %d",
449 as_integer(ret), topic_id, store_id);
450 return;
451 }
452
453 vector<unique_ptr<config::proto::ReplayInfo>> replay_infos;
454 if (comm::RetCode::RET_OK != (ret = topic_config->GetAllReplayInfo(replay_infos))) {
455 QLErr("GetAllReplayInfo ret %d", as_integer(ret));
456 return;
457 }
458
459 if (!replay_infos.size()) return;
460
461 QLInfo("Do Replay!!!");
462
463 vector<consumer::Queue_t> queues;
464 GetAllLocalQueue(queues);
465
466 for (auto &&queue : queues) {
467 int replay_infos_idx{-1};
468 bool replay = QueueNeedReplay(queue, pub_ids, replay_infos, replay_infos_idx);
469
470 if (replay && -1 != replay_infos_idx) { // need replay

Callers

nothing calls this directly

Calls 12

as_integerFunction · 0.85
GetPubIDsByStoreIDFunction · 0.85
GetStoreOptionMethod · 0.80
GetStoreConfigMethod · 0.80
GetStoreIDByAddrMethod · 0.80
GetAllReplayInfoMethod · 0.80
GetSyncCtrlMethod · 0.80
UpdateCursorIDMethod · 0.80
GetTopicIDMethod · 0.45
GetNodeMethod · 0.45
GetCursorIDMethod · 0.45

Tested by

no test coverage detected