MCPcopy Create free account
hub / github.com/baidu/tera / AddTabletNode

Method AddTabletNode

src/master/tabletnode_manager.cc:328–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326TabletNodeManager::~TabletNodeManager() { MutexLock lock(&mutex_); }
327
328TabletNodePtr TabletNodeManager::AddTabletNode(const std::string& addr, const std::string& uuid) {
329 MutexLock lock(&mutex_);
330 TabletNodePtr null_ptr;
331 std::pair<TabletNodeList::iterator, bool> ret =
332 tabletnode_list_.insert(std::pair<std::string, TabletNodePtr>(addr, null_ptr));
333 TabletNodePtr& state = ret.first->second;
334 // already has one TS at the same IP:PORT addr, return the existing
335 // TabletNodePtr
336 if (!ret.second) {
337 TabletNodePtr existing_node = ret.first->second;
338 LOG(ERROR) << "tabletnode [" << addr << " exist, existing uuid: " << existing_node->uuid_
339 << ", to be added uuid: " << uuid;
340 return existing_node;
341 } else {
342 LOG(INFO) << "add tabletnode : " << addr << ", id : " << uuid;
343 state.reset(new TabletNode(addr, uuid));
344 }
345 // kReady represent heartbeat status
346 // state->SetState(kReady, NULL);
347 state->DoStateTransition(NodeEvent::kZkNodeCreated);
348 tabletnode_added_.Broadcast();
349 return state;
350}
351
352TabletNodePtr TabletNodeManager::DelTabletNode(const std::string& addr) {
353 TabletNodePtr state(nullptr);

Callers

nothing calls this directly

Calls 4

insertMethod · 0.80
BroadcastMethod · 0.80
resetMethod · 0.45
DoStateTransitionMethod · 0.45

Tested by

no test coverage detected