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
8275185: Remove dead code and clean up jvmstat LocalVmManager #5923
8275185: Remove dead code and clean up jvmstat LocalVmManager #5923
Conversation
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
Webrevs
|
/** | ||
* The directory name pattern for the user directories. | ||
*/ | ||
public static final String userDirNamePattern = "hsperfdata_\\S*"; | ||
|
||
/** | ||
* The file name pattern for PerfData shared memory files. | ||
* <p> | ||
* This pattern must be kept in synch with the file name pattern | ||
* used by the 1.4.2 and later HotSpot JVM. | ||
*/ | ||
public static final String fileNamePattern = "^[0-9]+$"; | ||
|
||
/** | ||
* The file name pattern for 1.4.1 PerfData shared memory files. | ||
* <p> | ||
* This pattern must be kept in synch with the file name pattern | ||
* used by the 1.4.1 HotSpot JVM. | ||
*/ | ||
public static final String tmpFileNamePattern = | ||
"^hsperfdata_[0-9]+(_[1-2]+)?$"; | ||
|
||
|
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 don't understand why you thought it best to remove these and instead use hard coded references to these partterns.
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 have two goals
- these aren't used anywhere else, so it's better to at least move them from this file to LocalVmManager.java, where they are actually used. So you don't need to flip between two files.
- the behavior is easier to understand if the string literals, comments, and the code that uses them are together.
Note that the original code has plenty of comment that are rather useless if you want to know how the files are searched.
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.
ok
/** | ||
* The directory name pattern for the user directories. | ||
*/ | ||
public static final String userDirNamePattern = "hsperfdata_\\S*"; | ||
|
||
/** | ||
* The file name pattern for PerfData shared memory files. | ||
* <p> | ||
* This pattern must be kept in synch with the file name pattern | ||
* used by the 1.4.2 and later HotSpot JVM. | ||
*/ | ||
public static final String fileNamePattern = "^[0-9]+$"; | ||
|
||
/** | ||
* The file name pattern for 1.4.1 PerfData shared memory files. | ||
* <p> | ||
* This pattern must be kept in synch with the file name pattern | ||
* used by the 1.4.1 HotSpot JVM. | ||
*/ | ||
public static final String tmpFileNamePattern = | ||
"^hsperfdata_[0-9]+(_[1-2]+)?$"; | ||
|
||
|
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.
ok
} | ||
} | ||
} | ||
// 1.4.2 and later: Look for the files {tmpdir}/hsperfdata_{any_user_name}/[0-0]+ |
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.
should be [0-9]+
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.
tmpFileFilter = new FilenameFilter() { | ||
// 1.4.1 (or earlier?): the files are stored directly under {tmpdir}/ with | ||
// the following pattern. | ||
Pattern oldtmpFilePattern = Pattern.compile("^hsperfdata_[0-9]+(_[1-2]+)?$"); |
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.
So this pattern optionally has _
followed by a sequence of 1's and 2's at the end? Seems odd.
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 restored this line to use PerfDataFile.tmpFileNamePattern, as before my changes. Yes, that's an odd way of naming a file.
Hi Ioi, |
Nice cleanup - although was it not better for PerfDataFile.java to "own" the definitions of what a perfdata filename looks like? |
…NamePattern, etc. (2) Fixed comments
I am not sure about 1.4.2 formats. I guess we don't really care, but we should probably remove it in a separate RFE. I am trying to keep this PR from having any functional changes, and will just remove dead code. For testing, I am running tiers 1-4. Will that be enough? I'll ping the performance team. Thanks
|
Hi Kevin, thanks for the review. I've moved the filename patterns back to PerfDataFile.java as you suggested. |
…-remove-dead-code
@iklam This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 30 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
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.
Supporting 1.4.1 hsperfdata seems pointless at this point, so I support a removal of that code. It also seems reasonable to do as a follow-up, as @iklam suggests, rather than shifting the scope this PR.
Thanks, looks good! |
Thanks @plummercj @kevinjwalls @cl4es for the review. I filed https://bugs.openjdk.java.net/browse/JDK-8276687 to remove the JDK 1.4.1 support. |
Going to push as commit 8e17ce0.
Your commit was automatically rebased without conflicts. |
Hi Ioi, |
Thanks Serguei! |
LocalVmManager and PerfDataFile have APIs that are supposed to look for VMs owned by a specific user. No one uses these APIs, and they don't work anyway.
The current code is very confusing to look at. Since we're likely to change code in this area for further container support, it's better to clean up the code now.
userFilter
to make the code more readableTesting with Oracle CI: tiers1-4, plus hs-tier5-rt (which tests containers and have extensive use of the management tools).
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5923/head:pull/5923
$ git checkout pull/5923
Update a local copy of the PR:
$ git checkout pull/5923
$ git pull https://git.openjdk.java.net/jdk pull/5923/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5923
View PR using the GUI difftool:
$ git pr show -t 5923
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5923.diff