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

Method AddNotReadyTablet

src/master/availability.cc:48–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void TabletAvailability::AddNotReadyTablet(const std::string& path,
49 const TabletMeta::TabletStatus& tablet_status) {
50 if (tablet_status == TabletMeta::kTabletReady || tablet_status == TabletMeta::kTabletDisable) {
51 return;
52 }
53
54 MutexLock lock(&mutex_);
55 int64_t ts = get_micros();
56 tablets_.insert(std::pair<std::string, int64_t>(path, ts));
57 auto iter = not_ready_tablet_metrics_.emplace(
58 path, MetricCounter{metric_name_,
59 "table:" + GetNameFromPath(path) + ",tablet:" + path,
60 {SubscriberType::LATEST},
61 false});
62
63 if (iter.second) {
64 VLOG(12) << "[Add NotReady To Metric]: " << static_cast<int64_t>(TabletErrorStatus::kNotReady);
65 iter.first->second.Set(static_cast<int64_t>(TabletErrorStatus::kNotReady));
66 } else {
67 VLOG(12) << "[Add NotReady To Metric Failed]: "
68 << static_cast<int64_t>(TabletErrorStatus::kNotReady);
69 }
70
71 if (tablets_hist_cost_[path].start_ts > 0) {
72 VLOG(10) << "notready again " << path;
73 return;
74 }
75
76 tablets_hist_cost_[path].start_ts = ts;
77 tablets_hist_cost_[path].notready_num++;
78 VLOG(10) << "addnotready " << path << ", total_cost " << tablets_hist_cost_[path].total
79 << ", start_ts " << tablets_hist_cost_[path].start_ts << ", notready "
80 << tablets_hist_cost_[path].notready_num << ", reready "
81 << tablets_hist_cost_[path].reready_num;
82}
83
84void TabletAvailability::EraseNotReadyTablet(const std::string& path) {
85 MutexLock lock(&mutex_);

Callers 3

SetStatusMethod · 0.80
AddTabletMethod · 0.80

Calls 4

GetNameFromPathFunction · 0.85
insertMethod · 0.80
get_microsFunction · 0.50
SetMethod · 0.45

Tested by

no test coverage detected