10000 Fix a crash found by the agency torturer. (#6591) · mnemosdev/arangodb@2b59eca · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b59eca

Browse files
authored
Fix a crash found by the agency torturer. (arangodb#6591)
1 parent e78df55 commit 2b59eca

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

arangod/Agency/Agent.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,13 +927,24 @@ void Agent::lastAckedAgo(Builder& ret) const {
927927
VPackObjectBuilder b(&ret);
928928
for (auto const& i : lastAcked) {
929929
auto lsit = lastSent.find(i.first);
930+
// Note that it is possible that a server is already in lastAcked
931+
// but not yet in lastSent, since lastSent only has times of non-empty
932+
// appendEntriesRPC calls, but we also get lastAcked entries for the
933+
// empty ones.
930934
ret.add(VPackValue(i.first));
931935
{ VPackObjectBuilder o(&ret);
932936
ret.add("lastAckedTime", VPackValue(dur2str(i)));
933937
ret.add("lastAckedIndex", VPackValue(confirmed.at(i.first)));
934938
if (i.first != id()) {
935-
ret.add("lastAppend", VPackValue(dur2str(*lsit)));
936-
}}
939+
if (lsit != lastSent.end()) {
940+
ret.add("lastAppend", VPackValue(dur2str(*lsit)));
941+
} else {
942+
ret.add("lastAppend", VPackValue(dur2str(i)));
943+
// This is just for the above mentioned case, which will very
944+
// soon be rectified.
945+
}
946+
}
947+
}
937948
}
938949
}
939950

0 commit comments

Comments
 (0)
0