-
Notifications
You must be signed in to change notification settings - Fork 0
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
File Cache Refactor #374
base: main
Are you sure you want to change the base?
File Cache Refactor #374
Conversation
Update tests to work with sync deletion. Create files directly in loopback whenever possible.
When timeout is zero, evict everything.
Drop CacheInvalidate function.
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 few questions/concerns. Are there some negative performance impacts that you have noticed now that deletes are all synchronized? It seems that this could end up slowing the filesystem down when there is a large cache as a lot of time would be spent synchronously deleting. Did this fix any prior race conditions when using the go race detector?
I'll try to address your questions one bit at a time:
|
In the third point, I said this was for network fault tolerance... it's actually in prep for a much smaller feature: maintaining file handle validity after rename and deletion (to better fit with POSIX). |
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 think that some of the locking and unlocking could be a bit aggressive. It seems that there is a possibility for deadlock. In particular, the unit tests are timing out due to deadlock. Also, I might recommend using the race detector when running the unit tests to check for any race conditions as you add / remove some of the locks.
If the tests can't finish then they can't fail! 😁 |
Remove zero timeout handling code. Clean up linked list code. Update tests. Update documentation.
… (not just one handle). Add residency state variables to flock as well.
… downloading when the file is lazy opened (but not completely opened).
Keep file state updated Use isDownloadRequired in OpenFile to completely open any file that doesn't need downloading. Improve logic to prevent erronious ENOSPC error.
This PR changes the file cache by:
1. File state:
I made this simplified diagram to show how I think file states should work. Every transition between states is now protected by a lock, without any risk of deadlock.
2. Synchronous file deletion:
This change only affects the deletion of cached files which we were explicitly asked by the user to delete. Evictions are still asynchronous. These two very different situations used to use all the same code, which was causing lots of issues, because the two are very different cases. This caused a number of race conditions, bugs, which up until now I was "fixing" using bad code. Now I think async deletion is simply incorrect for user requests. So I removed it.
3. isDownloadRequired:
4. OpenFile:
OpenFile had a slight issue, which is that if the user called Open with the create flag instead of calling Create explicitly, then we would end up creating a file handle without creating any file or object behind that. Then the user could call GetAttr and we would report that the file they have open doesn't exist.
I changed OpenFile to call isDownloadRequired right away, and open the local file immediately if a download is not required.
Changed file cache tests:
What type of Pull Request is this? (check all applicable)
Checklist
Related Issues