-
Notifications
You must be signed in to change notification settings - Fork 578
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
Checkable: Don't skip redundancy group checks for parent dependencies #10228
base: master
Are you sure you want to change the base?
Conversation
4ad59ed
to
492621a
Compare
lib/icinga/checkable-dependency.cpp
Outdated
@@ -78,10 +73,14 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency | |||
std::unordered_map<std::string, Dependency::Ptr> violated; // key: redundancy group, value: nullptr if satisfied, violating dependency otherwise | |||
|
|||
for (const Dependency::Ptr& dep : deps) { | |||
std::string redundancy_group = dep->GetRedundancyGroup(); | |||
bool parentReachable{true}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of {} here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is to initialise the variable, honestly I don't even understand why you are asking. If you see something wrong with it, then please explain, but what am I supposed to say to such a vague question.
lib/icinga/checkable-dependency.cpp
Outdated
std::string redundancy_group = dep->GetRedundancyGroup(); | ||
bool parentReachable{true}; | ||
if (Checkable::Ptr parent = dep->GetParent(); parent.get() != this) { | ||
parentReachable = parent->IsReachable(dt, failedDependency, rstack + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly other construction area, but while on it, you could increment rstack just once before the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, because currently the sum of all direct and intermediate dependencies is limited to 256
. You want me to change this so that the limit applies to each dependency object individually? I can do this, but as you already said, it's not related to this issue.
492621a
to
ddc9e46
Compare
ddc9e46
to
cab27fc
Compare
lib/icinga/checkable-dependency.cpp
Outdated
@@ -78,9 +73,10 @@ bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency | |||
std::unordered_map<std::string, Dependency::Ptr> violated; // key: redundancy group, value: nullptr if satisfied, violating dependency otherwise | |||
|
|||
for (const Dependency::Ptr& dep : deps) { | |||
std::string redundancy_group = dep->GetRedundancyGroup(); | |||
bool parentReachable(dep->GetParent()->IsReachable(dt, failedDependency, rstack + 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And now you could even inline that variable's value...
lib/icinga/checkable-dependency.cpp
Outdated
|
||
if (!dep->IsAvailable(dt)) { | ||
std::string redundancy_group = dep->GetRedundancyGroup(); | ||
if (!parentReachable || !dep->IsAvailable(dt)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... here.
Previously, all parent dependencies were recursively checked right at the beginning of `Checkable::IsReachable()` for reachability and immediately returned `false` if one of them fails. However, since the introduction of `redundancy_group`, that failed parent might be within a redundancy group, which shouldn't necessarily cause the dependency to fail completely. This PR changes this insofar as not all parents are checked at the beginning of the method, but only a single parent per a dependency object is evaluated.
cab27fc
to
af33327
Compare
Previously, all parent dependencies were recursively checked right at the beginning of
Checkable::IsReachable()
for reachability and immediately returnedfalse
if one of them fails. However, since the introduction ofredundancy_group
, that failed parent might be within a redundancy group, which shouldn't necessarily cause the dependency to fail completely. This PR changes this insofar as not all parents are checked at the beginning of the method, but only a single parent per a dependency object is evaluated.Tests
Icinga 2 Config
Before
Now, change the dummy state for the
mother
Host tovars.dummy_state = 0
.After
Now, change the dummy state for the
mother
Host tovars.dummy_state = 0
.fixes #10014