Skip to content

Do not abort when meeting unfixable legacy storages - #13513

Merged
MorrisJobke merged 4 commits into
masterfrom
repair-legacystoragenofatalfail
Mar 11, 2015
Merged

MorrisJobke merged 4 commits into
masterfrom
repair-legacystoragenofatalfail

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

I had a long thought about the repair step that tries and automatically fix legacy storages.
There are cases where automatic repair isn't possible.
So far, the code would bail out and refuse the upgrade.

I think it is not a good idea to prevent upgrading in such cases. It is best to show error messages and let the admin decide what to do. Some setups might run fine, especially if the broken users are old/unused ones.

This PR will change the behavior to only show an error for every storage that could not be fixed automatically.
We can then provide a documentation about the possibilities there are for manual fixing, because this heavily depends on the usage scenario and the time where the data folder was renamed.

@DeepDiver1975 @karlitschek

  • manual test
  • adjust unit tests + assert on error message

@PVince81 PVince81 self-assigned this Jan 20, 2015
@karlitschek

Copy link
Copy Markdown
Contributor

As discussed I´m not completely sure. @DeepDiver1975 What do you think?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@PVince81 let me have a look at this tomorrow - THX - please ping me

@childnode

Copy link
Copy Markdown

you self asked onced: #7539 (comment) for

[OC\RepairException]                                                                                                           
Could not automatically fix legacy storage "local::/srv/owncloud/data/marcel/" => "home::marcel" because they both have data.```

then "home::" should win regardless ?

time to make a point ;)

P.S: I now fixed it (locally) by:
sqlite3 owncloud.db ".dump oc_storages"
^^ to see the entries with colum names
sqlite3 owncloud.db "update oc_storages set id='/srv/owncloud/data/marcel.bak/' where numeric_id=1;"
^^ to replace the old entry by .bak
mkdir /srv/owncloud/data/marcel.bak && mount --bind /srv/owncloud/data/marcel /srv/owncloud/data/marcel.bak
^^ to mound the .bak files while there are references on id 1
occ maintenance:repair`` occ upgrade occ status```
^^ finish the upgrade via console because it hangs on web waiting for the admin

now I'm going to fix the references ...

@DeepDiver1975

Copy link
Copy Markdown
Contributor

pr is against master -> milestone 8.1
marking backport to get this in 8.0.1

@DeepDiver1975 DeepDiver1975 modified the milestones: 8.1-next, 8.0.1-next-maintenance Feb 20, 2015
@DeepDiver1975

Copy link
Copy Markdown
Contributor

all by itself this looks good to me 👍

@PVince81

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 was there a decision to move this forward ?

@LukasReschke LukasReschke changed the title Do not abort when meeting unfixable legacy storages [WIP] Do not abort when meeting unfixable legacy storages Feb 24, 2015
@PVince81

Copy link
Copy Markdown
Contributor Author

After discussing with @DeepDiver1975 we decided to move forward with this.
Goal is to not block updates for people with non-migratable legacy storages.

A warning will still be shown, so people who bother still get a chance to know that something might be wrong.

@PVince81 PVince81 changed the title [WIP] Do not abort when meeting unfixable legacy storages Do not abort when meeting unfixable legacy storages Feb 27, 2015
@PVince81
PVince81 force-pushed the repair-legacystoragenofatalfail branch from a0a6753 to e6abe96 Compare February 27, 2015 11:03
@PVince81

Copy link
Copy Markdown
Contributor Author
  • make sure warnings are forwarded to the output

This makes repair errors and warnings visible for the user when
upgrading on the command line or in the web UI.
@PVince81

Copy link
Copy Markdown
Contributor Author

To test:

  1. Create a user "user1" and upload some files
  2. Rename the storage to an invalid value: update oc_storages set id='invalid' where id='home::user1'
  3. Login as "user1" again, this will recreate another "home::user1" entry with another numeric_id + file cache
  4. Rename the invalid storage to a legacy one: update oc_storages set id='local::$datadir/user1/' where id='invalid'; (replace $datadir with the path to your data dir)
  5. Run the upgrade in the web UI, CLI or ./occ maintenance:repair

This will display a warning that the legacy storage could not be automatically repaired.

Please note that normally a flag is set in appconfig to avoid redoing the repair every time.
If the repair failed, the flag will NOT be set to give the user a chance to re-repair next time.

Please review @DeepDiver1975 @MorrisJobke @icewind1991

@PVince81

Copy link
Copy Markdown
Contributor Author

In the future, if @MorrisJobke's wonderfully magic script is available publicly, we could post a link to documentation on how to manually fix storages using that script.

@ghost

ghost commented Feb 27, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/10055/
Test PASSed.

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 2 updated code elements

@PVince81

Copy link
Copy Markdown
Contributor Author

Ok should work now, please review

@MorrisJobke

Copy link
Copy Markdown
Contributor

Works, storages are repaired, once there is a conflict it is not repaired, code looks good 👍

MorrisJobke added a commit that referenced this pull request Mar 11, 2015
Do not abort when meeting unfixable legacy storages
@MorrisJobke
MorrisJobke merged commit ad97ceb into master Mar 11, 2015
@MorrisJobke
MorrisJobke deleted the repair-legacystoragenofatalfail branch March 11, 2015 12:32
@PVince81

Copy link
Copy Markdown
Contributor Author

@karlitschek please confirm backport for 8.0.3: #13513 (comment)

Will prepare a PR

@PVince81

Copy link
Copy Markdown
Contributor Author

stable8: #14928

MorrisJobke added a commit that referenced this pull request Aug 18, 2015
* fixes #17313
* already in stable8+: 22bc37c - #13513
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants