mirror of https://gitee.com/bigwinds/arangodb
implementing code review
This commit is contained in:
parent
d0deac1298
commit
3d59a0b3c5
|
@ -230,9 +230,13 @@ append_entries_t Agent::sendAppendEntriesRPC (id_t follower_id) {
|
|||
index_t last_confirmed = _confirmed[follower_id];
|
||||
std::vector<log_t> 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<AgentCallback>(this, follower_id, last),
|
||||
0, true);
|
||||
|
||||
return append_entries_t(this->term(), true);
|
||||
return append_entries_t(t, true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -82,18 +82,11 @@ bool State::persist(index_t index, term_t term, id_t lid,
|
|||
//Leader
|
||||
std::vector<index_t> State::log (
|
||||
query_t const& query, std::vector<bool> const& appl, term_t term, id_t lid) {
|
||||
if (!checkCollections()) {
|
||||
createCollections();
|
||||
}
|
||||
if (!_collections_loaded) {
|
||||
loadCollections();
|
||||
_collections_loaded = true;
|
||||
}
|
||||
|
||||
// TODO: Check array
|
||||
std::vector<index_t> idx(appl.size());
|
||||
std::vector<bool> 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]) {
|
||||
|
|
Loading…
Reference in New Issue