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

Method IsForceMaster

phxqueue/scheduler/schedulermgr.cpp:893–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

891}
892
893void SchedulerMgr::IsForceMaster(bool &force, bool &master) {
894 force = false;
895
896 comm::RetCode ret;
897
898 shared_ptr<const config::TopicConfig> topic_config;
899 if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->
900 GetTopicConfigByTopicID(impl_->scheduler->GetTopicID(), topic_config))) {
901 QLErr("GetTopicConfigByTopicID ret %d", as_integer(ret));
902
903 return;
904 }
905
906 QLInfo("local %s:%d force master %s:%d",
907 impl_->scheduler->GetSchedulerOption()->ip.c_str(),
908 impl_->scheduler->GetSchedulerOption()->port,
909 topic_config->GetProto().topic().scheduler_master_ip().c_str(),
910 topic_config->GetProto().topic().scheduler_master_port());
911 if (0 != topic_config->GetProto().topic().scheduler_master_port() &&
912 !topic_config->GetProto().topic().scheduler_master_ip().empty() &&
913 "0.0.0.0" != topic_config->GetProto().topic().scheduler_master_ip()) {
914 force = true;
915 if (impl_->scheduler->GetSchedulerOption()->ip ==
916 topic_config->GetProto().topic().scheduler_master_ip() &&
917 impl_->scheduler->GetSchedulerOption()->port ==
918 topic_config->GetProto().topic().scheduler_master_port()) {
919 master = true;
920
921 return;
922 }
923 master = false;
924
925 return;
926 }
927
928 return;
929}
930
931void SchedulerMgr::TraceMap(const int topic_id, const TopicData &topic_data) {
932 string s;

Callers

nothing calls this directly

Calls 4

as_integerFunction · 0.85
GetSchedulerOptionMethod · 0.80
GetTopicIDMethod · 0.45

Tested by

no test coverage detected