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

Method UpdateTabletNode

src/master/tabletnode_manager.cc:371–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371void TabletNodeManager::UpdateTabletNode(const std::string& addr, const TabletNode& state) {
372 MutexLock lock(&mutex_);
373 TabletNodeList::iterator it = tabletnode_list_.find(addr);
374 if (it == tabletnode_list_.end()) {
375 LOG(ERROR) << "tabletnode [" << addr << "] does not exist";
376 return;
377 }
378 TabletNode* node = it->second.get();
379 MutexLock node_lock(&node->mutex_);
380 node->report_status_ = state.report_status_;
381 node->data_size_ = state.data_size_;
382 node->qps_ = state.qps_;
383 node->info_ = state.info_;
384 node->info_.set_addr(addr);
385 node->load_ = state.load_;
386 node->persistent_cache_size_ = state.persistent_cache_size_;
387 node->update_time_ = state.update_time_;
388 node->table_size_ = state.table_size_;
389 node->table_qps_ = state.table_qps_;
390
391 node->info_.set_status_m(NodeStateToString(node->state_));
392 node->info_.set_tablet_onload(node->onload_count_);
393 node->info_.set_tablet_onsplit(node->onsplit_count_);
394 node->info_.set_tablet_unloading(node->unloading_count_);
395
396 node->average_counter_.read_pending_ =
397 CounterWeightedSum(state.info_.read_pending(), node->average_counter_.read_pending_);
398 node->average_counter_.write_pending_ =
399 CounterWeightedSum(state.info_.write_pending(), node->average_counter_.write_pending_);
400 node->average_counter_.scan_pending_ =
401 CounterWeightedSum(state.info_.scan_pending(), node->average_counter_.scan_pending_);
402 node->average_counter_.row_read_delay_ =
403 CounterWeightedSum(state.info_.extra_info_size() > 1 ? state.info_.extra_info(1).value() : 0,
404 node->average_counter_.row_read_delay_);
405 VLOG(15) << "update tabletnode : " << addr;
406}
407
408void TabletNodeManager::GetAllTabletNodeAddr(std::vector<std::string>* addr_array) {
409 MutexLock lock(&mutex_);

Callers 3

AddTabletNodeMethod · 0.80

Calls 4

NodeStateToStringFunction · 0.85
CounterWeightedSumFunction · 0.85
getMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected