[master] fix logic error in TableInfo::UpdateMetrics()
TabletInfo::tablet_map_ is keyed by tablet partition start key,
not tablet UUID.
This is a follow-up to 06a62ec681009b146de3f73808711161c5bed12d.
Change-Id: Ic7d22f4b1fedeb341d261c3ac2e61a29feb3cb2d
Reviewed-on: http://gerrit.cloudera.org:8080/17856
Tested-by: Kudu Jenkins
Reviewed-by: Abhishek Chennaka <achennaka@cloudera.com>
Reviewed-by: Yifan Zhang <chinazhangyifan@163.com>
Reviewed-by: Bankim Bhavsar <bankim@cloudera.com>
diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 6497246..a170151 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -6485,8 +6485,9 @@
void TableInfo::UpdateMetrics(const string& tablet_id,
const tablet::ReportedTabletStatsPB& old_stats,
const tablet::ReportedTabletStatsPB& new_stats) {
- if (!metrics_) return;
-
+ if (!metrics_) {
+ return;
+ }
if (PREDICT_TRUE(!metrics_->on_disk_size->IsInvisible())) {
metrics_->on_disk_size->IncrementBy(
static_cast<int64_t>(new_stats.on_disk_size()) -
@@ -6505,7 +6506,7 @@
{
std::lock_guard<rw_spinlock> l(lock_);
for (const auto& e : tablet_map_) {
- if (e.first != tablet_id) {
+ if (e.second->id() != tablet_id) {
on_disk_size += e.second->GetStats().on_disk_size();
}
}
@@ -6539,7 +6540,7 @@
{
std::lock_guard<rw_spinlock> l(lock_);
for (const auto& e : tablet_map_) {
- if (e.first != tablet_id) {
+ if (e.second->id() != tablet_id) {
live_row_count += e.second->GetStats().live_row_count();
}
}