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

Method UpdatePaxosArgs

phxqueue/lock/keepmasterthread.cpp:435–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435comm::RetCode KeepMasterThread::UpdatePaxosArgs() {
436 const int topic_id{impl_->lock->GetTopicID()};
437
438 shared_ptr<const config::TopicConfig> topic_config;
439 comm::RetCode ret{config::GlobalConfig::GetThreadInstance()->
440 GetTopicConfigByTopicID(topic_id, topic_config)};
441 if (comm::RetCode::RET_OK != ret) {
442 QLErr("GetTopicConfigByTopicID ret %d topic_id %d", ret, topic_id);
443
444 return ret;
445 }
446
447 if (impl_->last_update_paxos_args_time == topic_config->GetLastModTime()) {
448 return comm::RetCode::RET_OK;
449 }
450
451 auto opt(impl_->lock->GetLockOption());
452 auto nr_group(opt->nr_group);
453
454 auto node(impl_->lock->GetNode());
455
456 node->SetTimeoutMs(topic_config->GetProto().topic().lock_paxos_propose_timeout_ms());
457 node->SetHoldPaxosLogCount(topic_config->GetProto().topic().lock_paxos_nr_hold_log());
458 for (int paxos_group_id{0}; paxos_group_id < nr_group; ++paxos_group_id) {
459 node->SetMaxHoldThreads(paxos_group_id, topic_config->GetProto().topic().lock_paxos_max_hold_threads());
460 node->SetMasterLease(paxos_group_id, topic_config->GetProto().topic().lock_paxos_master_lease());
461 node->SetProposeWaitTimeThresholdMS(paxos_group_id, topic_config->GetProto().topic().lock_paxos_propose_wait_time_threshold_ms());
462 node->SetLogSync(paxos_group_id, topic_config->GetProto().topic().lock_paxos_log_sync());
463 //node->SetBatchCount(paxos_group_id, topic_config->GetProto().topic().lock_paxos_batch_count());
464 node->SetBatchDelayTimeMs(paxos_group_id, topic_config->GetProto().topic().lock_paxos_batch_delay_time_ms());
465 }
466
467 impl_->last_update_paxos_args_time = topic_config->GetLastModTime();
468
469 QLInfo("paxos args updated");
470
471 return comm::RetCode::RET_OK;
472}
473
474
475} // namespace lock

Callers

nothing calls this directly

Calls 5

GetLockOptionMethod · 0.80
GetTopicIDMethod · 0.45
GetLastModTimeMethod · 0.45
GetNodeMethod · 0.45

Tested by

no test coverage detected