diff --git a/arangod/Agency/Agent.cpp b/arangod/Agency/Agent.cpp index 687bc6e6ac..ce7a4bc917 100644 --- a/arangod/Agency/Agent.cpp +++ b/arangod/Agency/Agent.cpp @@ -230,9 +230,13 @@ append_entries_t Agent::sendAppendEntriesRPC (id_t follower_id) { index_t last_confirmed = _confirmed[follower_id]; std::vector unconfirmed = _state.get(last_confirmed); + MUTEX_LOCKER(mutexLocker, _ioLock); + + term_t t = this->term(); + // RPC path std::stringstream path; - path << "/_api/agency_priv/appendEntries?term=" << term() << "&leaderId=" + path << "/_api/agency_priv/appendEntries?term=" << t << "&leaderId=" << id() << "&prevLogIndex=" << unconfirmed[0].index << "&prevLogTerm=" << unconfirmed[0].term << "&leaderCommit=" << _last_commit_index; @@ -267,7 +271,7 @@ append_entries_t Agent::sendAppendEntriesRPC (id_t follower_id) { std::make_shared(this, follower_id, last), 0, true); - return append_entries_t(this->term(), true); + return append_entries_t(t, true); } diff --git a/arangod/Agency/State.cpp b/arangod/Agency/State.cpp index 712d995015..3a616d8fb2 100644 --- a/arangod/Agency/State.cpp +++ b/arangod/Agency/State.cpp @@ -82,18 +82,11 @@ bool State::persist(index_t index, term_t term, id_t lid, //Leader std::vector State::log ( query_t const& query, std::vector const& appl, term_t term, id_t lid) { - if (!checkCollections()) { - createCollections(); - } - if (!_collections_loaded) { - loadCollections(); - _collections_loaded = true; - } - // TODO: Check array std::vector idx(appl.size()); std::vector good = appl; size_t j = 0; + MUTEX_LOCKER(mutexLocker, _logLock); // log entries must stay in order for (auto const& i : VPackArrayIterator(query->slice())) { if (good[j]) {