You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a "migration" or "fix db" script that admins can run from the command line.
When users migrated from very old ownCloud versions to OC 6, they might find themselves with a mix of different storage id formats like here: #6463 (comment) which can cause unpredictable bugs (like #6463)
The purpose of the script is to convert all home storages to use the "home::$username" format.
BUT there might be some situations where admins might have tinkered with the storage ids to move user's mount points to different places, for example: "local:://home/user1" for user1 "local::/someotherdir/user2" where the subdir is not a subdir of the data folder. (which might be a reason why @DeepDiver1975 was against having this in the automatic migration back then when we introduced the home storages)
The script must perform a test to check whether all home storages can be converted. If one or more cannot, the script will abort and show a warning.
If all can be migrated, the migration will be done.
@icewind1991 can you take care of this as you might have more knowledge about the different storage formats over the OC versions.
This is important because some parts of the code (quota) rely on the home storage being identified correctly, which it can't be with older storage formats.
So far I've seen at least 3-4 accounts of such issues because people moved their data folders but the oc_storages still used the old format that contains the hard-coded path.
Added "bug" tag as this fixes a real issue and isn't just a "nice to have".
as @PVince81 pointed out in #7203 , possibly there is a core problem with the oc_filecache that doesn't upg/date to the new home:: mounts?
The numeric_id is used in the oc_filecache table in the storage column.
I checked the oc_share table and it doesn't seem to use it, it only relies on the unique file id which maps to the fileid column in oc_filecache.
nevertheless: what is strange to me: new home:: mount-points / storages are not created for all users but only for the one who added files after migration to OC 6??
This migrate script then has to fix all these dups too.
which indeed, leads to duplicated entries in the oc_filecache table
sqlite3 owncloud.db "select * from oc_filecache where storage in (1,3,8) and path = 'files/myFile.txt'"
1999|1|files/myFile.txt|1966|myFile.txt|18|4|1312835775|0|5148d798036d0|3683884cafaf1bb3f205b0ff47abb102|0|49828|0
14621|8|files/myFile.txt|14596|myFile.txt|12|4|1312835775|0|53049c335dd3e|3683884cafaf1bb3f205b0ff47abb102|1312835775|49828|0
@childnode the issue is not in oc_filecache but in oc_storages as your post above showed.
Let me clarify:
For OC version < 5.0.13, all storages were based on the id format local::/path/to/data/username.
Starting with OC 5.0.14 and up, including OC 6, a new id format home::username was introduced to fix the "moving the data folder" issue.
Trouble is that we chose to not automatically convert the ids as it might break some installs, potentially ones where admins manually changed the paths in the DB (CC @DeepDiver1975 can you comment on this ?)
So this ticket is about writing a command that can be run manually to fix this case when you know that you didn't mess up with the DB manually.
This means that:
Users that logged in before the migration still have the old storage id format (the ones that used OC at the time it was version <= 5.0.12)
Users that have logged in after the migration (OC >= 5.0.13) will get the new storage id format.
Sorry, I didn't see that user1 was redefined. It is not supposed to.
Based on your oc_storages the expected behavior is to reuse the local::/srv/owncloud/data/user1/ and not create a new one, given that your data path is still "/srv/owncloud/data/".
Currently this update can't be forced, there is no code that can do this now, hence this ticket to provide one.
@DeepDiver1975@icewind1991@karlitschek I took some time to look through the PRs and tickets and can't find in which one we discussed the reason against providing an automatic upgrade path for this.
Can you remind me why we can't automatically replace the "local::" storage with "home::" during migration for all paths that match the data folder ?
Can you remind me why we can't automatically replace the "local::" storage with "home::" during migration for all paths that match the data folder ?
My initial throughts have been that "local::" is not only used to mount the user's home folder but also other local folders can be mounted - this might cause fuxxups
One way I thought this could be done is detecting whether the "local::" id is in the format "local::" + datadir + "/username/" in which case it would be migrated where datadir is the currently configured data dir and username any user name.
If it uses any other format it should be left alone.
That might happen when using the "Local" external storage option, in which case the format is "local::" + localPath.
I can't think of any case where an admin would manage to somehow match the same format as for the local home storage.
If it uses any other format it should be left alone.
That might happen when using the "Local" external storage option, in which case the format is "local::" + localPath.
crazy idea: setup a local mount to another user's datadir? 😉
@DeepDiver1975 do we need a repair script for crazy admins as well ? 😉
It should be possible to catch that case, but I need to change the way of the user id is extracted.
Because that crazy local mount scenario would have an id like "local::" + dataDir + userId + "/files/subdir". So the idea would be to make sure that the extracted user id doesn't contain slashes.
Yet another user affected by this issue: #7774
When the situation where "home::" and "local::" both exist for the same user, it seems to cause syncing issues, files would be redownloaded multiple times.
I haven't verified this yet, need to test it.
Hello an sry to disturb you here, but is that issue solved? Because I just find I was stuck on 5.0.10 due to a wonderfull bug: should I start from a new install then move the backuped folders for all users, or can I really safely upgrade?
The repair script isn't ready yet due to tricky situations that cannot be handled.
You might want to upgrade to 5.0.16 first and then make sure that the oc_storages table doesn't contain any hard-coded data directories any more. If it does, you could change them manually to the home:: format before further upgrade.
Activity
githubrsys commentedon Dec 18, 2013
#6464 is a regression of #6463
karlitschek commentedon Dec 18, 2013
Yes. We need this. The script itself already exists we "only" have to add the logic.
We should do the same to fix this: #6481
PVince81 commentedon Dec 20, 2013
@icewind1991 can you take care of this as you might have more knowledge about the different storage formats over the OC versions.
This is important because some parts of the code (quota) rely on the home storage being identified correctly, which it can't be with older storage formats.
PVince81 commentedon Mar 4, 2014
So far I've seen at least 3-4 accounts of such issues because people moved their data folders but the
oc_storagesstill used the old format that contains the hard-coded path.Added "bug" tag as this fixes a real issue and isn't just a "nice to have".
childnode commentedon Mar 4, 2014
as @PVince81 pointed out in #7203 , possibly there is a core problem with the oc_filecache that doesn't upg/date to the new home:: mounts?
nevertheless: what is strange to me: new home:: mount-points / storages are not created for all users but only for the one who added files after migration to OC 6??
This migrate script then has to fix all these dups too.
my
oc_storagetable looks likewhich indeed, leads to duplicated entries in the oc_filecache table
;(
PVince81 commentedon Mar 4, 2014
@childnode the issue is not in
oc_filecachebut inoc_storagesas your post above showed.Let me clarify:
For OC version < 5.0.13, all storages were based on the id format
local::/path/to/data/username.Starting with OC 5.0.14 and up, including OC 6, a new id format
home::usernamewas introduced to fix the "moving the data folder" issue.Trouble is that we chose to not automatically convert the ids as it might break some installs, potentially ones where admins manually changed the paths in the DB (CC @DeepDiver1975 can you comment on this ?)
So this ticket is about writing a command that can be run manually to fix this case when you know that you didn't mess up with the DB manually.
This means that:
Hope this helps.
PVince81 commentedon Mar 4, 2014
The thing is, as long as you don't move the data folder, the old id format still works.
Problem is only when you have legacy storage ids AND you move the data folder 😦
childnode commentedon Mar 4, 2014
@PVince81
But there is also no way to force this update (via frontend) BEVORE moving, right?
Your explanation also doesn't make it comprehensible to me to understand why user1 is there twice?
PVince81 commentedon Mar 4, 2014
@childnode good point.
Sorry, I didn't see that user1 was redefined. It is not supposed to.
Based on your
oc_storagesthe expected behavior is to reuse thelocal::/srv/owncloud/data/user1/and not create a new one, given that your data path is still "/srv/owncloud/data/".Currently this update can't be forced, there is no code that can do this now, hence this ticket to provide one.
@DeepDiver1975 @icewind1991 @karlitschek I took some time to look through the PRs and tickets and can't find in which one we discussed the reason against providing an automatic upgrade path for this.
Can you remind me why we can't automatically replace the "local::" storage with "home::" during migration for all paths that match the data folder ?
DeepDiver1975 commentedon Mar 4, 2014
My initial throughts have been that "local::" is not only used to mount the user's home folder but also other local folders can be mounted - this might cause fuxxups
PVince81 commentedon Mar 4, 2014
One way I thought this could be done is detecting whether the "local::" id is in the format "local::" + datadir + "/username/" in which case it would be migrated where datadir is the currently configured data dir and username any user name.
If it uses any other format it should be left alone.
That might happen when using the "Local" external storage option, in which case the format is "local::" + localPath.
I can't think of any case where an admin would manage to somehow match the same format as for the local home storage.
PVince81 commentedon Mar 4, 2014
See attached PR with a work in progress repair script.
DeepDiver1975 commentedon Mar 4, 2014
crazy idea: setup a local mount to another user's datadir? 😉
PVince81 commentedon Mar 5, 2014
@DeepDiver1975 do we need a repair script for crazy admins as well ? 😉
It should be possible to catch that case, but I need to change the way of the user id is extracted.
Because that crazy local mount scenario would have an id like "local::" + dataDir + userId + "/files/subdir". So the idea would be to make sure that the extracted user id doesn't contain slashes.
karlitschek commentedon Mar 5, 2014
great initiative @PVince81 Makes sense 👍
PVince81 commentedon Mar 5, 2014
Ouch, once again posted in the issue instead of the PR.
PVince81 commentedon Mar 24, 2014
Yet another user affected by this issue: #7774
When the situation where "home::" and "local::" both exist for the same user, it seems to cause syncing issues, files would be redownloaded multiple times.
I haven't verified this yet, need to test it.
flop25 commentedon Jun 4, 2014
Hello an sry to disturb you here, but is that issue solved? Because I just find I was stuck on 5.0.10 due to a wonderfull bug: should I start from a new install then move the backuped folders for all users, or can I really safely upgrade?
PVince81 commentedon Jun 4, 2014
The repair script isn't ready yet due to tricky situations that cannot be handled.
You might want to upgrade to 5.0.16 first and then make sure that the
oc_storagestable doesn't contain any hard-coded data directories any more. If it does, you could change them manually to thehome::format before further upgrade.