-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Redesign/revamp oc_storages to fix various issues #11830
Comments
Maybe column1: unique Having the owner name here would make it much easier to find out "who is the owner of the file with id 123", which is a common problem with sharing. CC @schiesbn |
The problem with dropping the string id is that it would remove the way to get the numeric storage id from an instance of the storage class, which is needed to be able to access it's cache etc |
@icewind1991 why do we need to map a storage class instance to a string id ? Is there a better way ? If mount.json contains the matching numeric_id and oc_preferences the one for the user, there is no more need for this id. |
This also means that we need to tell that storage instance (through the constructor) what numeric_id it has in the database. |
I'd also like to remind again how much pain this (unstable id) has caused for the legacy storages, not only for me for implementing a repair step, but also for all the people who had to manually their database and needed to "guess" the ids because they were in md5 format. Also: this pain is still not over, as many people will continue to run into this issue when they decided to move the data folder. I'd like to avoid such pains in the future. Another pain for external storage that has no stable id, as it is generated by the backend config. Which means that if you change the ext storage config (ex: user name), its string id changes, resulting in a new numeric_id being created, so it becomes a different storage entry. This makes it much harder to manage storages in the first place (and detect duplicates). I'd expect from any database object that they get a unique stable id that cannot be change. Let's work together to find a suitable solution, possibly with a cleaner database design. (as part of technical debt fixing) |
This also has positive effects, causing changes to the external storage config will trigger a rescan which is needed in a lot of cases. In general I'm very much in favor for cleaning the storage system |
I think the rescan can be achieved through other means, for example a dirty flag or a "last scanned mtime" column in that table. |
@Xenopathic made a nice suggestion for storage the ext storage config in the database and have a storage to user mapping: #11261 (comment) |
Another case of storage id slippage, related to LDAP: #12035 |
As described in the top: I like the suggestion of @PVince81 to do a oc_storages cleanup and a extension of mount.json And as a extension, all files or folders shared need to get in their table a storage_id in addition. |
@mmattel I agree about the storage_id column/mapping. I thought I had documented this already but can't find it any more. |
I can not support you from the coding point of view. My knowledge is limited here. |
Something related: mapping user name to storage #15166 @DeepDiver1975 I'll set this to 8.2 Also CC @MorrisJobke who also went through the storage pains before |
Another case of storage id mismatch which leads to loss of shares: #17800 😡 |
This huge task is out of scope now as we're past feature freeze, moving to 9.0 |
We've made progress, there is now a table "oc_mounts" containing the mount points of every user: |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Currently the
oc_storages
has no real unique database id but requires the PHP code to build ids on the fly.Here is how the
oc_storages
table looks like:First, the
id
column must be computed in PHP based on the following logic:smb://user@host/rootpath
.Additionally if the id's length is bigger than 64 characters, then the
md5()
of that id will be used.The current schema is troublesome, because:
@icewind1991 @DeepDiver1975 does anyone know why we have these string ids in the first place ?
Why not use the numeric_id ? Every user could have a
oc_preferences
entry mapping them to a given storage. This would prevent strange and bad issues like the legacy storage + data dir moving issue (#10897).What speaks against discarding the storage
id
string column and working only with thenumeric_id
?We cannot rely on the storage
id
column to detect duplicate mount configurations (from external storage).I suggest to do the following:
oc_storages
. If not, at least get rid of theid
column and use a purelynumeric_id
based access.storage_id
in theiroc_preferences
table that points to their home storage id. This way there will be no more slippages (legacy storage issues with lost shares, etc...)oc_storages
table which could make resolving file owners from shares easier instead of having to jump through hoopsWhat do you think ?
The text was updated successfully, but these errors were encountered: