From 37b2caae639433acc053c86451654342a8293a7b Mon Sep 17 00:00:00 2001 From: Matej Ferencevic Date: Sat, 7 Oct 2017 14:41:59 +0200 Subject: [PATCH] Implemented hidden flags. Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D861 --- libs/setup.sh | 2 +- .../concurrent/skiplist_gc.cpp | 6 ++-- src/query/interpreter.cpp | 3 +- src/query/plan/rule_based_planner.cpp | 12 +++---- src/query/plan/variable_start_planner.cpp | 2 +- src/utils/flag_validation.hpp | 33 +++++++++++++++++++ tools/apollo/build_release | 2 +- 7 files changed, 47 insertions(+), 13 deletions(-) diff --git a/libs/setup.sh b/libs/setup.sh index fb1dcc675..49c35f071 100755 --- a/libs/setup.sh +++ b/libs/setup.sh @@ -82,7 +82,7 @@ cd .. # google flags git clone https://github.com/memgraph/gflags.git -gflags_tag="18c4a5d151f7828c62d838ef513b4db290e5324c" # custom version (May 6, 2017) +gflags_tag="b37ceb03a0e56c9f15ce80409438a555f8a67b7c" # custom version (May 6, 2017) cd gflags git checkout ${gflags_tag} cd .. diff --git a/src/data_structures/concurrent/skiplist_gc.cpp b/src/data_structures/concurrent/skiplist_gc.cpp index a5982951e..5a443983e 100644 --- a/src/data_structures/concurrent/skiplist_gc.cpp +++ b/src/data_structures/concurrent/skiplist_gc.cpp @@ -1,6 +1,6 @@ #include "skiplist_gc.hpp" #include "gflags/gflags.h" -DEFINE_int32(skiplist_gc_interval, 10, - "Interval of how often does skiplist gc run in seconds. To " - "disable set to 0."); +DEFINE_HIDDEN_int32(skiplist_gc_interval, 10, + "Interval of how often does skiplist gc run in seconds. To " + "disable set to 0."); diff --git a/src/query/interpreter.cpp b/src/query/interpreter.cpp index 25684d8e1..b138ac830 100644 --- a/src/query/interpreter.cpp +++ b/src/query/interpreter.cpp @@ -8,7 +8,8 @@ #include "query/plan/vertex_count_cache.hpp" #include "utils/flag_validation.hpp" -DEFINE_bool(query_cost_planner, true, "Use the cost-estimating query planner."); +DEFINE_HIDDEN_bool(query_cost_planner, true, + "Use the cost-estimating query planner."); DEFINE_bool(query_plan_cache, true, "Cache generated query plans"); DEFINE_VALIDATED_int32(query_plan_cache_ttl, 60, "Time to live for cached query plans, in seconds.", diff --git a/src/query/plan/rule_based_planner.cpp b/src/query/plan/rule_based_planner.cpp index 14c59cc25..043a8166b 100644 --- a/src/query/plan/rule_based_planner.cpp +++ b/src/query/plan/rule_based_planner.cpp @@ -10,12 +10,12 @@ #include "utils/exceptions.hpp" #include "utils/flag_validation.hpp" -DEFINE_VALIDATED_int64(query_vertex_count_to_expand_existing, 10, - "Maximum count of indexed vertices which provoke " - "indexed lookup and then expand to existing, instead of " - "a regular expand. Default is 10, to turn off use -1.", - FLAG_IN_RANGE(-1, - std::numeric_limits::max())); +DEFINE_VALIDATED_HIDDEN_int64( + query_vertex_count_to_expand_existing, 10, + "Maximum count of indexed vertices which provoke " + "indexed lookup and then expand to existing, instead of " + "a regular expand. Default is 10, to turn off use -1.", + FLAG_IN_RANGE(-1, std::numeric_limits::max())); namespace query::plan { diff --git a/src/query/plan/variable_start_planner.cpp b/src/query/plan/variable_start_planner.cpp index 70e8b9df9..614346d3f 100644 --- a/src/query/plan/variable_start_planner.cpp +++ b/src/query/plan/variable_start_planner.cpp @@ -5,7 +5,7 @@ #include "utils/flag_validation.hpp" -DEFINE_VALIDATED_uint64( +DEFINE_VALIDATED_HIDDEN_uint64( query_max_plans, 1000U, "Maximum number of generated plans for a query", FLAG_IN_RANGE(1, std::numeric_limits::max())); diff --git a/src/utils/flag_validation.hpp b/src/utils/flag_validation.hpp index 11bafd239..470096fc1 100644 --- a/src/utils/flag_validation.hpp +++ b/src/utils/flag_validation.hpp @@ -66,6 +66,15 @@ } \ DEFINE_validator(flag_name, &validate_##flag_name) +#define DEFINE_VALIDATED_HIDDEN_FLAG(flag_type, flag_name, default_value, \ + description, cpp_type, validation_body) \ + DEFINE_HIDDEN_##flag_type(flag_name, default_value, description); \ + namespace { \ + bool validate_##flag_name(const char *flagname, \ + cpp_type value) validation_body \ + } \ + DEFINE_validator(flag_name, &validate_##flag_name) + /// Define a boolean command line flag with validation. /// /// @sa DEFINE_VALIDATED_int32 @@ -77,6 +86,10 @@ validation_body) \ DEFINE_VALIDATED_FLAG(bool, flag_name, default_value, description, bool, \ validation_body) +#define DEFINE_VALIDATED_HIDDEN_bool(flag_name, default_value, description, \ + validation_body) \ + DEFINE_VALIDATED_HIDDEN_FLAG(bool, flag_name, default_value, description, \ + bool, validation_body) /// Define an integer command line flag with validation. /// @@ -89,6 +102,10 @@ validation_body) \ DEFINE_VALIDATED_FLAG(int32, flag_name, default_value, description, \ std::int32_t, validation_body) +#define DEFINE_VALIDATED_HIDDEN_int32(flag_name, default_value, description, \ + validation_body) \ + DEFINE_VALIDATED_HIDDEN_FLAG(int32, flag_name, default_value, description, \ + std::int32_t, validation_body) /// Define an integer command line flag with validation. /// @@ -101,6 +118,10 @@ validation_body) \ DEFINE_VALIDATED_FLAG(int64, flag_name, default_value, description, \ std::int64_t, validation_body) +#define DEFINE_VALIDATED_HIDDEN_int64(flag_name, default_value, description, \ + validation_body) \ + DEFINE_VALIDATED_HIDDEN_FLAG(int64, flag_name, default_value, description, \ + std::int64_t, validation_body) /// Define an unsigned integer command line flag with validation. /// @@ -113,6 +134,10 @@ validation_body) \ DEFINE_VALIDATED_FLAG(uint64, flag_name, default_value, description, \ std::uint64_t, validation_body) +#define DEFINE_VALIDATED_HIDDEN_uint64(flag_name, default_value, description, \ + validation_body) \ + DEFINE_VALIDATED_HIDDEN_FLAG(uint64, flag_name, default_value, description, \ + std::uint64_t, validation_body) /// Define a double floating point command line flag with validation. /// @@ -125,6 +150,10 @@ validation_body) \ DEFINE_VALIDATED_FLAG(double, flag_name, default_value, description, double, \ validation_body) +#define DEFINE_VALIDATED_HIDDEN_double(flag_name, default_value, description, \ + validation_body) \ + DEFINE_VALIDATED_HIDDEN_FLAG(double, flag_name, default_value, description, \ + double, validation_body) /// Define a character string command line flag with validation. /// @@ -137,6 +166,10 @@ validation_body) \ DEFINE_VALIDATED_FLAG(string, flag_name, default_value, description, \ const std::string &, validation_body) +#define DEFINE_VALIDATED_HIDDEN_string(flag_name, default_value, description, \ + validation_body) \ + DEFINE_VALIDATED_HIDDEN_FLAG(string, flag_name, default_value, description, \ + const std::string &, validation_body) /// General flag validator for numeric flag values inside a range (inclusive). /// diff --git a/tools/apollo/build_release b/tools/apollo/build_release index 276f6804b..c9cd7462a 100644 --- a/tools/apollo/build_release +++ b/tools/apollo/build_release @@ -12,7 +12,7 @@ cd build cmake -DCMAKE_BUILD_TYPE=Release -DUSE_READLINE=OFF .. TIMEOUT=1000 make -j$THREADS # Create a binary package (which can then be used for Docker image). -cpack -D CPACK_SET_DESTDIR=ON -G TGZ +#cpack -D CPACK_SET_DESTDIR=ON -G TGZ cd ../tools