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
Alternative SMB external storage implementation where all users of on… #38139
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
As you mentioned using redis for caching stat information. I would propose implementing that from the beginning. Just imagine a big photo stock that gets shared by smb... (PS: I like that kind of conversation. I propose, you work 😎 🍻 ) |
generally speaking (on a high level) there is no difference if I ask for a file listing over the network talking smb or redis protocol with a smb or radis server. Such a cache might be of interest in special setups or on special purpose - nothing to be added as a general concept right away.
hehe - I better reach you how to code ;-) |
Regarding caching, there is a protocol overhead when using smb (smb is a monster) compared to redis. This could be even more a notifyable impact when the request to redis is on the same physical server than on a seperate one. Just my 2c |
Productive setups require a shared cache which lives on the network ... this is why I said 'over the network' ;-) I am not against caches - but they come at a later stage ..... |
…e share use the same storage id. User specific access is filtered in a cache wrapper by stating the files on SMB
0f2401b
to
97b1755
Compare
Q: when rereading the description text, a question raised. It is about "All users share this storage". Does this mean the following: Having existing users and adding new users, when a smb storage has this option set, the mount is accessible to all of them depending on the credentials set (readonly) / given by the host? In other words, having a ownCloud group where you add all users would do the same but with more overhead work? |
We have a couple of options at the moment:
All of this is bound to the specific storage id the implementation provides, which usually depends on the external account that is used to access to the external storage. For the case of this PR, what we're doing is that, having different external accounts, we'll still use the same storage view for all the ownCloud users. The limitations exposed above should be mitigated by checking the access to the storage more often. |
@DeepDiver1975 could you double-check the following use case?:
Is step 5 possible under those conditions? At step 4 the "/SMB/a" folder should be present in the filecache. When the user2 access to "/SMB/a" the mtime won't have changed and we'll get the cached contents. The problem is that those contents will be empty because user1 couldn't scan further, in particular "/SMB/a/b" won't appear because it isn't in the cache yet. |
I guess that falls into the "update detection" checkbox in the TODO. |
I already tested this scenario - and you are absolutely right - because the mtime did not change no scan happens and the 'new' folders/files do not show up. A more feasible solution might be to store the mtime for each folder per user and use this value for comparison in hasUpdated() Objections? @jvillafanez |
There could still be some overload. When a change is detected, each user will trigger a scan even if it isn't strictly needed: user1 changes a file and user2, user3, user4.... will update the filecache even if the information is the same for them (same access restrictions for all of them) Definitely better than triggering a filecache update always, but we'll have to maintain an additional structure in redis. We'll need to put some limits somehow because I don't think we can store the whole SMB storage in redis multiplied by the number of users, specially if there are other things stored there. There could be some alternatives if we add ACLs into the mix, but it will add even more complexity to the solution. This seems a reasonable approach |
Q: what triggers a change detect and can a scan be marked to be in progress so other scan request for the same can be rejected? |
But: if a user accesses a smb share with a file explorer - this will also talk to the smb server and this consumes time. Maybe it is just okay that the user has to wait a short while and in return proper information is displayed .... |
Kudos, SonarCloud Quality Gate passed! |
Having the
This brings us to the next problem: what happens if user2 (who has less permissions) has to scan a folder? This could also happen in the previous solution, although less frequently. Maybe we should use a service account instead for the scanning. This way we ensure that the scans remain stable. We can still use the user accounts in order to check access. |
Very valid point - perform scanning of the full smb share via cron? Is that reasonable in terms of execution time? |
I was thinking about using 2 different connections: one for the "normal" access which will use the service account, and a different one for the storage cache using the user account. |
(wnd only) or we leave this to the notificatoin process - this already has a service account and pushes file changes to owncloud. |
superseded by #38151 |
…e share use the same storage id. User specific access is filtered in a cache wrapper by stating the files on SMB
Description
ToDo:
How Has This Been Tested?
Screenshots (if appropriate):
Same file id is used and as result comments and tags are show properly on both users:
File ID is the same - see last query parameter in url
Tow users with different permissions see folder content accordingly:
Setup option
@pmaier1 @hodyroff - happy to take your recommendations in terms of naming this checkbox ;-)
Types of changes
Checklist: