MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / CreateAddReplicaRemoteTask

Method CreateAddReplicaRemoteTask

src/nameserver/name_server_impl.cc:7023–7049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7021}
7022
7023std::shared_ptr<Task> NameServerImpl::CreateAddReplicaRemoteTask(const std::string& endpoint, uint64_t op_index,
7024 ::fedb::api::OPType op_type, uint32_t tid,
7025 uint32_t remote_tid, uint32_t pid,
7026 const std::string& des_endpoint, uint64_t task_id) {
7027 std::shared_ptr<Task> task = std::make_shared<Task>(endpoint, std::make_shared<::fedb::api::TaskInfo>());
7028 auto it = tablets_.find(endpoint);
7029 if (it == tablets_.end()) {
7030 PDLOG(WARNING, "provide endpoint [%s] not found", endpoint.c_str());
7031 return std::shared_ptr<Task>();
7032 }
7033 if (it->second->state_ != ::fedb::api::TabletState::kTabletHealthy) {
7034 PDLOG(WARNING, "provide endpoint [%s] is not healthy", endpoint.c_str());
7035 return std::shared_ptr<Task>();
7036 }
7037 task->task_info_->set_op_id(op_index);
7038 task->task_info_->set_op_type(op_type);
7039 task->task_info_->set_task_type(::fedb::api::TaskType::kAddReplica);
7040 task->task_info_->set_status(::fedb::api::TaskStatus::kInited);
7041 task->task_info_->set_endpoint(endpoint);
7042 if (task_id != INVALID_PARENT_ID) {
7043 task->task_info_->set_task_id(task_id);
7044 }
7045 boost::function<bool()> fun = boost::bind(&TabletClient::AddReplica, it->second->client_, tid, pid, des_endpoint,
7046 remote_tid, task->task_info_);
7047 task->fun_ = boost::bind(&NameServerImpl::WrapTaskFun, this, fun, task->task_info_);
7048 return task;
7049}
7050
7051std::shared_ptr<Task> NameServerImpl::CreateAddReplicaNSRemoteTask(const std::string& alias, const std::string& name,
7052 const std::vector<std::string>& endpoint_vec,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected