-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Use DirectoryStream paths in java 7 to traverse the users. #2251
Conversation
With the move to Java 7 the nio2 library is made available for usage. The DirectoryStream api allows for a more effeicient method of walking the directory tree structure. This fixes a potential performance issue where there are several thousand users in the $JENKINS_HOME/users directory which are still on the legacy format for user ids. This uses the NIO2 methods for doing the tree walk and moving the directories into the correct locations.
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
new Object[]{legacyUserDir, configFile.getParentFile()}); | ||
|
||
try { | ||
DirectoryStream<Path> legacy = getLegacyConfigFilesFor(id); |
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.
🐛 legacy
is not closed. Use try-with-resources.
I think the failing unit test is part of these code changes. Marking as WIP. |
What is the motivation behind this change? The code in question is only ever run once, during an upgrade from an old Jenkins version. Do we really care about optimizing it? |
@jglick I've seen this triggered via the api (with the git plugin). |
JENKINS-47429 seems to track this issue. |
Obsolete as of #3150. |
With the move to Java 7 the nio2 library is made available for usage. The DirectoryStream api allows for a more effeicient method of walking the directory tree structure. This fixes a potential performance issue where there are several thousand users in the $JENKINS_HOME/users directory which are still on the legacy format for user ids. This uses the NIO2 methods for doing the tree walk and moving the directories into the correct locations.
@reviewbybees