1
0
Fork 0

Merge branch 'devel' of ssh://github.com/ArangoDB/ArangoDB into devel

This commit is contained in:
Max Neunhoeffer 2016-11-02 09:38:11 -07:00
commit 6890860dd3
6 changed files with 41 additions and 26 deletions

View File

@ -46,7 +46,9 @@ AgencyFeature::AgencyFeature(application_features::ApplicationServer* server)
_waitForSync(true), _waitForSync(true),
_supervisionFrequency(5.0), _supervisionFrequency(5.0),
_compactionStepSize(1000), _compactionStepSize(1000),
_supervisionGracePeriod(120.0) { _supervisionGracePeriod(120.0),
_cmdLineTimings(false)
{
setOptional(true); setOptional(true);
requiresElevatedPrivileges(false); requiresElevatedPrivileges(false);
startsAfter("Database"); startsAfter("Database");
@ -119,6 +121,10 @@ void AgencyFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
return; return;
} }
if (result.touched("agency.election-timeout-min")) {
_cmdLineTimings = true;
}
ServerState::instance()->setRole(ServerState::ROLE_AGENT); ServerState::instance()->setRole(ServerState::ROLE_AGENT);
// Agency size // Agency size
@ -221,7 +227,7 @@ void AgencyFeature::start() {
_agent.reset(new consensus::Agent(consensus::config_t( _agent.reset(new consensus::Agent(consensus::config_t(
_size, _poolSize, _minElectionTimeout, _maxElectionTimeout, endpoint, _size, _poolSize, _minElectionTimeout, _maxElectionTimeout, endpoint,
_agencyEndpoints, _supervision, _waitForSync, _supervisionFrequency, _agencyEndpoints, _supervision, _waitForSync, _supervisionFrequency,
_compactionStepSize, _supervisionGracePeriod))); _compactionStepSize, _supervisionGracePeriod, _cmdLineTimings)));
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Starting agency personality"; LOG_TOPIC(DEBUG, Logger::AGENCY) << "Starting agency personality";
_agent->start(); _agent->start();

View File

@ -57,6 +57,7 @@ class AgencyFeature : virtual public application_features::ApplicationFeature {
double _supervisionGracePeriod; double _supervisionGracePeriod;
std::string _agencyMyAddress; std::string _agencyMyAddress;
std::vector<std::string> _agencyEndpoints; std::vector<std::string> _agencyEndpoints;
bool _cmdLineTimings;
public: public:
consensus::Agent* agent() const { return _agent.get(); } consensus::Agent* agent() const { return _agent.get(); }

View File

@ -39,12 +39,13 @@ config_t::config_t()
_supervisionFrequency(5.0), _supervisionFrequency(5.0),
_compactionStepSize(1000), _compactionStepSize(1000),
_supervisionGracePeriod(120), _supervisionGracePeriod(120),
_cmdLineTimings(false),
_lock() _lock()
{} {}
config_t::config_t(size_t as, size_t ps, double minp, double maxp, config_t::config_t(size_t as, size_t ps, double minp, double maxp,
std::string const& e, std::vector<std::string> const& g, std::string const& e, std::vector<std::string> const& g,
bool s, bool w, double f, uint64_t c, double p) bool s, bool w, double f, uint64_t c, double p, bool t)
: _agencySize(as), : _agencySize(as),
_poolSize(ps), _poolSize(ps),
_minPing(minp), _minPing(minp),
@ -56,6 +57,7 @@ config_t::config_t(size_t as, size_t ps, double minp, double maxp,
_supervisionFrequency(f), _supervisionFrequency(f),
_compactionStepSize(c), _compactionStepSize(c),
_supervisionGracePeriod(p), _supervisionGracePeriod(p),
_cmdLineTimings(t),
_lock() {} _lock() {}
config_t::config_t(config_t const& other) { *this = other; } config_t::config_t(config_t const& other) { *this = other; }
@ -74,7 +76,8 @@ config_t::config_t(config_t&& other)
_waitForSync(std::move(other._waitForSync)), _waitForSync(std::move(other._waitForSync)),
_supervisionFrequency(std::move(other._supervisionFrequency)), _supervisionFrequency(std::move(other._supervisionFrequency)),
_compactionStepSize(std::move(other._compactionStepSize)), _compactionStepSize(std::move(other._compactionStepSize)),
_supervisionGracePeriod(std::move(other._supervisionGracePeriod)) {} _supervisionGracePeriod(std::move(other._supervisionGracePeriod)),
_cmdLineTimings(std::move(other._cmdLineTimings)){}
config_t& config_t::operator=(config_t const& other) { config_t& config_t::operator=(config_t const& other) {
// must hold the lock of other to copy _pool, _minPing, _maxPing etc. // must hold the lock of other to copy _pool, _minPing, _maxPing etc.
@ -94,6 +97,7 @@ config_t& config_t::operator=(config_t const& other) {
_supervisionFrequency = other._supervisionFrequency; _supervisionFrequency = other._supervisionFrequency;
_compactionStepSize = other._compactionStepSize; _compactionStepSize = other._compactionStepSize;
_supervisionGracePeriod = other._supervisionGracePeriod; _supervisionGracePeriod = other._supervisionGracePeriod;
_cmdLineTimings = other._cmdLineTimings;
return *this; return *this;
} }
@ -112,9 +116,15 @@ config_t& config_t::operator=(config_t&& other) {
_supervisionFrequency = std::move(other._supervisionFrequency); _supervisionFrequency = std::move(other._supervisionFrequency);
_compactionStepSize = std::move(other._compactionStepSize); _compactionStepSize = std::move(other._compactionStepSize);
_supervisionGracePeriod = std::move(other._supervisionGracePeriod); _supervisionGracePeriod = std::move(other._supervisionGracePeriod);
_cmdLineTimings = std::move(other._cmdLineTimings);
return *this; return *this;
} }
bool config_t::cmdLineTimings() const {
READ_LOCKER(readLocker, _lock);
return _cmdLineTimings;
}
double config_t::supervisionGracePeriod() const { double config_t::supervisionGracePeriod() const {
READ_LOCKER(readLocker, _lock); READ_LOCKER(readLocker, _lock);
return _supervisionGracePeriod; return _supervisionGracePeriod;

View File

@ -68,6 +68,7 @@ struct config_t {
double _supervisionFrequency; double _supervisionFrequency;
uint64_t _compactionStepSize; uint64_t _compactionStepSize;
double _supervisionGracePeriod; double _supervisionGracePeriod;
bool _cmdLineTimings;
mutable arangodb::basics::ReadWriteLock _lock; // guard member variables mutable arangodb::basics::ReadWriteLock _lock; // guard member variables
@ -77,7 +78,7 @@ struct config_t {
/// @brief ctor /// @brief ctor
config_t(size_t as, size_t ps, double minp, double maxp, std::string const& e, config_t(size_t as, size_t ps, double minp, double maxp, std::string const& e,
std::vector<std::string> const& g, bool s, bool w, double f, std::vector<std::string> const& g, bool s, bool w, double f,
uint64_t c, double p); uint64_t c, double p, bool t);
/// @brief copy constructor /// @brief copy constructor
config_t(config_t const&); config_t(config_t const&);
@ -171,6 +172,9 @@ struct config_t {
/// @brief Reset RAFT timing /// @brief Reset RAFT timing
void pingTimes(double, double); void pingTimes(double, double);
/// @brief Supervision grace period
bool cmdLineTimings() const;
/// @brief Supervision grace period /// @brief Supervision grace period
double supervisionGracePeriod() const; double supervisionGracePeriod() const;

View File

@ -494,7 +494,11 @@ void Inception::run() {
FATAL_ERROR_EXIT(); FATAL_ERROR_EXIT();
} }
// 5. If command line RAFT timings have not been set explicitly
// Try good estimate of RAFT time limits
if (!config.cmdLineTimings()) {
estimateRAFTInterval(); estimateRAFTInterval();
}
_agent->ready(true); _agent->ready(true);

View File

@ -35,44 +35,34 @@ while [[ ${1} ]]; do
case "${1}" in case "${1}" in
-a|--agency-size) -a|--agency-size)
NRAGENTS=${2} NRAGENTS=${2}
shift shift;;
;;
-p|--pool-size) -p|--pool-size)
POOLSZ=${2} POOLSZ=${2}
shift shift;;
;;
-t|--transport) -t|--transport)
TRANSPORT=${2} TRANSPORT=${2}
shift shift;;
;;
-l|--log-level) -l|--log-level)
LOG_LEVEL=${2} LOG_LEVEL=${2}
shift shift;;
;;
-w|--wait-for-sync) -w|--wait-for-sync)
WAIT_FOR_SYNC=${2} WAIT_FOR_SYNC=${2}
shift shift;;
;;
-m|--use-microtime) -m|--use-microtime)
USE_MICROTIME=${2} USE_MICROTIME=${2}
shift shift;;
;;
-g|--gossip-mode) -g|--gossip-mode)
GOSSIP_MODE=${2} GOSSIP_MODE=${2}
shift shift;;
;;
-s|--start-delays) -s|--start-delays)
START_DELAYS=${2} START_DELAYS=${2}
shift shift;;
;;
-h|--help) -h|--help)
help help; exit 1
exit 1
;; ;;
*) *)
echo "Unknown parameter: ${1}" >&2 echo "Unknown parameter: ${1}" >&2
help help; exit 1
exit 1
;; ;;
esac esac