mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/ArangoDB/ArangoDB into devel
This commit is contained in:
commit
6890860dd3
|
@ -46,7 +46,9 @@ AgencyFeature::AgencyFeature(application_features::ApplicationServer* server)
|
|||
_waitForSync(true),
|
||||
_supervisionFrequency(5.0),
|
||||
_compactionStepSize(1000),
|
||||
_supervisionGracePeriod(120.0) {
|
||||
_supervisionGracePeriod(120.0),
|
||||
_cmdLineTimings(false)
|
||||
{
|
||||
setOptional(true);
|
||||
requiresElevatedPrivileges(false);
|
||||
startsAfter("Database");
|
||||
|
@ -119,6 +121,10 @@ void AgencyFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (result.touched("agency.election-timeout-min")) {
|
||||
_cmdLineTimings = true;
|
||||
}
|
||||
|
||||
ServerState::instance()->setRole(ServerState::ROLE_AGENT);
|
||||
|
||||
// Agency size
|
||||
|
@ -221,7 +227,7 @@ void AgencyFeature::start() {
|
|||
_agent.reset(new consensus::Agent(consensus::config_t(
|
||||
_size, _poolSize, _minElectionTimeout, _maxElectionTimeout, endpoint,
|
||||
_agencyEndpoints, _supervision, _waitForSync, _supervisionFrequency,
|
||||
_compactionStepSize, _supervisionGracePeriod)));
|
||||
_compactionStepSize, _supervisionGracePeriod, _cmdLineTimings)));
|
||||
|
||||
LOG_TOPIC(DEBUG, Logger::AGENCY) << "Starting agency personality";
|
||||
_agent->start();
|
||||
|
|
|
@ -57,6 +57,7 @@ class AgencyFeature : virtual public application_features::ApplicationFeature {
|
|||
double _supervisionGracePeriod;
|
||||
std::string _agencyMyAddress;
|
||||
std::vector<std::string> _agencyEndpoints;
|
||||
bool _cmdLineTimings;
|
||||
|
||||
public:
|
||||
consensus::Agent* agent() const { return _agent.get(); }
|
||||
|
|
|
@ -39,12 +39,13 @@ config_t::config_t()
|
|||
_supervisionFrequency(5.0),
|
||||
_compactionStepSize(1000),
|
||||
_supervisionGracePeriod(120),
|
||||
_cmdLineTimings(false),
|
||||
_lock()
|
||||
{}
|
||||
|
||||
config_t::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, uint64_t c, double p)
|
||||
bool s, bool w, double f, uint64_t c, double p, bool t)
|
||||
: _agencySize(as),
|
||||
_poolSize(ps),
|
||||
_minPing(minp),
|
||||
|
@ -56,6 +57,7 @@ config_t::config_t(size_t as, size_t ps, double minp, double maxp,
|
|||
_supervisionFrequency(f),
|
||||
_compactionStepSize(c),
|
||||
_supervisionGracePeriod(p),
|
||||
_cmdLineTimings(t),
|
||||
_lock() {}
|
||||
|
||||
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)),
|
||||
_supervisionFrequency(std::move(other._supervisionFrequency)),
|
||||
_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) {
|
||||
// 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;
|
||||
_compactionStepSize = other._compactionStepSize;
|
||||
_supervisionGracePeriod = other._supervisionGracePeriod;
|
||||
_cmdLineTimings = other._cmdLineTimings;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -112,9 +116,15 @@ config_t& config_t::operator=(config_t&& other) {
|
|||
_supervisionFrequency = std::move(other._supervisionFrequency);
|
||||
_compactionStepSize = std::move(other._compactionStepSize);
|
||||
_supervisionGracePeriod = std::move(other._supervisionGracePeriod);
|
||||
_cmdLineTimings = std::move(other._cmdLineTimings);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool config_t::cmdLineTimings() const {
|
||||
READ_LOCKER(readLocker, _lock);
|
||||
return _cmdLineTimings;
|
||||
}
|
||||
|
||||
double config_t::supervisionGracePeriod() const {
|
||||
READ_LOCKER(readLocker, _lock);
|
||||
return _supervisionGracePeriod;
|
||||
|
|
|
@ -68,6 +68,7 @@ struct config_t {
|
|||
double _supervisionFrequency;
|
||||
uint64_t _compactionStepSize;
|
||||
double _supervisionGracePeriod;
|
||||
bool _cmdLineTimings;
|
||||
|
||||
mutable arangodb::basics::ReadWriteLock _lock; // guard member variables
|
||||
|
||||
|
@ -77,7 +78,7 @@ struct config_t {
|
|||
/// @brief ctor
|
||||
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,
|
||||
uint64_t c, double p);
|
||||
uint64_t c, double p, bool t);
|
||||
|
||||
/// @brief copy constructor
|
||||
config_t(config_t const&);
|
||||
|
@ -171,6 +172,9 @@ struct config_t {
|
|||
/// @brief Reset RAFT timing
|
||||
void pingTimes(double, double);
|
||||
|
||||
/// @brief Supervision grace period
|
||||
bool cmdLineTimings() const;
|
||||
|
||||
/// @brief Supervision grace period
|
||||
double supervisionGracePeriod() const;
|
||||
|
||||
|
|
|
@ -494,7 +494,11 @@ void Inception::run() {
|
|||
FATAL_ERROR_EXIT();
|
||||
}
|
||||
|
||||
estimateRAFTInterval();
|
||||
// 5. If command line RAFT timings have not been set explicitly
|
||||
// Try good estimate of RAFT time limits
|
||||
if (!config.cmdLineTimings()) {
|
||||
estimateRAFTInterval();
|
||||
}
|
||||
|
||||
_agent->ready(true);
|
||||
|
||||
|
|
|
@ -35,44 +35,34 @@ while [[ ${1} ]]; do
|
|||
case "${1}" in
|
||||
-a|--agency-size)
|
||||
NRAGENTS=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-p|--pool-size)
|
||||
POOLSZ=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-t|--transport)
|
||||
TRANSPORT=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-l|--log-level)
|
||||
LOG_LEVEL=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-w|--wait-for-sync)
|
||||
WAIT_FOR_SYNC=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-m|--use-microtime)
|
||||
USE_MICROTIME=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-g|--gossip-mode)
|
||||
GOSSIP_MODE=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-s|--start-delays)
|
||||
START_DELAYS=${2}
|
||||
shift
|
||||
;;
|
||||
shift;;
|
||||
-h|--help)
|
||||
help
|
||||
exit 1
|
||||
help; exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown parameter: ${1}" >&2
|
||||
help
|
||||
exit 1
|
||||
help; exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in New Issue