Repository navigation
Added repair script to upgrade the legacy home storage ids - #7539
Conversation
|
🚀 Test Passed. 🚀 |
|
If you can provide me some startup cables, I'll plug it onto my ownCar ;) s.th. like didn't changed anything. Unfortunatly I'm not familar with the Symfony Command used for |
|
without knowing much about the details, it seems more robust to me if comparision is made case insensitive: and if there would be an error / hint if anything failed would be great too: |
|
@childnode If you check out this branch you can run the script this way from the command line: The thing is, the repair script architecture design isn't finished yet, so I'm not sure what way we should use to return errors, I was hoping for @icewind1991 to clarify on this since he started implementing the skeleton of the repair scrips. Also, thanks for your code comments, I'll look into them. |
|
|
@PVince81 ok, for me, the script doesn't work but crashed with contraints iteration stops while trying to add an home::user1 which already exists: echo-stack for |
|
Right, in your case logging in as those users already created a separate storage home::user id. I think the migration script needs to be adapted to take such cases into account, maybe delete the old entries (might be dangerous) if new ones exist already, or just leave them as is and skip them (and report the skipped count) |
|
If you can read in my comment on #6493 there are duplicate entries in the |
|
@PVince81 Do you see a way to fix the duplicate entries at the same time? 😈 |
|
Like I said the old storage entries could be deleted by the script if a new one already exists. |
|
|
Well I think that the DB is already "broken" if duplicate entries exist. So deleting them has to be done sooner or later anyways |
|
Deleting old entries should be possisble as long as the data folder is still the same. |
|
Ok, first, to recreate this situation, here are some test steps:
Since no home entry was found under the given data dir, a new entry gets created: And the oc_share table has shares still pointing to the old home storage... Let's see how to fix that situation without losing the shares... |
|
Here are some tentative fixing steps: Step 1: Try and find the old data dir path.For some reason, the DB always has one entry with the data. Step 2: Find duplicate
|
|
How to fix the share table (just writing down ideas):
This is getting quite complex... |
|
These days I had some new ideas that might be relevant to fixing cases where the data directory was moved:
|
|
I've modified the script to do the following:
There is no code yet for the old data dir, still need to think about it. I think in most cases this situation exists only because people moved the data dir. Maybe they put it back, maybe didn't. |
|
@karlitschek just re-saw your comment:
It means that if conflict exists, then we always delete the old one. This means that share entries would also be broken, so this would need to be cleant up as well (I raised #7874 to clean up orphaned entries, so that could also include shares from files from dead storages) @karlitschek another comment: I saw in the code that the repair routines are run during migration, is that intended ? Or do we want admins to always run this here manually ? |
|
💣 Test Failed. 💣 |
|
💣 Test Failed. 💣 |
|
💣 Test Failed. 💣 |
|
Failing unit tests are due to Oracle. Still, would be good to get some feedback from you guys on this version of the script, as a first version. Do you agree that in case of conflict between "home::" and "local::" (both having data), then "home::" should win regardless ? |
|
🚀 Test Passed. 🚀 |
|
Looks like Oracle doesn't like closeCursor(), it closes it the first time but the second time we recreate that prepared statement, it fails with |
I would guess the reason gc isn't enough here is that you store the statements as class members instead of local variables |
|
@icewind1991 yes, possibly. And the class instance probably gets collected too late during unit tests run. |
|
A new inspection was created. |
|
🚀 Test Passed. 🚀 |
|
Tests finally pass! YAY! @icewind1991 please have a last sanity check at b8b2ef8 and the closeCursor parts here: https://github.com/owncloud/core/pull/7539/files#diff-07a5cf597a8775f7351a9bbaa5eb5084R89 Then this can be merged. |
|
👍 |
Added repair script to upgrade the legacy home storage ids
|
@karlitschek do you think we should backport this for 7.0.3 ? One trouble with this is that users with "broken" database will get an exception and might be frustrated that a minor version upgrade causes this. "Broken" as in a state that cannot be repaired automatically and need manual operation. Another idea would be to only integrate this in the CLI "repair" command for 7.0.3 for those who do want to try it, but make it auto-run on OC 8. |
|
Follow up here: #10897 |
|
@karlitschek The backport request was triggered by @butonic |
|
Beware, if any user in OC 7 has broken storages the upgrade will REFUSE to run because of the exception. I thought it isn't acceptable to block users in a minor upgrade. Major upgrade might be ok. Else we'll need to reconsider making it a soft fail: #13513 |
|
"broken storage" as in "a broken storage situation that cannot be repaired automatically" |
|
I agree with @PVince81 We should the broken entries or ignore them. But blocking upgrade without the option to repair it is not good in a minor version. |
|
Hi, can anyone tell me whether I should expect the 'occ maintenance:repair' task to fix the absolute paths in oc_storages on v8.2.3? I just migrated an ownCloud install from one server to another and in the end I had to install it in the same filesystem location on the new server as the old one (which in this case is rather inconvenient), because I was not able to fix the storage IDs. I've run 'occ maintenance:repair', but after running it I still see all the absolute paths in the oc_storages table, so it doesn't appear to actually be doing anything. Cheers, Ian. |
|
@idmacdonald for support please ask in http://central.owncloud.org/ |
|
Hi @PVince81 I have posted my issue there: I couldn't figure out how to send a private message over there, so just letting you know. Cheers, Ian. |
|
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. |
I'm tired of these legacy storage id issues when people move their homes, so here is the repair script.
Fixes #6493
I've tested with MySQL:
This needs to be tested on all DBs.
TODO:
@DeepDiver1975 @icewind1991 @karlitschek