-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Write separate statefiles per prefix. #6855
Write separate statefiles per prefix. #6855
Conversation
3800e01
to
204306d
Compare
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.
A couple comments.
Unrelated failure on Appveyor and it doesn't appear to have "Rebuild" buttons like Travis, so closing/reopening. |
Yea, AppVeyor <-> GitHub permissions is weird. I think one needs to be an Admin on AppVeyor at the organization level to do that. Aside, if you see an unrelated failure from our test suite (not the CI's bootstrapping/setup) please file an issue -- ideally our tests would be reasonably resilient to the occasional network issues, system-specific configuration and cosmic-ray-induced bit flips. Okay, maybe not that last one. |
👍 @cjerdonek, any other comments or concerns? |
ece6aac
to
7d1034e
Compare
Since we are in a prefix-specific state file, we no longer need to have a top-level map keyed by prefix and can have a simple flat structure.
7d1034e
to
c91af0d
Compare
Refactored and split into separate commits so it should hopefully be easier to review. Please forgive my mess before. 🙏 |
I haven't read the thread about the underlying rationale, but on the surface the code and change looks okay to me. My only question / concern is around the length of the filename (79 characters). I'm wondering if that could ever cause problems. It doesn't strike me as something that needs cryptographic strength, but again, I haven't read the thread to know for sure. |
The only property we need is being able to map to the same file, unique per prefix, independently on each invocation of the same pip. A cryptographically secure hash requires less consideration than one that may be considered broken or insecure, so it's a reasonable default IMO. I could switch to sha224 as used in cache control, which would bring our path length to 70 (comparable to the 66 used for one of our http cache entries, which are kept in the same directory). |
I have switched to sha224, moved the files to a subdirectory, and dropped the file extension. Now the file path length should be the same as for any of our HTTP cache files. |
b012c09
to
5f4da50
Compare
@cjerdonek, in case there are any concerns I have submitted #6879 so it is more clear where this is going and how it is related to #4766. Specifically, once we simplify our usage of the selfcheck state file from "read, merge, write" to just "write" then we do not need file locking and can just overwrite the file. |
I appreciate the thought and additional write-up though! If I can get to it, it will help me get up to speed on what you're planning. |
If it's okay, we can treat this PR independently of the underlying lockfile issue (similar to #6845). I think it's only necessary to consider it in the context of the larger issue if there's not enough justification for these changes on their own. |
The discussion on #6879 indicates that the general approach is OK, and it is just a matter of deciding where to put the new utility methods. We will need the changes from this PR regardless of the outcome of that decision. |
OK to merge? |
@chrahunt yep! |
Previously, we kept selfcheck info for all pip instances in the same file.
Now, we use a separate file per pip instance, simplifying the process of recording updated state.
Also added several tests that are a little less intrusive into the selfcheck implementation details.
Makes progress on #6954.