Skip to content
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

GH-79 Copy and delete performance #92

Merged
merged 8 commits into from
Dec 4, 2024
Merged

GH-79 Copy and delete performance #92

merged 8 commits into from
Dec 4, 2024

Conversation

bstopp
Copy link
Contributor

@bstopp bstopp commented Nov 1, 2024

Description

Copy & Delete now return a specific status code based on resulting state:

  • 204 if the operation is complete
  • 206 if there is more to process.

Copy operation remaining keys are stored in KV, subsequent calls for that operation w/ continuation token will use the remaining list, updating KV as necessary if more remain.

Delete operation can simply be called again and again until a 204 response is returned.

Related Issue

Fixes #79

How Has This Been Tested?

Added unit tests, also added functional/integration test as expected by browser.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

auniverseaway and others added 3 commits October 31, 2024 13:17
* Copy and delete now share a listCommand - DRY
* Copy and delete now pass down a continuationToken
* Delete will now look for formData

Resolves: GH-79
@bstopp bstopp changed the title Copy perf redux2 GH-79 Copy and delete performance Nov 1, 2024
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 88.70968% with 14 lines in your changes missing coverage. Please review.

Project coverage is 55.61%. Comparing base (e407d91) to head (56798d0).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/storage/object/copy.js 82.05% 7 Missing ⚠️
src/helpers/delete.js 86.36% 3 Missing ⚠️
src/helpers/copy.js 0.00% 2 Missing ⚠️
src/storage/utils/list.js 95.12% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
+ Coverage   53.64%   55.61%   +1.96%     
==========================================
  Files          38       39       +1     
  Lines        1795     1836      +41     
==========================================
+ Hits          963     1021      +58     
+ Misses        832      815      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

return /* await */ deleteObjects(env, daCtx);
export async function deleteSource({ req, env, daCtx }) {
const details = await deleteHelper(req);
return /* await */ deleteObjects(env, daCtx, details);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the await commented out instead of deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not know. I left it there as it was from the original variation of this work.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did that 😄
The reason is that I find it problematic that all of a sudden the linter wants you to lose the await on an async function if its called on return. If you change the function later and want to add some statements before returning you might forget to add the await at that point.
So I just added the await in a comment as a reminder.

But if you don't like it feel free to remove 😄

src/storage/object/copy.js Outdated Show resolved Hide resolved
}),
);
}
await Promise.all(sourceKeys.map(async (key) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know for the client-side operations @auniverseaway is now using a queue to limit the number of concurrent operations. Is that something that could be needed if a very large copy operation is happening?

Copy link
Member

Choose a reason for hiding this comment

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

As long as we stay under 1000 sub-requests, we should be fine. The Queue class on client-side is for when we have 2000+, want to send all immediately, and don't want the browser to choke with too many requests.

@bosschaert
Copy link
Contributor

Just wondering is there anything stopping us from merging this?

bosschaert and others added 2 commits December 3, 2024 17:19
Fix key passed to postObjectVersionWithLabel when deleting
@auniverseaway auniverseaway merged commit b4958a5 into main Dec 4, 2024
5 checks passed
@auniverseaway auniverseaway deleted the copy-perf-redux2 branch December 4, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve copy and delete performance
4 participants