-
Notifications
You must be signed in to change notification settings - Fork 129
Create dedicated cache FS #550
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
Conversation
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.
Tried it out. It indeed solves the problem. Also the general approach seems quite reasonable.
} | ||
|
||
{ | ||
lock_guard<mutex> lock(cached_fs_mutex); |
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.
This is probably a bit overkill since GetFS
is only called under a lock already, but feels more future-proof
return LocalFileSystem::OpenFile(oss.str(), flags, opener); | ||
} | ||
|
||
void AssertSameCacheDir(const string &other_dir) { |
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.
When I read Assert I expect it's a thing that's only checked if assertions are enabled, so let's name this differently.
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.
Given it's only used in one place, maybe just inline it.
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.
But then I have to make the cache_file_directory
public just for this method? I preferred to not leak it :-)
Co-authored-by: Jelte Fennema-Nio <jelte@motherduck.com>
This reverts commit 24891f4.
@@ -78,6 +80,13 @@ class CachedFileHandle { | |||
shared_ptr<CachedFile> file; | |||
}; | |||
|
|||
class LocalCacheFileSystem: public LocalFileSystem { | |||
// TODO: we could lock down the LocalFileSystem to only allow path that are in the cache directory |
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.
let's remove this comment
For posterity - we've discussed |
Today, non super-users are going to face an error when querying S3 objects like:
The reason is that the current cache mechanism uses the DB's
FileSystem
which non-super users cannot access.To fix it, we create a dedicated FS that the extension is allow to access (but not the user directly).
cache_file_directory
(no path)OpenFile
are throwing a permission error.