-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use a GUID when creating the temp path #4645
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
52f321d
Use a GUID when creating the temp path
jwood803 280e9ad
Update where the GUID is in the temp path
jwood803 fc636e4
Remove braces
jwood803 c29a00b
Use random file name instead of GUID
jwood803 0f06dfb
Switch to concurrent dictionary
jwood803 ca78b2c
TryAdd updates
jwood803 34c7bb2
Merge branch 'master' into temp-files
jwood803 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 current function here,
GetPath()
, creates the path. It's called below inCreateEntry()
:machinelearning/src/Microsoft.ML.Core/Data/Repository.cs
Lines 335 to 339 in c29a00b
There another minor race condition in how the new path is being checked/added to the dictionary. It's a nit, and minor enough to ignore if you want.
If we want to handle in this PR, we could fix by either adding a lock around the IF/ELSE, or by moving to a ConcurrentDictionary and using its
TryAdd()
to decide if to throw.(I tagged this on a line of code to allow for a threaded discussion)
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.
Went the
ConcurrentDictionary
route, but let me know if that's not the correct implementation of it.