17
17
if (cert_debug_on == false) { } \
18
18
else log_info << "cert debug: "
21
galera::Certification::Param::log_conflicts =
22
CERTIFICATION_PARAM_LOG_CONFLICTS_STR;
25
galera::Certification::Defaults::log_conflicts =
26
CERTIFICATION_DEFAULTS_LOG_CONFLICTS_STR;
20
#define CERT_PARAM_LOG_CONFLICTS galera::Certification::PARAM_LOG_CONFLICTS
22
static std::string const CERT_PARAM_PREFIX("cert.");
24
std::string const galera::Certification::PARAM_LOG_CONFLICTS(CERT_PARAM_PREFIX +
27
static std::string const CERT_PARAM_MAX_LENGTH (CERT_PARAM_PREFIX +
29
static std::string const CERT_PARAM_LENGTH_CHECK (CERT_PARAM_PREFIX +
32
static std::string const CERT_PARAM_LOG_CONFLICTS_DEFAULT("no");
28
34
/*** It is EXTREMELY important that these constants are the same on all nodes.
29
35
*** Don't change them ever!!! ***/
31
galera::Certification::max_length_default = 16384;
34
galera::Certification::max_length_check_default = 127;
36
static std::string const CERT_PARAM_MAX_LENGTH_DEFAULT("16384");
37
static std::string const CERT_PARAM_LENGTH_CHECK_DEFAULT("127");
40
galera::Certification::register_params(gu::Config& cnf)
42
cnf.add(CERT_PARAM_LOG_CONFLICTS, CERT_PARAM_LOG_CONFLICTS_DEFAULT);
43
/* The defaults below are deliberately not reflected in conf: people
44
* should not know about these dangerous setting unless they read RTFM. */
45
cnf.add(CERT_PARAM_MAX_LENGTH);
46
cnf.add(CERT_PARAM_LENGTH_CHECK);
49
/* a function to get around unset defaults in ctor initialization list */
51
max_length(const gu::Config& conf)
53
if (conf.is_set(CERT_PARAM_MAX_LENGTH))
54
return conf.get<int>(CERT_PARAM_MAX_LENGTH);
56
return gu::Config::from_config<int>(CERT_PARAM_MAX_LENGTH_DEFAULT);
59
/* a function to get around unset defaults in ctor initialization list */
61
length_check(const gu::Config& conf)
63
if (conf.is_set(CERT_PARAM_LENGTH_CHECK))
64
return conf.get<int>(CERT_PARAM_LENGTH_CHECK);
66
return gu::Config::from_config<int>(CERT_PARAM_LENGTH_CHECK_DEFAULT);
38
70
galera::Certification::purge_for_trx_v1to2(TrxHandle* trx)
782
814
last_preordered_id_ (0),
783
815
n_certified_ (0),
786
/* The defaults below are deliberately not reflected in conf: people
787
* should not know about these dangerous setting unless they read RTFM. */
788
max_length_ (conf.get<long>("cert.max_length",
789
max_length_default)),
790
max_length_check_ (conf.get<unsigned long>("cert.max_length_check",
791
max_length_check_default)),
792
log_conflicts_ (false),
795
try // this is for unit tests where conf may lack some parameters
797
log_conflicts_ = conf.get<bool>(Param::log_conflicts);
799
catch (gu::NotFound& e)
801
conf.set(Param::log_conflicts, Defaults::log_conflicts);
802
log_conflicts_ = conf.get<bool>(Param::log_conflicts);
819
max_length_ (max_length(conf)),
820
max_length_check_ (length_check(conf)),
821
log_conflicts_ (conf.get<bool>(CERT_PARAM_LOG_CONFLICTS))
807
825
galera::Certification::~Certification()
1057
1075
bool const old(log_conflicts_);
1058
log_conflicts_ = gu::from_string<bool>(str);
1076
log_conflicts_ = gu::Config::from_config<bool>(str);
1059
1077
if (old != log_conflicts_)
1061
1079
log_info << (log_conflicts_ ? "Enabled" : "Disabled")