Repository navigation
Conversation
|
Oh it is the case FS cache after all...
Same. And the PR introducing it doesn't help in that regard (#6974), because the main change and all explanation is about improving the file caching. This might indicate that the filesystem caching is related, which would make sense if we recreated the filesystem a lot, as we then also drop cache. However we keep the filesystem in the folder, and that's where most of the filesystem interaction comes from. The only place that can also cause quite a few filesystem interactions that creates a new filesystem every time, is
Keeping a |
| } | ||
|
|
||
| func (f *caseFilesystem) Rename(oldpath, newpath string) error { | ||
| f.dropCache(oldpath, newpath) |
There was a problem hiding this comment.
What's the reason for this change, i.e. why must the cache not apply to renames?
There was a problem hiding this comment.
So this is not related to the real issue I was solving, this is me futzing about. I changed the cache time from one second to 15 seconds to make the cache more effective, but I was thinking something that case-only renames would be especially sensitive to this, but really, if that's the case we'll just retry so I think there's no real reason now that I look at it in broad daylight
really this should probably just ask the folder runner for the filesystem to use |
|
@imsodin I think we need to do some minor re-architecting here. The current caseFs caching is bad and should go away, it's an enormous footgun that's evidently really hard to troubleshoot, it took me like two hours staring at the code and experimenting to even find it. Maybe or maybe not we should cache the realCaser and maybe we should think about how we drop that cache. I think I'll do a quick patch release with the problematic change reverted, and we can fix this properly in good time for next release? |
Thanks a lot for doing that, definitely good to fix the immediate issue and buy us time!
That sounds good. I'd like to make that a bit clearer in terms of available methods to get filesystems for a folder. It's not that great if one just needs to know that getting a new filesystem could be costly. It's however very non-obvious to me how to do that -
For pretty bad reasons I currently tend towards keeping things pretty close to how things are, just cache the |
|
I gave the option "only cache the cache" a go here, together with a reproducer unit test for the scenario you identified (did fail before, doesn't now): #9680 |
@imsodin 👋
This is a somewhat unclean patch as I'm doing a couple of things at once, but we can sort that out in time. The main thing is that I want a discussion around the caching of caseFs instances. That's what causes the problem in #9677, because at the end of the chain in NewFilesystem we try to wrap it in a caseFs, but then the caseFs registry pulls a switcheroo on us and gives us a different wrapped filesystem that doesn't have an mtimeFs in the stack. This happens because we only sometimes create with an mtimeFs -- namely when we have a FileSet (database) available.
Now, I completely forget why we thought we needed to cache caseFs instances. As far as I can tell we create essentially two "kinds" of FS instances -- very short lives ones here and there when we want to check folder health and free space and such, and these don't include mtimeFs in the stack, or the long lived one that is set in the folder instance and shares the folder lifetime.
The current cache manager does one other thing though and that is it periodically clears the cache inside the cacheFs. We could potentially do that some other way, like the folder itself could explicitly do it when it completes a scan/pull cycle for example.