Add occ preview:migrate to migrate previews from the old flat structure to a subfolder structure#22135
Merged
MorrisJobke merged 3 commits intomasterfrom Aug 7, 2020
Merged
Conversation
This was referenced Aug 6, 2020
0e467c9 to
7961401
Compare
…re to a subfolder structure * `php occ preview:repair` - a preview migration tool that moves existing previews into the new location introduced with #19214 * moves `appdata_INSTANCEID/previews/FILEID` to `appdata_INSTANCEID/previews/0/5/8/4/c/e/5/FILEID` * migration tool can be stopped during migration via `CTRL+C` - it then finishes the current folder (with the previews of one file) and stops gracefully * if a PHP memory limit is set in the `php.ini` then it will stop automatically once it has less than 25 MiB memory left (this is to avoid hard crashes in the middle of a migration) * the tool can be used during operation - possible drawbacks: * there is the chance of a race condition that a new preview is generated in the moment the folder is already migrated away - so the old folder with the newly cached preview is deleted and one cached preview needs to be re-generated * there is the chance of a race condition during access of a preview while it is migrated to the other folder - then no preview can be shown and results in a 404 (as of now this is an accepted risk) Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7961401 to
d8734b3
Compare
icewind1991
approved these changes
Aug 7, 2020
Member
icewind1991
left a comment
There was a problem hiding this comment.
Looks good besides the minor style complaint
juliusknorr
approved these changes
Aug 7, 2020
Member
juliusknorr
left a comment
There was a problem hiding this comment.
Tested and works and code looks good 👍
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2163113 to
545f806
Compare
juliusknorr
approved these changes
Aug 7, 2020
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 31487: failureacceptance-app-files
Show full log |
|
What unfortunately wasn't considered here is that the repair could be interrupted by e.g. shutting down the server as well. For my instance this resulted in ~1.5 million uncommitted rows that MySQL will now roll back. At 500 rows/15 seconds this will take forever. Almost as much as converting to the new directory structure, which was projected to take 14 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was added?
php occ preview:repair- a preview migration tool that moves existing previews into the new location introduced with Move to subfolders for preview files #19214appdata_INSTANCEID/previews/FILEIDtoappdata_INSTANCEID/previews/0/5/8/4/c/e/5/FILEIDCTRL+C- it then finishes the current folder (with the previews of one file) and stops gracefullyphp.inithen it will stop automatically once it has less than 25 MiB memory left (this is to avoid hard crashes in the middle of a migration)How does it look like?
How to test?
appdata_INSTANCEID/previews/FILEIDocc preview:repair(optional with-dand/or-v) to check the operations outRef #22063 and #22033 (it originated there but this is the essence and might be useful for all setups).