Implemented hidden flags.

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D861
This commit is contained in:
Matej Ferencevic 2017-10-07 14:41:59 +02:00
parent e11216f058
commit 37b2caae63
7 changed files with 47 additions and 13 deletions

View File

@ -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 ..

View File

@ -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.");

View File

@ -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.",

View File

@ -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<std::int64_t>::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<std::int64_t>::max()));
namespace query::plan {

View File

@ -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<std::uint64_t>::max()));

View File

@ -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).
///

View File

@ -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