8000 Agency hasAsXXX using std::optional by maierlars · Pull Request #14376 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Agency hasAsXXX using std::optional #14376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed two cases of bad optional access
  • Loading branch information
goedderz committed Jul 6, 2021
commit 5505ba83c1ae535d219e44f7979939f754a7323c
7 changes: 5 additions & 2 deletions arangod/Agency/Supervision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,8 @@ void Supervision::reportStatus(std::string const& status) {

{ // Do I have to report to agency under
_lock.assertLockedByCurrentThread();
if (snapshot().hasAsString("/Supervision/State/Mode").value() != status) {
if (auto modeString = snapshot().hasAsString("/Supervision/State/Mode");
!modeString || modeString.value() != status) {
// This includes the case that the mode is not set, since status
// is never empty
persist = true;
Expand Down Expand Up @@ -1723,7 +1724,9 @@ void arangodb::consensus::cleanupHotbackupTransferJobsFunctional(
constexpr uint64_t maximalNumberTransferJobs = 100;
constexpr char const* prefix = "/Target/HotBackup/TransferJobs/";

auto const& jobs = snapshot.hasAsChildren(prefix).value().get();
auto static const noJobs = Node::Children{};
auto const jobs = snapshot.hasAsChildren(prefix).value_or(noJobs).get();

if (jobs.size() <= maximalNumberTransferJobs + 6) {
// We tolerate some more jobs before we take action. This is to
// avoid that we go through all jobs every second. Oasis takes
Expand Down
0