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

zhangyifan 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 f736c6bba [master_log] Correction for the value of `table_rows_limit`
f736c6bba is described below

commit f736c6bbab1ca6290808bbe8fad205958a955bd7
Author: shenxingwuying <shenxingwuy...@gmail.com>
AuthorDate: Wed Apr 20 16:27:25 2022 +0800

    [master_log] Correction for the value of `table_rows_limit`
    
    Fix a variable table_rows_limit, it used by a log in master,
    it maybe not correct before.
    
    The variable table_rows_limit, when table_disk_size_limit and
    table_row_count_limit all setted, and has reached the
    table_disk_size_limit, variable table_rows_limit is -1(default) before.
    
    Change-Id: I79365f2eda90ec49e99565f897c27ca43773fafa
    Reviewed-on: http://gerrit.cloudera.org:8080/18428
    Reviewed-by: Yifan Zhang <chinazhangyi...@163.com>
    Tested-by: Yifan Zhang <chinazhangyi...@163.com>
---
 src/kudu/master/catalog_manager.cc | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/kudu/master/catalog_manager.cc 
b/src/kudu/master/catalog_manager.cc
index 1b7aa22cb..f16ae3d3a 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -3645,31 +3645,27 @@ bool CatalogManager::IsTableWriteDisabled(const 
scoped_refptr<TableInfo>& table,
     // disable write immediately.
     if (pb.has_table_disk_size_limit()) {
       table_disk_size_limit = pb.table_disk_size_limit();
-      if (static_cast<double>(table_disk_size) >=
-           (static_cast<double>(table_disk_size_limit) *
-            FLAGS_table_write_limit_ratio)) {
-        disallow_write = true;
-      }
+      disallow_write = static_cast<double>(table_disk_size) >=
+          (static_cast<double>(table_disk_size_limit) * 
FLAGS_table_write_limit_ratio);
     }
-    if (!disallow_write && pb.has_table_row_count_limit()) {
+    if (pb.has_table_row_count_limit()) {
       table_rows_limit = pb.table_row_count_limit();
-      if (static_cast<double>(table_rows) >=
-              (static_cast<double>(table_rows_limit) *
-               FLAGS_table_write_limit_ratio)) {
-        disallow_write = true;
-      }
+      disallow_write |= static_cast<double>(table_rows) >=
+          (static_cast<double>(table_rows_limit) * 
FLAGS_table_write_limit_ratio);
     }
   }
 
   if (disallow_write) {
     // The writing into the table is disallowed.
     LOG(INFO) << Substitute("table $0 row count is $1, on disk size is $2, "
-                            "row count limit is $3, size limit is $4, writing 
is forbidden",
+                            "row count limit is $3, size limit is $4, "
+                            "table_write_limit_ratio is $5, writing is 
forbidden",
                             table_name,
                             table_rows,
                             table_disk_size,
                             table_rows_limit,
-                            table_disk_size_limit);
+                            table_disk_size_limit,
+                            FLAGS_table_write_limit_ratio);
   }
   return disallow_write;
 }

Reply via email to