Skip to content
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

Fixes #19248: Empty /var/rudder/policy-generation-info/node-configuration-hashes.json after a policy generation that changed nothing #3637

Conversation

fanf
Copy link
Member

@fanf fanf commented May 10, 2021

@fanf fanf requested a review from ncharles May 10, 2021 20:48
Copy link
Member

@ncharles ncharles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the filterNot is overcomplicating the method


sequential

"when nothing was written, we should get an empty succe" >> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"when nothing was written, we should get an empty succe" >> {
"when nothing was written, we should get an empty success" >> {

else semaphore.withPermits(1) {
for {
current <- nonAtomicRead()
filtered = current.hashes.filterNot(h => nodeIds.contains(h.id))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm unsure tht you need this one: you are traversing current.hashes , and n times the nodeIds

doing simply (filtered ++ hashes).toList.sortBy(_.id.value) would yield the same result

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, filtered is a list, not a map, and hashes is not a map either, so I will have several node config hashes for the same node Id.
I would need to do current.hashes.map(h => (h.id, h)).toMap, same for hashes, so two traverse, and one more (more coslty) for the map merge.

@fanf
Copy link
Member Author

fanf commented May 10, 2021

PR updated with a new commit

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/3637
-- Your faithful QA
Kant merge: "Science is organized knowledge. Wisdom is organized life."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/38727/console)

@fanf
Copy link
Member Author

fanf commented May 10, 2021

OK, squash merging this PR

…tion-hashes.json after a policy generation that changed nothing
@fanf fanf force-pushed the bug_19248/empty_var_rudder_policy_generation_info_node_configuration_hashes_json_after_a_policy_generation_that_changed_nothing branch from 35e923c to 1a51078 Compare May 10, 2021 21:09
@fanf fanf merged commit 1a51078 into Normation:branches/rudder/6.1 May 10, 2021
@fanf fanf deleted the bug_19248/empty_var_rudder_policy_generation_info_node_configuration_hashes_json_after_a_policy_generation_that_changed_nothing branch March 15, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants