mirror of https://gitee.com/bigwinds/arangodb
Agency write sensitive to X-ArangoDB-Agency-Mode
This commit is contained in:
parent
a6bd03c609
commit
1bdfe53ec2
|
@ -35,7 +35,7 @@ using namespace arangodb::velocypack;
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
namespace consensus {
|
namespace consensus {
|
||||||
|
|
||||||
Agent::Agent () : Thread ("Agent"), _last_commit_index(0), _stopping(false) {}
|
Agent::Agent () : Thread ("Agent"), _last_commit_index(0) {}
|
||||||
|
|
||||||
Agent::Agent (config_t const& config) :
|
Agent::Agent (config_t const& config) :
|
||||||
Thread ("Agent"), _config(config), _last_commit_index(0) {
|
Thread ("Agent"), _config(config), _last_commit_index(0) {
|
||||||
|
@ -50,16 +50,22 @@ Agent::~Agent () {
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
State const& Agent::state() const {
|
State const& Agent::state () const {
|
||||||
return _state;
|
return _state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Start all agency threads
|
||||||
bool Agent::start() {
|
bool Agent::start() {
|
||||||
LOG(INFO) << "AGENCY: Starting constituent thread.";
|
|
||||||
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Starting constituent personality.";
|
||||||
_constituent.start();
|
_constituent.start();
|
||||||
LOG(INFO) << "AGENCY: Starting spearhead thread.";
|
|
||||||
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Starting spearhead worker.";
|
||||||
_spearhead.start();
|
_spearhead.start();
|
||||||
|
|
||||||
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Starting agency comm worker.";
|
||||||
Thread::start();
|
Thread::start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +147,8 @@ void Agent::reportIn (id_t id, index_t index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n>size()/2) { // catch up read database and commit index
|
if (n>size()/2) { // catch up read database and commit index
|
||||||
LOG(INFO) << "AGENCY: Critical mass for commiting " << _last_commit_index+1
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Critical mass for commiting " <<
|
||||||
<< " through " << index << " to read db";
|
_last_commit_index+1 << " through " << index << " to read db";
|
||||||
|
|
||||||
_read_db.apply(_state.slices(_last_commit_index+1, index));
|
_read_db.apply(_state.slices(_last_commit_index+1, index));
|
||||||
_last_commit_index = index;
|
_last_commit_index = index;
|
||||||
|
@ -157,29 +163,29 @@ bool Agent::recvAppendEntriesRPC (term_t term, id_t leaderId, index_t prevIndex,
|
||||||
//Update commit index
|
//Update commit index
|
||||||
|
|
||||||
if (queries->slice().type() != VPackValueType::Array) {
|
if (queries->slice().type() != VPackValueType::Array) {
|
||||||
LOG(WARN) << "AGENCY: Received malformed entries for appending. Discarting!";
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Received malformed entries for appending. Discarting!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (queries->slice().length()) {
|
if (queries->slice().length()) {
|
||||||
LOG(INFO) << "AGENCY: Appending "<< queries->slice().length()
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Appending "<< queries->slice().length()
|
||||||
<< " entries to state machine.";
|
<< " entries to state machine.";
|
||||||
} else {
|
} else {
|
||||||
// heart-beat
|
// heart-beat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_last_commit_index < leaderCommitIndex) {
|
if (_last_commit_index < leaderCommitIndex) {
|
||||||
LOG(INFO) << "Updating last commited index to " << leaderCommitIndex;
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Updating last commited index to " << leaderCommitIndex;
|
||||||
}
|
}
|
||||||
_last_commit_index = leaderCommitIndex;
|
_last_commit_index = leaderCommitIndex;
|
||||||
|
|
||||||
// Sanity
|
// Sanity
|
||||||
if (this->term() > term) { // (§5.1)
|
if (this->term() > term) { // (§5.1)
|
||||||
LOG(WARN) << "AGENCY: I have a higher term than RPC caller.";
|
LOG_TOPIC(WARN, Logger::AGENCY) << "I have a higher term than RPC caller.";
|
||||||
throw LOWER_TERM_APPEND_ENTRIES_RPC;
|
throw LOWER_TERM_APPEND_ENTRIES_RPC;
|
||||||
}
|
}
|
||||||
if (!_state.findit(prevIndex, prevTerm)) { // (§5.3)
|
if (!_state.findit(prevIndex, prevTerm)) { // (§5.3)
|
||||||
LOG(WARN)
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
<< "AGENCY: I have no matching set of prevLogIndex/prevLogTerm "
|
<< "No matching set of prevLogIndex/prevLogTerm "
|
||||||
<< "in my own state machine. This is trouble!";
|
<< "in my own state machine. This is trouble!";
|
||||||
throw NO_MATCHING_PREVLOG;
|
throw NO_MATCHING_PREVLOG;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +226,7 @@ append_entries_t Agent::sendAppendEntriesRPC (
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
if (unconfirmed.size() > 1) {
|
if (unconfirmed.size() > 1) {
|
||||||
LOG(INFO) << "AGENCY: Appending " << unconfirmed.size() << " entries up to index "
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Appending " << unconfirmed.size() << " entries up to index "
|
||||||
<< last << " to follower " << slave_id;
|
<< last << " to follower " << slave_id;
|
||||||
}
|
}
|
||||||
arangodb::ClusterComm::instance()->asyncRequest
|
arangodb::ClusterComm::instance()->asyncRequest
|
||||||
|
@ -236,9 +242,9 @@ append_entries_t Agent::sendAppendEntriesRPC (
|
||||||
|
|
||||||
bool Agent::load () {
|
bool Agent::load () {
|
||||||
|
|
||||||
LOG(INFO) << "AGENCY: Loading persistent state.";
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Loading persistent state.";
|
||||||
if (!_state.load())
|
if (!_state.load())
|
||||||
LOG(FATAL) << "AGENCY: Failed to load persistent state on statup.";
|
LOG(FATAL) << "Failed to load persistent state on statup.";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,127 +37,92 @@ class Agent : public arangodb::Thread {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/// @brief Default ctor
|
||||||
* @brief Default ctor
|
|
||||||
*/
|
|
||||||
Agent ();
|
Agent ();
|
||||||
|
|
||||||
/**
|
/// @brief Construct with program options
|
||||||
* @brief Construct with program options
|
|
||||||
*/
|
|
||||||
explicit Agent (config_t const&);
|
explicit Agent (config_t const&);
|
||||||
|
|
||||||
/**
|
/// @brief Clean up
|
||||||
* @brief Clean up
|
|
||||||
*/
|
|
||||||
virtual ~Agent();
|
virtual ~Agent();
|
||||||
|
|
||||||
/**
|
/// @brief Get current term
|
||||||
* @brief Get current term
|
|
||||||
*/
|
|
||||||
term_t term() const;
|
term_t term() const;
|
||||||
|
|
||||||
/**
|
/// @brief Get current term
|
||||||
* @brief Get current term
|
|
||||||
*/
|
|
||||||
id_t id() const;
|
id_t id() const;
|
||||||
|
|
||||||
/**
|
/// @brief Vote request
|
||||||
* @brief Vote request
|
|
||||||
*/
|
|
||||||
priv_rpc_ret_t requestVote(term_t , id_t, index_t, index_t, query_t const&);
|
priv_rpc_ret_t requestVote(term_t , id_t, index_t, index_t, query_t const&);
|
||||||
|
|
||||||
/**
|
/// @brief Provide configuration
|
||||||
* @brief Provide configuration
|
|
||||||
*/
|
|
||||||
config_t const& config () const;
|
config_t const& config () const;
|
||||||
|
|
||||||
/**
|
/// @brief Start thread
|
||||||
* @brief Start thread
|
|
||||||
*/
|
|
||||||
bool start ();
|
bool start ();
|
||||||
|
|
||||||
/**
|
/// @brief Verbose print of myself
|
||||||
* @brief Verbose print of myself
|
////
|
||||||
*/
|
|
||||||
void print (arangodb::LoggerStream&) const;
|
void print (arangodb::LoggerStream&) const;
|
||||||
|
|
||||||
/**
|
/// @brief Are we fit to run?
|
||||||
* @brief Are we fit to run?
|
|
||||||
*/
|
|
||||||
bool fitness () const;
|
bool fitness () const;
|
||||||
|
|
||||||
/**
|
/// @brief Leader ID
|
||||||
* @brief Leader ID
|
|
||||||
*/
|
|
||||||
id_t leaderID () const;
|
id_t leaderID () const;
|
||||||
bool leading () const;
|
bool leading () const;
|
||||||
|
|
||||||
|
/// @brief Pick up leadership tasks
|
||||||
bool lead ();
|
bool lead ();
|
||||||
|
|
||||||
|
/// @brief Load persistent state
|
||||||
bool load ();
|
bool load ();
|
||||||
|
|
||||||
/**
|
/// @brief Attempt write
|
||||||
* @brief Attempt write
|
|
||||||
*/
|
|
||||||
write_ret_t write (query_t const&);
|
write_ret_t write (query_t const&);
|
||||||
|
|
||||||
/**
|
/// @brief Read from agency
|
||||||
* @brief Read from agency
|
|
||||||
*/
|
|
||||||
read_ret_t read (query_t const&) const;
|
read_ret_t read (query_t const&) const;
|
||||||
|
|
||||||
/**
|
/// @brief Received by followers to replicate log entries (§5.3);
|
||||||
* @brief Received by followers to replicate log entries (§5.3);
|
/// also used as heartbeat (§5.2).
|
||||||
* also used as heartbeat (§5.2).
|
|
||||||
*/
|
|
||||||
bool recvAppendEntriesRPC (term_t term, id_t leaderId, index_t prevIndex,
|
bool recvAppendEntriesRPC (term_t term, id_t leaderId, index_t prevIndex,
|
||||||
term_t prevTerm, index_t lastCommitIndex, query_t const& queries);
|
term_t prevTerm, index_t lastCommitIndex, query_t const& queries);
|
||||||
|
|
||||||
/**
|
/// @brief Invoked by leader to replicate log entries (§5.3);
|
||||||
* @brief Invoked by leader to replicate log entries (§5.3);
|
/// also used as heartbeat (§5.2).
|
||||||
* also used as heartbeat (§5.2).
|
|
||||||
*/
|
|
||||||
append_entries_t sendAppendEntriesRPC (id_t slave_id);
|
append_entries_t sendAppendEntriesRPC (id_t slave_id);
|
||||||
|
|
||||||
/**
|
/// @brief 1. Deal with appendEntries to slaves.
|
||||||
* @brief 1. Deal with appendEntries to slaves.
|
/// 2. Report success of write processes.
|
||||||
* 2. Report success of write processes.
|
|
||||||
*/
|
|
||||||
void run () override final;
|
void run () override final;
|
||||||
|
|
||||||
|
/// @brief Start orderly shutdown of threads
|
||||||
void beginShutdown () override final;
|
void beginShutdown () override final;
|
||||||
|
|
||||||
/**
|
/// @brief Report appended entries from AgentCallback
|
||||||
* @brief Report appended entries from AgentCallback
|
|
||||||
*/
|
|
||||||
void reportIn (id_t id, index_t idx);
|
void reportIn (id_t id, index_t idx);
|
||||||
|
|
||||||
/**
|
/// @brief Wait for slaves to confirm appended entries
|
||||||
* @brief Wait for slaves to confirm appended entries
|
|
||||||
*/
|
|
||||||
bool waitFor (index_t last_entry, duration_t timeout = duration_t(2.0));
|
bool waitFor (index_t last_entry, duration_t timeout = duration_t(2.0));
|
||||||
|
|
||||||
/**
|
/// @brief Convencience size of agency
|
||||||
* @brief Convencience size of agency
|
|
||||||
*/
|
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
|
|
||||||
/**
|
/// @brief Rebuild DBs by applying state log to empty DB
|
||||||
* @brief Rebuild DBs by applying state log to empty DB
|
|
||||||
*/
|
|
||||||
bool rebuildDBs();
|
bool rebuildDBs();
|
||||||
|
|
||||||
/**
|
/// @brief Last log entry
|
||||||
* @brief Last log entry
|
|
||||||
*/
|
|
||||||
log_t const& lastLog () const;
|
log_t const& lastLog () const;
|
||||||
|
|
||||||
|
/// @brief Pipe configuration to ostream
|
||||||
friend std::ostream& operator<< (std::ostream& o, Agent const& a) {
|
friend std::ostream& operator<< (std::ostream& o, Agent const& a) {
|
||||||
o << a.config();
|
o << a.config();
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
State const& state() const;
|
/// @brief State machine
|
||||||
|
State const& state () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -165,22 +130,17 @@ private:
|
||||||
State _state; /**< @brief Log replica */
|
State _state; /**< @brief Log replica */
|
||||||
config_t _config; /**< @brief Command line arguments */
|
config_t _config; /**< @brief Command line arguments */
|
||||||
|
|
||||||
std::atomic<index_t> _last_commit_index;
|
std::atomic<index_t> _last_commit_index; /**< @brief Last commit index */
|
||||||
|
|
||||||
arangodb::Mutex _uncommitedLock;
|
arangodb::Mutex _uncommitedLock; /**< @brief */
|
||||||
|
|
||||||
Store _spearhead;
|
Store _spearhead; /**< @brief Spearhead key value store */
|
||||||
Store _read_db;
|
Store _read_db; /**< @brief Read key value store */
|
||||||
|
|
||||||
AgentCallback _agent_callback;
|
arangodb::basics::ConditionVariable _cv; /**< @brief Internal callbacks */
|
||||||
|
arangodb::basics::ConditionVariable _rest_cv; /**< @brief Rest handler */
|
||||||
|
|
||||||
arangodb::basics::ConditionVariable _cv; // agency callbacks
|
std::vector<index_t> _confirmed;
|
||||||
arangodb::basics::ConditionVariable _rest_cv; // rest handler
|
|
||||||
|
|
||||||
|
|
||||||
std::atomic<bool> _stopping;
|
|
||||||
|
|
||||||
std::vector<index_t> _confirmed;
|
|
||||||
arangodb::Mutex _ioLock;
|
arangodb::Mutex _ioLock;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,7 +79,7 @@ term_t Constituent::term() const {
|
||||||
|
|
||||||
void Constituent::term(term_t t) {
|
void Constituent::term(term_t t) {
|
||||||
if (t != _term) {
|
if (t != _term) {
|
||||||
LOG(INFO) << "Updating term to " << t;
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Updating term to " << t;
|
||||||
}
|
}
|
||||||
_term = t;
|
_term = t;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ role_t Constituent::role () const {
|
||||||
|
|
||||||
void Constituent::follow (term_t t) {
|
void Constituent::follow (term_t t) {
|
||||||
if (_role != FOLLOWER) {
|
if (_role != FOLLOWER) {
|
||||||
LOG(INFO) << "Role change: Converted to follower in term " << t;
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Role change: Converted to follower in term " << t;
|
||||||
}
|
}
|
||||||
this->term(t);
|
this->term(t);
|
||||||
_votes.assign(_votes.size(),false); // void all votes
|
_votes.assign(_votes.size(),false); // void all votes
|
||||||
|
@ -99,7 +99,7 @@ void Constituent::follow (term_t t) {
|
||||||
|
|
||||||
void Constituent::lead () {
|
void Constituent::lead () {
|
||||||
if (_role != LEADER) {
|
if (_role != LEADER) {
|
||||||
LOG(INFO) << "Role change: Converted to leader in term " << _term ;
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Role change: Converted to leader in term " << _term ;
|
||||||
_agent->lead(); // We need to rebuild spear_head and read_db;
|
_agent->lead(); // We need to rebuild spear_head and read_db;
|
||||||
}
|
}
|
||||||
_role = LEADER;
|
_role = LEADER;
|
||||||
|
@ -108,7 +108,7 @@ void Constituent::lead () {
|
||||||
|
|
||||||
void Constituent::candidate () {
|
void Constituent::candidate () {
|
||||||
if (_role != CANDIDATE)
|
if (_role != CANDIDATE)
|
||||||
LOG(INFO) << "Role change: Converted to candidate in term " << _term ;
|
LOG_TOPIC(INFO, Logger::AGENCY) << "Role change: Converted to candidate in term " << _term ;
|
||||||
_role = CANDIDATE;
|
_role = CANDIDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ bool State::save (arangodb::velocypack::Slice const& slice, index_t index,
|
||||||
body.toJson(), headerFields, 0.0);
|
body.toJson(), headerFields, 0.0);
|
||||||
|
|
||||||
if (res->status != CL_COMM_SENT) {
|
if (res->status != CL_COMM_SENT) {
|
||||||
//LOG(WARN) << res->errorMessage;
|
//LOG_TOPIC(WARN, Logger::AGENCY) << res->errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (res->status == CL_COMM_SENT); // TODO: More verbose result
|
return (res->status == CL_COMM_SENT); // TODO: More verbose result
|
||||||
|
@ -203,7 +203,7 @@ bool State::checkDB (std::string const& name) {
|
||||||
"", headerFields, 1.0);
|
"", headerFields, 1.0);
|
||||||
|
|
||||||
if(res->result->wasHttpError()) {
|
if(res->result->wasHttpError()) {
|
||||||
LOG(WARN) << "Creating collection " << name;
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Creating collection " << name;
|
||||||
return createCollection(name);
|
return createCollection(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,14 +244,14 @@ bool State::loadCollection (std::string const& name) {
|
||||||
// Check success
|
// Check success
|
||||||
|
|
||||||
if(res->result->wasHttpError()) {
|
if(res->result->wasHttpError()) {
|
||||||
LOG(WARN) << "ERROR";
|
LOG_TOPIC(WARN, Logger::AGENCY) << "ERROR";
|
||||||
LOG(WARN) << res->endpoint;
|
LOG_TOPIC(WARN, Logger::AGENCY) << res->endpoint;
|
||||||
} else {
|
} else {
|
||||||
std::shared_ptr<Builder> body = res->result->getBodyVelocyPack();
|
std::shared_ptr<Builder> body = res->result->getBodyVelocyPack();
|
||||||
}
|
}
|
||||||
//LOG(WARN) << body->toJson();
|
//LOG_TOPIC(WARN, Logger::AGENCY) << body->toJson();
|
||||||
/* for (auto const& i : VPackArrayIterator(body->slice()))
|
/* for (auto const& i : VPackArrayIterator(body->slice()))
|
||||||
LOG(WARN) << typeid(i).name();*/
|
LOG_TOPIC(WARN, Logger::AGENCY) << typeid(i).name();*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -78,10 +78,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
std::vector<log_t> get (
|
std::vector<log_t> get (
|
||||||
index_t = 0, index_t = (std::numeric_limits<uint64_t>::max())) const;
|
index_t = 0, index_t = (std::numeric_limits<uint64_t>::max)()) const;
|
||||||
|
|
||||||
std::vector<VPackSlice> slices (
|
std::vector<VPackSlice> slices (
|
||||||
index_t = 0, index_t = (std::numeric_limits<uint64_t>::max())) const;
|
index_t = 0, index_t = (std::numeric_limits<uint64_t>::max)()) const;
|
||||||
|
|
||||||
|
|
||||||
/// @brief log entry at index i
|
/// @brief log entry at index i
|
||||||
|
|
|
@ -198,8 +198,8 @@ bool Node::applies (VPackSlice const& slice) {
|
||||||
return _parent->removeChild(_name);
|
return _parent->removeChild(_name);
|
||||||
} else if (oper == "set") { //
|
} else if (oper == "set") { //
|
||||||
if (!slice.hasKey("new")) {
|
if (!slice.hasKey("new")) {
|
||||||
LOG(WARN) << "Operator set without new value";
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Operator set without new value";
|
||||||
LOG(WARN) << slice.toJson();
|
LOG_TOPIC(WARN, Logger::AGENCY) << slice.toJson();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (slice.hasKey("ttl")) {
|
if (slice.hasKey("ttl")) {
|
||||||
|
@ -209,8 +209,9 @@ bool Node::applies (VPackSlice const& slice) {
|
||||||
return true;
|
return true;
|
||||||
} else if (oper == "increment") { // Increment
|
} else if (oper == "increment") { // Increment
|
||||||
if (!(self.isInt() || self.isUInt())) {
|
if (!(self.isInt() || self.isUInt())) {
|
||||||
LOG(WARN) << "Element to increment must be integral type: We are "
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
<< slice.toJson();
|
<< "Element to increment must be integral type: We are "
|
||||||
|
<< slice.toJson();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Builder tmp;
|
Builder tmp;
|
||||||
|
@ -220,8 +221,9 @@ bool Node::applies (VPackSlice const& slice) {
|
||||||
return true;
|
return true;
|
||||||
} else if (oper == "decrement") { // Decrement
|
} else if (oper == "decrement") { // Decrement
|
||||||
if (!(self.isInt() || self.isUInt())) {
|
if (!(self.isInt() || self.isUInt())) {
|
||||||
LOG(WARN) << "Element to decrement must be integral type. We are "
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
<< slice.toJson();
|
<< "Element to decrement must be integral type. We are "
|
||||||
|
<< slice.toJson();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Builder tmp;
|
Builder tmp;
|
||||||
|
@ -231,7 +233,8 @@ bool Node::applies (VPackSlice const& slice) {
|
||||||
return true;
|
return true;
|
||||||
} else if (oper == "push") { // Push
|
} else if (oper == "push") { // Push
|
||||||
if (!slice.hasKey("new")) {
|
if (!slice.hasKey("new")) {
|
||||||
LOG(WARN) << "Operator push without new value: " << slice.toJson();
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
|
<< "Operator push without new value: " << slice.toJson();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Builder tmp;
|
Builder tmp;
|
||||||
|
@ -261,8 +264,8 @@ bool Node::applies (VPackSlice const& slice) {
|
||||||
return true;
|
return true;
|
||||||
} else if (oper == "prepend") { // Prepend
|
} else if (oper == "prepend") { // Prepend
|
||||||
if (!slice.hasKey("new")) {
|
if (!slice.hasKey("new")) {
|
||||||
LOG(WARN) << "Operator prepend without new value: "
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
<< slice.toJson();
|
<< "Operator prepend without new value: " << slice.toJson();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Builder tmp;
|
Builder tmp;
|
||||||
|
@ -293,7 +296,7 @@ bool Node::applies (VPackSlice const& slice) {
|
||||||
*this = tmp.slice();
|
*this = tmp.slice();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
LOG(WARN) << "Unknown operation " << oper;
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Unknown operation " << oper;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (slice.hasKey("new")) { // new without set
|
} else if (slice.hasKey("new")) { // new without set
|
||||||
|
@ -348,12 +351,13 @@ std::vector<bool> Store::apply (query_t const& query) {
|
||||||
if (check(i[1])) {
|
if (check(i[1])) {
|
||||||
applied.push_back(applies(i[0])); // precondition
|
applied.push_back(applies(i[0])); // precondition
|
||||||
} else {
|
} else {
|
||||||
LOG(WARN) << "Precondition failed!";
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Precondition failed!";
|
||||||
applied.push_back(false);
|
applied.push_back(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: // wrong
|
default: // wrong
|
||||||
LOG(FATAL) << "We can only handle log entry with or without precondition!";
|
LOG_TOPIC(ERR, Logger::AGENCY)
|
||||||
|
<< "We can only handle log entry with or without precondition!";
|
||||||
applied.push_back(false);
|
applied.push_back(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +378,8 @@ std::vector<bool> Store::apply( std::vector<VPackSlice> const& queries) {
|
||||||
|
|
||||||
bool Store::check (VPackSlice const& slice) const {
|
bool Store::check (VPackSlice const& slice) const {
|
||||||
if (slice.type() != VPackValueType::Object) {
|
if (slice.type() != VPackValueType::Object) {
|
||||||
LOG(WARN) << "Cannot check precondition: " << slice.toJson();
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Cannot check precondition: "
|
||||||
|
<< slice.toJson();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (auto const& precond : VPackObjectIterator(slice)) {
|
for (auto const& precond : VPackObjectIterator(slice)) {
|
||||||
|
@ -428,7 +433,7 @@ query_t Store::read (query_t const& queries) const { // list of list of paths
|
||||||
}
|
}
|
||||||
result->close();
|
result->close();
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Read queries to stores must be arrays";
|
LOG_TOPIC(ERR, Logger::AGENCY) << "Read queries to stores must be arrays";
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,12 +126,12 @@ class ClusterTraversalPath : public TraversalPath {
|
||||||
const arangodb::basics::EnumeratedPath<std::string, std::string>& path)
|
const arangodb::basics::EnumeratedPath<std::string, std::string>& path)
|
||||||
: _path(path), _traverser(traverser) {}
|
: _path(path), _traverser(traverser) {}
|
||||||
|
|
||||||
arangodb::basics::Json* pathToJson(Transaction*, CollectionNameResolver*);
|
arangodb::basics::Json* pathToJson(Transaction*, CollectionNameResolver*) override ;
|
||||||
|
|
||||||
arangodb::basics::Json* lastEdgeToJson(Transaction*, CollectionNameResolver*);
|
arangodb::basics::Json* lastEdgeToJson(Transaction*, CollectionNameResolver*) override;
|
||||||
|
|
||||||
arangodb::basics::Json* lastVertexToJson(Transaction*,
|
arangodb::basics::Json* lastVertexToJson(Transaction*,
|
||||||
CollectionNameResolver*);
|
CollectionNameResolver*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
arangodb::basics::EnumeratedPath<std::string, std::string> _path;
|
arangodb::basics::EnumeratedPath<std::string, std::string> _path;
|
||||||
|
|
|
@ -48,7 +48,7 @@ class HttpListenTask : public ListenTask {
|
||||||
HttpListenTask(HttpServer* server, Endpoint* endpoint);
|
HttpListenTask(HttpServer* server, Endpoint* endpoint);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool handleConnected(TRI_socket_t s, ConnectionInfo const& info);
|
bool handleConnected(TRI_socket_t s, ConnectionInfo const& info) override ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -52,19 +52,21 @@ RestAgencyHandler::RestAgencyHandler(HttpRequest* request, Agent* agent)
|
||||||
bool RestAgencyHandler::isDirect() const { return false; }
|
bool RestAgencyHandler::isDirect() const { return false; }
|
||||||
|
|
||||||
inline HttpHandler::status_t RestAgencyHandler::reportErrorEmptyRequest () {
|
inline HttpHandler::status_t RestAgencyHandler::reportErrorEmptyRequest () {
|
||||||
LOG(WARN) << "Empty request to public agency interface.";
|
LOG_TOPIC(WARN, Logger::AGENCY) << "Empty request to public agency interface.";
|
||||||
generateError(HttpResponse::NOT_FOUND,404);
|
generateError(HttpResponse::NOT_FOUND,404);
|
||||||
return HttpHandler::status_t(HANDLER_DONE);
|
return HttpHandler::status_t(HANDLER_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline HttpHandler::status_t RestAgencyHandler::reportTooManySuffices () {
|
inline HttpHandler::status_t RestAgencyHandler::reportTooManySuffices () {
|
||||||
LOG(WARN) << "Too many suffixes. Agency public interface takes one path.";
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
|
<< "Too many suffixes. Agency public interface takes one path.";
|
||||||
generateError(HttpResponse::NOT_FOUND,404);
|
generateError(HttpResponse::NOT_FOUND,404);
|
||||||
return HttpHandler::status_t(HANDLER_DONE);
|
return HttpHandler::status_t(HANDLER_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline HttpHandler::status_t RestAgencyHandler::reportUnknownMethod () {
|
inline HttpHandler::status_t RestAgencyHandler::reportUnknownMethod () {
|
||||||
LOG(WARN) << "Too many suffixes. Agency public interface takes one path.";
|
LOG_TOPIC(WARN, Logger::AGENCY)
|
||||||
|
<< "Public REST interface has no method " << _request->suffix()[0];
|
||||||
generateError(HttpResponse::NOT_FOUND,404);
|
generateError(HttpResponse::NOT_FOUND,404);
|
||||||
return HttpHandler::status_t(HANDLER_DONE);
|
return HttpHandler::status_t(HANDLER_DONE);
|
||||||
}
|
}
|
||||||
|
@ -80,32 +82,54 @@ void RestAgencyHandler::redirectRequest (id_t leaderId) {
|
||||||
inline HttpHandler::status_t RestAgencyHandler::handleWrite () {
|
inline HttpHandler::status_t RestAgencyHandler::handleWrite () {
|
||||||
arangodb::velocypack::Options options; // TODO: User not wait.
|
arangodb::velocypack::Options options; // TODO: User not wait.
|
||||||
if (_request->requestType() == HttpRequest::HTTP_REQUEST_POST) {
|
if (_request->requestType() == HttpRequest::HTTP_REQUEST_POST) {
|
||||||
|
|
||||||
query_t query;
|
query_t query;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
query = _request->toVelocyPack(&options);
|
query = _request->toVelocyPack(&options);
|
||||||
} catch (std::exception const& e) {
|
} catch (std::exception const& e) {
|
||||||
LOG(FATAL) << e.what();
|
LOG_TOPIC(ERR, Logger::AGENCY) << e.what();
|
||||||
generateError(HttpResponse::UNPROCESSABLE_ENTITY,422);
|
generateError(HttpResponse::UNPROCESSABLE_ENTITY,422);
|
||||||
return HttpHandler::status_t(HANDLER_DONE);
|
return HttpHandler::status_t(HANDLER_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_ret_t ret = _agent->write (query);
|
write_ret_t ret = _agent->write (query);
|
||||||
if (ret.accepted) { // We're leading and handling the request
|
|
||||||
|
if (ret.accepted) { // We're leading and handling the request
|
||||||
|
|
||||||
|
std::string call_mode (_request->header("x-arangodb-agency-mode"));
|
||||||
size_t errors = 0;
|
size_t errors = 0;
|
||||||
Builder body;
|
Builder body;
|
||||||
body.add(VPackValue(VPackValueType::Object));
|
body.openObject();
|
||||||
_agent->waitFor (ret.indices.back()); // Wait for confirmation
|
|
||||||
for (size_t i = 0; i < ret.indices.size(); ++i) {
|
if (call_mode!="noWait") {
|
||||||
body.add(std::to_string(i), Value(ret.indices[i]));
|
|
||||||
if (ret.indices[i] == 0) {
|
// Note success/error
|
||||||
errors++;
|
body.add("results", VPackValue(VPackValueType::Array));
|
||||||
|
for (auto const& index : ret.indices) {
|
||||||
|
body.add(VPackValue(index));
|
||||||
}
|
}
|
||||||
|
body.close();
|
||||||
|
|
||||||
|
// Wait for commit of highest except if it is 0?
|
||||||
|
if (call_mode=="waitForCommitted") {
|
||||||
|
index_t max_index =
|
||||||
|
*std::max_element(ret.indices.begin(),ret.indices.end());
|
||||||
|
if (max_index>0) {
|
||||||
|
_agent->waitFor (max_index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.close();
|
body.close();
|
||||||
|
|
||||||
if (errors > 0) { // Some/all requests failed
|
if (errors > 0) { // Some/all requests failed
|
||||||
generateResult(HttpResponse::PRECONDITION_FAILED,body.slice());
|
generateResult(HttpResponse::PRECONDITION_FAILED,body.slice());
|
||||||
} else { // All good
|
} else { // All good
|
||||||
generateResult(body.slice());
|
generateResult(body.slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // Redirect to leader
|
} else { // Redirect to leader
|
||||||
redirectRequest(ret.redirect);
|
redirectRequest(ret.redirect);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +146,7 @@ inline HttpHandler::status_t RestAgencyHandler::handleRead () {
|
||||||
try {
|
try {
|
||||||
query = _request->toVelocyPack(&options);
|
query = _request->toVelocyPack(&options);
|
||||||
} catch (std::exception const& e) {
|
} catch (std::exception const& e) {
|
||||||
LOG(WARN) << e.what();
|
LOG_TOPIC(WARN, Logger::AGENCY) << e.what();
|
||||||
generateError(HttpResponse::BAD,400);
|
generateError(HttpResponse::BAD,400);
|
||||||
return HttpHandler::status_t(HANDLER_DONE);
|
return HttpHandler::status_t(HANDLER_DONE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class RestBatchHandler : public RestVocbaseBaseHandler {
|
||||||
~RestBatchHandler();
|
~RestBatchHandler();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HttpHandler::status_t execute();
|
HttpHandler::status_t execute() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -38,24 +38,24 @@ struct VersionTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~VersionTest() {}
|
~VersionTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) { return true; }
|
bool setUp(SimpleHttpClient* client) override { return true; }
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return _url;
|
return _url;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_GET;
|
return HttpRequest::HTTP_REQUEST_GET;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
static char const* payload = "";
|
static char const* payload = "";
|
||||||
|
|
||||||
*mustFree = false;
|
*mustFree = false;
|
||||||
|
@ -71,15 +71,15 @@ struct DocumentCrudAppendTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~DocumentCrudAppendTest() {}
|
~DocumentCrudAppendTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -94,7 +94,7 @@ struct DocumentCrudAppendTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -113,7 +113,7 @@ struct DocumentCrudAppendTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0 || mod == 2) {
|
if (mod == 0 || mod == 2) {
|
||||||
|
@ -162,15 +162,15 @@ struct DocumentCrudWriteReadTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~DocumentCrudWriteReadTest() {}
|
~DocumentCrudWriteReadTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -185,7 +185,7 @@ struct DocumentCrudWriteReadTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -197,7 +197,7 @@ struct DocumentCrudWriteReadTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -243,15 +243,15 @@ struct ShapesTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~ShapesTest() {}
|
~ShapesTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 3;
|
size_t const mod = globalCounter % 3;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -266,7 +266,7 @@ struct ShapesTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 3;
|
size_t const mod = globalCounter % 3;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -280,7 +280,7 @@ struct ShapesTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 3;
|
size_t const mod = globalCounter % 3;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -329,15 +329,15 @@ struct ShapesAppendTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~ShapesAppendTest() {}
|
~ShapesAppendTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -352,7 +352,7 @@ struct ShapesAppendTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -363,7 +363,7 @@ struct ShapesAppendTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -414,15 +414,15 @@ struct RandomShapesTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~RandomShapesTest() {}
|
~RandomShapesTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 3;
|
size_t const mod = globalCounter % 3;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -438,7 +438,7 @@ struct RandomShapesTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 3;
|
size_t const mod = globalCounter % 3;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -452,7 +452,7 @@ struct RandomShapesTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 3;
|
size_t const mod = globalCounter % 3;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -506,15 +506,15 @@ struct DocumentCrudTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~DocumentCrudTest() {}
|
~DocumentCrudTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 5;
|
size_t const mod = globalCounter % 5;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -529,7 +529,7 @@ struct DocumentCrudTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 5;
|
size_t const mod = globalCounter % 5;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -550,7 +550,7 @@ struct DocumentCrudTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 5;
|
size_t const mod = globalCounter % 5;
|
||||||
|
|
||||||
if (mod == 0 || mod == 2) {
|
if (mod == 0 || mod == 2) {
|
||||||
|
@ -599,15 +599,15 @@ struct EdgeCrudTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~EdgeCrudTest() {}
|
~EdgeCrudTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 3);
|
CreateCollection(client, ARANGOB->collection(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -626,7 +626,7 @@ struct EdgeCrudTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -651,7 +651,7 @@ struct EdgeCrudTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0 || mod == 2) {
|
if (mod == 0 || mod == 2) {
|
||||||
|
@ -700,16 +700,16 @@ struct SkiplistTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~SkiplistTest() {}
|
~SkiplistTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2) &&
|
CreateCollection(client, ARANGOB->collection(), 2) &&
|
||||||
CreateIndex(client, ARANGOB->collection(), "skiplist", "[\"value\"]");
|
CreateIndex(client, ARANGOB->collection(), "skiplist", "[\"value\"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -724,7 +724,7 @@ struct SkiplistTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -743,7 +743,7 @@ struct SkiplistTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0 || mod == 2) {
|
if (mod == 0 || mod == 2) {
|
||||||
|
@ -783,16 +783,16 @@ struct HashTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~HashTest() {}
|
~HashTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2) &&
|
CreateCollection(client, ARANGOB->collection(), 2) &&
|
||||||
CreateIndex(client, ARANGOB->collection(), "hash", "[\"value\"]");
|
CreateIndex(client, ARANGOB->collection(), "hash", "[\"value\"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -807,7 +807,7 @@ struct HashTest : public BenchmarkOperation {
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0) {
|
if (mod == 0) {
|
||||||
|
@ -826,7 +826,7 @@ struct HashTest : public BenchmarkOperation {
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 4;
|
size_t const mod = globalCounter % 4;
|
||||||
|
|
||||||
if (mod == 0 || mod == 2) {
|
if (mod == 0 || mod == 2) {
|
||||||
|
@ -881,27 +881,27 @@ struct DocumentImportTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~DocumentImportTest() { TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer); }
|
~DocumentImportTest() { TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer); }
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return _url;
|
return _url;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
*mustFree = false;
|
*mustFree = false;
|
||||||
*length = _length;
|
*length = _length;
|
||||||
return (char const*)_buffer->_buffer;
|
return (char const*)_buffer->_buffer;
|
||||||
|
@ -941,27 +941,27 @@ struct DocumentCreationTest : public BenchmarkOperation {
|
||||||
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer);
|
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, _buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return _url;
|
return _url;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
*mustFree = false;
|
*mustFree = false;
|
||||||
*length = _length;
|
*length = _length;
|
||||||
return (char const*)_buffer->_buffer;
|
return (char const*)_buffer->_buffer;
|
||||||
|
@ -981,24 +981,24 @@ struct CollectionCreationTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~CollectionCreationTest() {}
|
~CollectionCreationTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) { return true; }
|
bool setUp(SimpleHttpClient* client) override { return true; }
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return _url;
|
return _url;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
char* data;
|
char* data;
|
||||||
|
|
||||||
|
@ -1033,7 +1033,7 @@ struct TransactionAqlTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~TransactionAqlTest() {}
|
~TransactionAqlTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
_c1 = std::string(ARANGOB->collection() + "1");
|
_c1 = std::string(ARANGOB->collection() + "1");
|
||||||
_c2 = std::string(ARANGOB->collection() + "2");
|
_c2 = std::string(ARANGOB->collection() + "2");
|
||||||
_c3 = std::string(ARANGOB->collection() + "3");
|
_c3 = std::string(ARANGOB->collection() + "3");
|
||||||
|
@ -1043,22 +1043,22 @@ struct TransactionAqlTest : public BenchmarkOperation {
|
||||||
CreateCollection(client, _c2, 2) && CreateCollection(client, _c3, 2);
|
CreateCollection(client, _c2, 2) && CreateCollection(client, _c3, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/cursor");
|
return std::string("/_api/cursor");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 8;
|
size_t const mod = globalCounter % 8;
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
@ -1127,27 +1127,27 @@ struct TransactionCountTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~TransactionCountTest() {}
|
~TransactionCountTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/transaction");
|
return std::string("/_api/transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
|
||||||
|
@ -1177,7 +1177,7 @@ struct TransactionDeadlockTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~TransactionDeadlockTest() {}
|
~TransactionDeadlockTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
_c1 = std::string(ARANGOB->collection() + "1");
|
_c1 = std::string(ARANGOB->collection() + "1");
|
||||||
_c2 = std::string(ARANGOB->collection() + "2");
|
_c2 = std::string(ARANGOB->collection() + "2");
|
||||||
|
|
||||||
|
@ -1187,22 +1187,22 @@ struct TransactionDeadlockTest : public BenchmarkOperation {
|
||||||
CreateDocument(client, _c2, "{ \"_key\": \"sum\", \"count\": 0 }");
|
CreateDocument(client, _c2, "{ \"_key\": \"sum\", \"count\": 0 }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/transaction");
|
return std::string("/_api/transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
@ -1246,7 +1246,7 @@ struct TransactionMultiTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~TransactionMultiTest() {}
|
~TransactionMultiTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
_c1 = std::string(ARANGOB->collection() + "1");
|
_c1 = std::string(ARANGOB->collection() + "1");
|
||||||
_c2 = std::string(ARANGOB->collection() + "2");
|
_c2 = std::string(ARANGOB->collection() + "2");
|
||||||
|
|
||||||
|
@ -1256,22 +1256,22 @@ struct TransactionMultiTest : public BenchmarkOperation {
|
||||||
CreateDocument(client, _c2, "{ \"_key\": \"sum\", \"count\": 0 }");
|
CreateDocument(client, _c2, "{ \"_key\": \"sum\", \"count\": 0 }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/transaction");
|
return std::string("/_api/transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
size_t const mod = globalCounter % 2;
|
size_t const mod = globalCounter % 2;
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
@ -1330,7 +1330,7 @@ struct TransactionMultiCollectionTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~TransactionMultiCollectionTest() {}
|
~TransactionMultiCollectionTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
_c1 = std::string(ARANGOB->collection() + "1");
|
_c1 = std::string(ARANGOB->collection() + "1");
|
||||||
_c2 = std::string(ARANGOB->collection() + "2");
|
_c2 = std::string(ARANGOB->collection() + "2");
|
||||||
|
|
||||||
|
@ -1338,22 +1338,22 @@ struct TransactionMultiCollectionTest : public BenchmarkOperation {
|
||||||
CreateCollection(client, _c1, 2) && CreateCollection(client, _c2, 2);
|
CreateCollection(client, _c1, 2) && CreateCollection(client, _c2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/transaction");
|
return std::string("/_api/transaction");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
|
||||||
|
@ -1406,27 +1406,27 @@ struct AqlInsertTest : public BenchmarkOperation {
|
||||||
|
|
||||||
~AqlInsertTest() {}
|
~AqlInsertTest() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/cursor");
|
return std::string("/_api/cursor");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
|
||||||
|
@ -1460,27 +1460,27 @@ struct AqlV8Test : public BenchmarkOperation {
|
||||||
|
|
||||||
~AqlV8Test() {}
|
~AqlV8Test() {}
|
||||||
|
|
||||||
bool setUp(SimpleHttpClient* client) {
|
bool setUp(SimpleHttpClient* client) override {
|
||||||
return DeleteCollection(client, ARANGOB->collection()) &&
|
return DeleteCollection(client, ARANGOB->collection()) &&
|
||||||
CreateCollection(client, ARANGOB->collection(), 2);
|
CreateCollection(client, ARANGOB->collection(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() {}
|
void tearDown() override {}
|
||||||
|
|
||||||
std::string url(int const threadNumber, size_t const threadCounter,
|
std::string url(int const threadNumber, size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return std::string("/_api/cursor");
|
return std::string("/_api/cursor");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest::HttpRequestType type(int const threadNumber,
|
HttpRequest::HttpRequestType type(int const threadNumber,
|
||||||
size_t const threadCounter,
|
size_t const threadCounter,
|
||||||
size_t const globalCounter) {
|
size_t const globalCounter) override {
|
||||||
return HttpRequest::HTTP_REQUEST_POST;
|
return HttpRequest::HTTP_REQUEST_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* payload(size_t* length, int const threadNumber,
|
char const* payload(size_t* length, int const threadNumber,
|
||||||
size_t const threadCounter, size_t const globalCounter,
|
size_t const threadCounter, size_t const globalCounter,
|
||||||
bool* mustFree) {
|
bool* mustFree) override {
|
||||||
TRI_string_buffer_t* buffer;
|
TRI_string_buffer_t* buffer;
|
||||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@ namespace arangodb {
|
||||||
|
|
||||||
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
||||||
public:
|
public:
|
||||||
virtual void* Allocate(size_t length) {
|
virtual void* Allocate(size_t length) override {
|
||||||
void* data = AllocateUninitialized(length);
|
void* data = AllocateUninitialized(length);
|
||||||
return data == nullptr ? data : memset(data, 0, length);
|
return data == nullptr ? data : memset(data, 0, length);
|
||||||
}
|
}
|
||||||
virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
|
virtual void* AllocateUninitialized(size_t length) override { return malloc(length); }
|
||||||
virtual void Free(void* data, size_t) { free(data); }
|
virtual void Free(void* data, size_t) override { free(data); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class V8PlatformFeature final : public application_features::ApplicationFeature {
|
class V8PlatformFeature final : public application_features::ApplicationFeature {
|
||||||
|
|
|
@ -725,7 +725,7 @@ class LogThread : public Thread {
|
||||||
~LogThread() { shutdown(); }
|
~LogThread() { shutdown(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void run();
|
void run() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void LogThread::run() {
|
void LogThread::run() {
|
||||||
|
@ -788,6 +788,7 @@ LoggerStream::~LoggerStream() {
|
||||||
/// @brief predefined topics
|
/// @brief predefined topics
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LogTopic Logger::AGENCY("agency", LogLevel::INFO);
|
||||||
LogTopic Logger::COLLECTOR("collector");
|
LogTopic Logger::COLLECTOR("collector");
|
||||||
LogTopic Logger::COMPACTOR("compactor");
|
LogTopic Logger::COMPACTOR("compactor");
|
||||||
LogTopic Logger::CONFIG("config");
|
LogTopic Logger::CONFIG("config");
|
||||||
|
|
|
@ -271,6 +271,7 @@ class Logger {
|
||||||
/// @brief predefined topics
|
/// @brief predefined topics
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static LogTopic AGENCY;
|
||||||
static LogTopic COLLECTOR;
|
static LogTopic COLLECTOR;
|
||||||
static LogTopic COMPACTOR;
|
static LogTopic COMPACTOR;
|
||||||
static LogTopic CONFIG;
|
static LogTopic CONFIG;
|
||||||
|
|
Loading…
Reference in New Issue