You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by aw...@apache.org on 2020/08/14 21:19:25 UTC

[kudu] 03/03: KUDU-2373: Registered a flag validator

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

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

commit b1f2b79b1fc56e6d50b0a770ce09ec5fa96ad05e
Author: Mahesh Reddy <mr...@cloudera.com>
AuthorDate: Wed Aug 12 16:09:04 2020 -0700

    KUDU-2373: Registered a flag validator
    
    Validates gflag maintenance_manager_num_threads by ensuring
    value cannot be set to 0 as this causes a failure during
    server setup
    
    Change-Id: I705c3ebdcd1e961e6723f044e8abda8d9004089d
    Reviewed-on: http://gerrit.cloudera.org:8080/16337
    Tested-by: Bankim Bhavsar <ba...@cloudera.com>
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
---
 src/kudu/util/maintenance_manager.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/kudu/util/maintenance_manager.cc b/src/kudu/util/maintenance_manager.cc
index 033045f..b79d49e 100644
--- a/src/kudu/util/maintenance_manager.cc
+++ b/src/kudu/util/maintenance_manager.cc
@@ -32,6 +32,7 @@
 #include <gflags/gflags.h>
 
 #include "kudu/gutil/dynamic_annotations.h"
+#include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/port.h"
 #include "kudu/gutil/stringprintf.h"
@@ -62,6 +63,8 @@ DEFINE_int32(maintenance_manager_num_threads, 1,
              "For spinning disks, the number of threads should "
              "not be above the number of devices.");
 TAG_FLAG(maintenance_manager_num_threads, stable);
+DEFINE_validator(maintenance_manager_num_threads,
+                 [](const char* /*n*/, int32 v) { return v > 0; });
 
 DEFINE_int32(maintenance_manager_polling_interval_ms, 250,
              "Polling interval for the maintenance manager scheduler, "