You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/12/29 18:58:45 UTC

[kudu] 04/07: [gflags] use DEFINE_validator() macro

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

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

commit bc4a5aa8065c0fdf6c136396b3ca898847095b55
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Fri Dec 27 21:24:20 2019 -0800

    [gflags] use DEFINE_validator() macro
    
    Updated few places to use the DEFINE_validator() macro, replacing
    ad-hoc calls to RegisterFlagValidator().
    
    This patch doesn't contain any functional modifications.
    
    Change-Id: Ied1ad630838768600c245dd4952506e2fad6ec3f
    Reviewed-on: http://gerrit.cloudera.org:8080/14955
    Tested-by: Kudu Jenkins
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
 src/kudu/consensus/log.cc       | 3 +--
 src/kudu/rpc/transfer.cc        | 3 +--
 src/kudu/tools/color.cc         | 3 +--
 src/kudu/util/process_memory.cc | 9 +++------
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/kudu/consensus/log.cc b/src/kudu/consensus/log.cc
index b2b8000..54400d2 100644
--- a/src/kudu/consensus/log.cc
+++ b/src/kudu/consensus/log.cc
@@ -167,8 +167,7 @@ static bool ValidateLogsToRetain(const char* flagname, int value) {
                                     flagname, value);
   return false;
 }
-static bool dummy = google::RegisterFlagValidator(
-    &FLAGS_log_min_segments_to_retain, &ValidateLogsToRetain);
+DEFINE_validator(log_min_segments_to_retain, &ValidateLogsToRetain);
 
 namespace kudu {
 namespace log {
diff --git a/src/kudu/rpc/transfer.cc b/src/kudu/rpc/transfer.cc
index bdf5191..8f84011 100644
--- a/src/kudu/rpc/transfer.cc
+++ b/src/kudu/rpc/transfer.cc
@@ -54,8 +54,7 @@ static bool ValidateMaxMessageSize(const char* flagname, int64_t value) {
 
   return true;
 }
-static bool dummy = google::RegisterFlagValidator(
-    &FLAGS_rpc_max_message_size, &ValidateMaxMessageSize);
+DEFINE_validator(rpc_max_message_size, &ValidateMaxMessageSize);
 
 namespace kudu {
 namespace rpc {
diff --git a/src/kudu/tools/color.cc b/src/kudu/tools/color.cc
index 5cc37ec..c737a34 100644
--- a/src/kudu/tools/color.cc
+++ b/src/kudu/tools/color.cc
@@ -43,8 +43,7 @@ static bool ValidateColorFlag(const char* flagname, const std::string& value) {
   LOG(ERROR) << "option 'color' expects \"always\", \"auto\", or \"never\"";
   return false;
 }
-static bool dummy = google::RegisterFlagValidator(
-    &FLAGS_color, &ValidateColorFlag);
+DEFINE_validator(color, &ValidateColorFlag);
 
 
 namespace kudu {
diff --git a/src/kudu/util/process_memory.cc b/src/kudu/util/process_memory.cc
index e236a9e..8742bd6 100644
--- a/src/kudu/util/process_memory.cc
+++ b/src/kudu/util/process_memory.cc
@@ -117,14 +117,11 @@ static bool ValidatePercentage(const char* flagname, int value) {
   return false;
 }
 
-static bool dummy[] = {
-  google::RegisterFlagValidator(&FLAGS_memory_limit_soft_percentage, &ValidatePercentage),
-  google::RegisterFlagValidator(&FLAGS_memory_limit_warn_threshold_percentage, &ValidatePercentage)
+DEFINE_validator(memory_limit_soft_percentage, &ValidatePercentage);
+DEFINE_validator(memory_limit_warn_threshold_percentage, &ValidatePercentage);
 #ifdef TCMALLOC_ENABLED
-  ,google::RegisterFlagValidator(&FLAGS_tcmalloc_max_free_bytes_percentage, &ValidatePercentage)
+DEFINE_validator(tcmalloc_max_free_bytes_percentage, &ValidatePercentage);
 #endif
-};
-
 
 // Wrappers around tcmalloc functionality
 // ------------------------------------------------------------