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 #17237: Do not compute dynamic groups if nothing changed in LDAP #2931

Conversation

fanf
Copy link
Member

@fanf fanf commented Apr 24, 2020

@fanf fanf requested a review from ncharles April 24, 2020 21:51

override def changesSince(lastTime: DateTime): Box[Boolean] = {
val n0 = System.currentTimeMillis
if(n0 < lastTime.getMillis || n0 - lastTime.getMillis < 100) {
Copy link
Member

Choose a reason for hiding this comment

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

does that mean a change in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes, it's not usefull in fact (because if the first is true, the second is also). I will remove it.

, AND(IS(OC_RUDDER_NODE), Filter.create(s"entryDN:dnOneLevelMatch:=ou=Nodes,cn=rudder-configuration"))
, AND(IS(OC_RUDDER_NODE_GROUP), Filter.create(s"entryDN:dnSubtreeMatch:=groupCategoryId=GroupRoot,ou=Rudder,cn=rudder-configuration"))
)
, GTEQ("modifyTimestamp", GeneralizedTime(lastTime).toString)
Copy link
Member

Choose a reason for hiding this comment

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

we don't have index for that. It will be really costly on ldap

Copy link
Member

Choose a reason for hiding this comment

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

also, is there a way to stop the query if one result is found ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's actually stop on the first (or second?) hit, so it is (a bit, but still much less that group search) costly only if there's no modifications. We do something very similar for cache, and it's quite fast.
(openldap seem to be very efficient in pruning entries that he don't care on that. The fact that keys are sorted in mdb may be the reason, I don't know).

@fanf
Copy link
Member Author

fanf commented Apr 25, 2020

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/2931
-- Your faithful QA
Kant merge: "To be is to do."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/23751/console)

@fanf
Copy link
Member Author

fanf commented Apr 26, 2020

OK, squash merging this PR

@fanf fanf force-pushed the ust_17237/do_not_compute_dynamic_groups_if_nothing_changed_in_ldap branch from 87f4d4d to 3164d5b Compare April 26, 2020 16:33
@fanf fanf merged commit 3164d5b into Normation:branches/rudder/6.1 Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants