-
Notifications
You must be signed in to change notification settings - Fork 2.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
Improve query to cleanup the previews #40974
Conversation
570c551
to
b8a39ec
Compare
@phil-davis could you check the test "the previews from shared files are cleaned up" in https://drone.owncloud.com/owncloud/core/39041/112/16 ? There might something wrong with that test, at least now with the code in the PR. I've run the test manually an the result I get is the following:
The first execution is when Brian has deleted the 2 files from the trashbin. I guess those are the thumbnails generated when Brian deletes the files from the trashbin, because the files in the Brian's trashbin are copies of the original, so their file id is different. For the second execution, the Alice's thumbnails are deleted as expected for both files, and Brian's thumbnails should be the ones generated when the files were still shared. Since they were still linked to a valid file id, it's ok that they're deleted now. |
Same manually steps with master branch:
The reason for the different results is due to how the query is made.
Note that file ids 29 and 72 appear for Alice and Brian. This happens because Brian can access to those file ids by the created share For the new query:
In this case we're interested in the storage (we can figure out the owner later), so the entries coming from the share don't appear. That should explain the different results, so it makes sense to adjust the test |
9c81c62
to
6978f0b
Compare
6978f0b
to
2f1902c
Compare
@phil-davis I think I can adjust the test to make it pass, or do you want to change the tests in another way? |
Rise chunk size to 500. Cron job is expected to run up to 1 minute approximately. |
I am quite busy with other things, so yes, adjust the tests to expect what you mentioned in the comments above. Ping me if you need advice... |
Note: issue #40979 |
@phil-davis @jvillafanez should we force-merge this? |
If we need to rush it, I think we can force merge it, but I'd rather wait until CI is fixed if possible. |
only the known sqlite-windows unit test pipeline is failing, and I don't think that this PR has any impact on that. |
I've re-triggered the CI. The sqlite-windows unit test pipeline should now succeed! 👓 |
@mrow4a @DeepDiver1975 Review here? CI is passing now. |
@jvillafanez changelog is missing. |
Changelog added |
Kudos, SonarCloud Quality Gate passed! |
Tested the query with pgsql and cast to BIGINT ✅ |
Description
Optimize the query to cleanup the previews to improve the performance of the job
Related Issue
https://github.com/owncloud/enterprise/issues/5978
#40971
Motivation and Context
Previous query was taking too much time to run, and it was causing problems.
How Has This Been Tested?
Manually tested with mysql. Need to test with postgresql and oracle.
Screenshots (if appropriate):
Types of changes
Checklist: