-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[AMBARI-22668] Moving LDAP related properties to DB upon upgrade to 3.0.0 #106
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
Conversation
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.
maybe anyMatch() would be shorter
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.
This implementation also removes properties with prefix and/or suffix, eg. security.server.crt_pass would match security.server.crt_pass_file, too, due to using indexOf(). It may not be a problem in this use case, but I think it should be addressed, since it is a generic method.
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.
Fixed
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.
This implementation also removes properties with prefix and/or suffix, eg. security.server.crt_pass would match security.server.crt_pass_file, too, due to using indexOf(). It may not be a problem in this use case, but I think it should be addressed, since it is a generic method.
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.
typo in ambari_congiuration
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.
Fixed
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.
Deleting the file before writing the new one may lead to data loss.
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.
Fixed
1da6105 to
581059a
Compare
|
Refer to this link for build results (access rights to CI server needed): |
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 changes.
One more request: please do not force-push to the source branch of pull requests, since it makes it harder to see what previous comments were about (and how the comments were addressed). Instead, please push additional commits. They can be squashed during merge if a single commit on the target branch is desired.
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.
Upgrade logic should be idempotent:
- Running upgrade on already upgraded setup should be no-op (no errors etc.). I guess this is the case, since properties removed at the end will not be processed on next try.
- Retrying partially completed upgrade should resume without errors. This might be a problem here, since all properties are left until the end, duplicate properties may be created. Can you please confirm if this handled correctly? (Test by throwing some exception in the middle of property processing.) If not, can you please make sure to "create or update" the properties instead of "create".
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.
These are good notices; thanks for bringing them up.
Point 1: like you indicated there won't be more properties to be upgraded = no-op
Point 2: I'll check it out and modify the code if needed
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.
Fixed
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.
You should use org.apache.ambari.server.configuration.Configuration#readConfigFile to read the properties from the ambari.properties file into a java.util.Properties object. Then later write out the properties using org.apache.ambari.server.configuration.Configuration#writeConfigFile (which does not yet exist).
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.
Can java.net.URL be used instead?
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.
Using HostAndPort from Guava instead
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.
Can java.net.URL be used instead?
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.
Using HostAndPort from Guava instead
|
Refer to this link for build results (access rights to CI server needed): |
0a8c52b to
a1cd1a0
Compare
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
0508d66 to
1e5d726
Compare
|
Removed my commit which fixed the JUnit tests since @adoroszlai fixed it in #118 |
|
Refer to this link for build results (access rights to CI server needed): |
|
Tests have been passed. Could someone with the proper privileges merge this PR? |
@rlevas @zeroflag @echekanskiy Please review
What changes were proposed in this pull request?
According to the requirement I needed to move LDAP related properties out from ambari.properties file into our DB table called ambari_configuration with 'ldap-configuration' category name when upgrading to 3.0.0.
How was this patch tested?
Unit test were added and adopted; local build result:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:37 h
[INFO] Finished at: 2018-01-12T13:40:34+01:00
[INFO] Final Memory: 207M/802M
[INFO] ------------------------------------------------------------------------
Besides unit testing the following integration test has been executed: