int ObUpsLeaseTask::init(common::ObRoleMgr *role_mgr, ObUpsRpcStub * rpc_stub, common::ObServer &root_server, ObUpsLogMgr *log_mgr, const int64_t inner_port, common::ObServer &self_server, const int64_t timeout_us)
{
  int err = OB_SUCCESS;
  self_lease_ = 0;
  if (NULL == role_mgr || NULL == rpc_stub || NULL == log_mgr)
  {
    err = OB_INVALID_ARGUMENT;
    TBSYS_LOG(WARN, "invalid argument. role_mgr=%p", role_mgr);
  }
  else
  {
    role_mgr_ = role_mgr;
    rpc_stub_ = rpc_stub;
    log_mgr_ = log_mgr;
    root_server_.set_ipv4_addr(root_server.get_ipv4(), root_server.get_port());
    inner_port_ = inner_port;
    self_addr_.set_ipv4_addr(self_server.get_ipv4(), self_server.get_port());
    timeout_us_ = timeout_us;
  }
  return err;
}
Exemple #2
0
 void ObUpsBlackList::fail(const int32_t server_index, const common::ObServer & server)
 {
   if ((server_index < server_count_) && (fail_counter_[server_index].server_ == server))
   {
     // no need thread safe
     if (0 == fail_counter_[server_index].fail_count_)
     {
       fail_counter_[server_index].fail_timestamp_ = tbsys::CTimeUtil::getTime();
     }
     ++fail_counter_[server_index].fail_count_;
   }
   else
   {
     TBSYS_LOG(WARN, "check param failed:index[%d], count[%d], server[%u], port[%d]",
         server_index, server_count_, server.get_ipv4(), server.get_port());
   }
 }