-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Move to subfolders for preview files #19214
Conversation
|
Ah right I need to add the same logic to the background job to use the proper location.
Nope. Nextcloud expect data to be under the data directory. |
That's the tricky part 😞 Have fun 😃 |
Adding the logic to the background job is also where I stopped, as my Nextcloud DB schema knowledge was not enough to find a proper solution. I am glad that you took over this task. Thank you very much! |
I think I have an idea... lets see ;) |
seems to work... 27e0ded |
Addressed. Please check and test |
Can we have a test for the old and new way in https://github.com/nextcloud/server/blob/master/tests/lib/Preview/BackgroundCleanupJobTest.php? |
fb9ef6e
to
3afdfdd
Compare
3afdfdd
to
7304a23
Compare
All good I think |
Not quite
|
7304a23
to
5284acf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few interesting comments, but code looks great so far! 🐘
353ed85
to
30ca622
Compare
So now finally good I think. |
Still 👍 from me |
Would you mind to run
🤔 |
Seems to do the trick 👍 but a rebase is needed 😨 I don't like that after deleting a preview the folder structure stays even if there are no more previews 🤷♂️ |
30ca622
to
1b3cb1c
Compare
Yeah fair enough. I guess checking for that is rather straight forward to do. |
Else the number of files can grow very large very quickly in the preview folder. Esp on large systems. This generates the md5 of the fileid. And then creates folders of the first 7 charts. In that folder is then a folder with the fileid. And inside there are the previews. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
1b3cb1c
to
6c603e8
Compare
$this->assertSame(1, $this->countPreviews($root, $fileIds)); | ||
$job->run([]); | ||
|
||
$root = $this->getRoot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented that line locally and the test failed 🤔 Would you mind to explain why a new instance is needed?
…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>
A tool to migrate existing previews into this new format can be found at #22135. |
…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>
…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>
…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>
…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>
My take on #16747 @gbmaster please have a look as well.
Else the number of files can grow very large very quickly in the preview
folder. Esp on large systems.
This generates the md5 of the fileid. And then creates folders of the
first 7 charts. In that folder is then a folder with the fileid. And
inside there are the previews.
Since this is just an abstraction as to how things are stored. i chose to just extend appdata to handle it. This was non of the code touching it needs to be concerned with how things are stored. As long as they are stored (think of it as a poor mans objectstore).