You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2021/09/23 17:27:04 UTC

[kudu] branch master updated: [master] fix logic error in TableInfo::UpdateMetrics()

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 35c1afb  [master] fix logic error in TableInfo::UpdateMetrics()
35c1afb is described below

commit 35c1afbca639664f72c213f7a631b3d36f128efc
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Sun Sep 19 00:58:38 2021 -0700

    [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 <ac...@cloudera.com>
    Reviewed-by: Yifan Zhang <ch...@163.com>
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
---
 src/kudu/master/catalog_manager.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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::UnregisterMetrics() {
 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 @@ void TableInfo::UpdateMetrics(const string& tablet_id,
         {
           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 @@ void TableInfo::UpdateMetrics(const string& tablet_id,
         {
           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();
             }
           }