-
Notifications
You must be signed in to change notification settings - Fork 84
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
Issue 5701 - CLI - Fix referral mode setting #5708
Conversation
Bug Description: Referral mode not working and failing with error: ERROR: Error: 103 - 10 - 53 - Server is unwilling to perform - [] - need to set nsslapd-referral It happens because in CLI, we set nsslapd-referral to the backend when it should be set to "cn=mapping tree". Fix description: Set the attribute to the correct object. Add get_state and set_state custom functions to BackendSuffixView. Fix minor typos. Fixes: 389ds#5701 Reviewed by: ?
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 overall patch looks good, just a question regarding replicated mapping tree.
try: | ||
# Check if replication is enabled | ||
replicas.get(suffix) | ||
raise ValueError("Can not change the backend state of a replicated suffix") |
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.
I am unsure to understand this restriction. If I have a consumer/hub, its mapping tree will eventually be 'referral on update'. With this test, will it be possible to set a consumer/hub mapping tree on 'referral on update' ?
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.
It was added some time ago here by Mark:
https://github.com/389ds/389-ds-base/blob/main/src/lib389/lib389/backend.py#L895
I got it from there to preserve the existing behaviour. :)
@mreynolds389 do you recall the reason for the check?
Is it adjusted automatically for consumer/hub mapping tree?
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.
I recall it being a requirement. Does it cause any problems?
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.
@mreynolds389 , if it is called for a replicated backend with mt.set_state('referral on update') then it will raise the exception "Can not change the backend state of a replicated suffix". IIRC for a consumer/hub nsslapd-state needs to be 'referral on update' will it be done ?
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.
I think that the restriction is fine. There is no hard requirement but the replication plugin regularly resets that state trough repl_set_mtn_state_and_referrals, so allowing an user to set the mapping tree state on a replica is very tricky:
An administrator may think he set safely the backend in read-only mode
but replication may reset it to rw mode behind the scene ...
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.
Good point. Indeed the server itself may reset the state, mainly as referral if REPLICA_TYPE_READONLY and also during total update.
However I still have a doubt as this patch is about a CLI enhancement to allow an administrator to switch a backend/suffix into a referral (see 'Creating suffix referrals'). The is no documented restriction regarding replication.
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.
Opps... my mistake. I realize I missed your point @progier389 . Setting referral/backend on a replicated suffix is useless because it will be reset. You are correct.
The procedure in admin guide should state that it does not apply on replicated suffix.
The patch is good. Ack
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.
Thanks for the explanations. ACK
Bug Description: Referral mode not working and failing with error: ERROR: Error: 103 - 10 - 53 - Server is unwilling to perform - [] - need to set nsslapd-referral It happens because in CLI, we set nsslapd-referral to the backend when it should be set to "cn=mapping tree".
Fix description: Set the attribute to the correct object. Add get_state and set_state custom functions to BackendSuffixView. Fix minor typos.
Fixes: #5701
Reviewed by: ?