Skip to content

feat: Forward sizeDifference on update #52998

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

Closed
wants to merge 1 commit into from

Conversation

artonge
Copy link
Contributor

@artonge artonge commented May 20, 2025

And remove unneeded oldSize hack.

Reason

This will speed up update operations on S3 as primary storage by preventing the recomputation of the size of each folder higher up in the hierarchy.

Rational

When using S3 as primary storage, the Scanner is replaced with the ObjectStoreScanner. This means that we are not able to benefit from the oldSize property set in the Scanner.

@artonge artonge requested a review from a team as a code owner May 20, 2025 16:10
@artonge artonge requested review from Altahrim, provokateurin, come-nc and icewind1991 and removed request for a team May 20, 2025 16:10
@artonge artonge self-assigned this May 20, 2025
@artonge artonge changed the title Artonge/feat/forward_sizeDifference_on_write feat: Forward sizeDifference on write May 20, 2025
@artonge artonge changed the title feat: Forward sizeDifference on write feat: Forward sizeDifference on update May 20, 2025
@artonge artonge force-pushed the artonge/feat/forward_sizeDifference_on_write branch from 978c3b5 to 598055d Compare May 20, 2025 16:11
@artonge artonge added this to the Nextcloud 32 milestone May 20, 2025
@artonge artonge force-pushed the artonge/feat/forward_sizeDifference_on_write branch from 598055d to 8bda2dc Compare May 21, 2025 09:57
And remove unneeded oldSize hack

Signed-off-by: Louis Chemineau <[email protected]>
@artonge artonge force-pushed the artonge/feat/forward_sizeDifference_on_write branch from 8bda2dc to 9098aa6 Compare May 21, 2025 12:03
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests for this?

@artonge
Copy link
Contributor Author

artonge commented May 22, 2025

Do we have tests for this?

No, I would like to validate the approach with @icewind1991 first.

@icewind1991
Copy link
Member

Does this even work? Since the storage operation (with object store) would have already updated the filecache, the size you get in the new View::basicOperation logic would be the new size, not the old one. So I would expect the calculated difference to always be 0 here.

Also, this would only make the sizeDifference available to calls trough the View::basicOperation code path, where the current approach will work for all calls to Updater::update.

It will also add an additional filecache read for every file change.

@icewind1991
Copy link
Member

I'm tempting to have the object store do more of the filecache management "in house" and also have it perform the size/etag propagation when it writes to the filecache

Copy link
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a better approach

@tobiasKaminsky
Copy link
Member

@icewind1991 @artonge what is the status here?
Have Robin's remarks been resolved?

@artonge
Copy link
Contributor Author

artonge commented Jun 5, 2025

Summary from the discussion with Robin:

Overall, the issue is that the ObjectStoreScanner does not return the data needed by the Updater to use the oldSize optimisation. This is because ObjectStoreScanner->scan*() methods have nothing to scan, so they return null.

One solution would be to create an ObjectStoreUpdater and to return it in ObjectStoreStorage->getUpdater()
That new updater would mostly do nothing as ObjectStoreStorage already does a lot of cache management by itself.

@tobiasKaminsky
Copy link
Member

@artonge what does this now mean

  • dev-wise
  • time-wise

I read it like that the PR is not working, but will the solution work? And how long would it need to implement?

@artonge
Copy link
Contributor Author

artonge commented Jun 10, 2025

I should have something working before the 20th of June, if not, Robin will take over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants